Extractor instructions
Extractor instructions define authenticated access to a source: the requests of an Extract job, their authentication, and the values to keep from each response. To build an Extract job in the app, see Extractors.
Top-level keys
| Key | Required | Meaning |
|---|---|---|
$schema | No | Schema identifier for validation: https://hypermeter.com/extractor.schema.json. |
inputs | No | Input definitions, used as inputs.<name> in template expressions. |
coverage | No | Requested business period for Production source data. |
authentications | No | Named authentication definitions that requests reference with auth. |
requests | Yes | Ordered request definitions, at least one. |
Inputs
| Key | Required | Meaning |
|---|---|---|
name | Yes | Input key. Must start with a lowercase letter and can contain lowercase letters, numbers, _, and -. |
type | No | String, Boolean, Numeric, DateTime, or SecretRef. Defaults to String. |
default | No | Value used when the run does not supply one. Boolean defaults must be booleans. Numeric defaults must be numbers. |
Use SecretRef for every secret value, and never a raw secret default. See Secrets.
Requested business coverage
Use coverage when the request has a known business period. Omit it when the period is not trustworthy. The Source Data catalogue then shows Unknown.
coverage.requested.startandcoverage.requested.endmust reference publicDateTimeinputs. You choose the input names.coverage.timezonemust be an IANA timezone, such asUTCorEurope/Amsterdam.
inputs:
- name: period_start
type: DateTime
- name: period_end
type: DateTime
coverage:
requested:
start: ${{ inputs.period_start }}
end: ${{ inputs.period_end }}
timezone: UTC
A schedule can supply expressions as the values of these inputs. They are resolved before coverage. A Production run fails before the source requests start when a value is not an RFC 3339 timestamp or when start is not before end.
Coverage only adds catalogue metadata. It does not restrict the requests, and it does not prove that the source returned every record in the period.
The optional coverage.completeSources adds completion checks for daily files and Azure Cost Details reports. It can authorize the replacement of a complete source partition, including an empty response. See Corrections from complete sources.
Authentication definitions
Each entry has a name. A request refers to it with auth. For a description of each type, see Authentication methods.
| Type | Required keys | Optional keys |
|---|---|---|
Basic | name, type, username, password | None |
OAuth2 | name, type, url, clientId, clientSecret | grantType, scope, tokenEndpointAuthMethod |
Jwt | name, type, url, issuer, audience, duration, privateKey | scope |
DbConnection | name, type, host, database, username, password | port |
Azure | name, type, account plus one of accessKey, sasToken, bearerToken | None |
AWS | name, type, accessKey, secretKey | sessionToken |
GCP | name, type, accessKey, secretKey | sessionToken |
AWS_STS | name, type, roleArn | accessKey, secretKey, sessionToken, externalId, sessionName, durationSeconds, stsRegion |
An explicit database port must be an integer from 1 through 65535. When you omit it, the default is 5432 for PostgreSQL, 3306 for MySQL or MariaDB, 1433 for SQL Server, and 1521 for Oracle.
There is no standalone Bearer type. For bearer-token or API-key sources, use OAuth2 or Jwt when Hypermeter must acquire the token, or set the HTTP header directly:
headers:
Authorization: Bearer ${{ inputs.api_token }}
OAuth2 token endpoint method
tokenEndpointAuthMethod sets how the client authenticates to the token endpoint. Data requests always use the bearer token that the endpoint returns.
| Value | Token request |
|---|---|
Omitted or client_secret_post | client_id and client_secret are form fields in the body. |
client_secret_basic | The ID and the secret are sent in Authorization: Basic, and neither is in the body. Each value is form-encoded before it is base64-encoded, as RFC 6749 section 2.3.1 asks. |
grant_type, scope, and the refresh parameters stay in the body with either method. Validation refuses any other value, and there is no fallback from one method to the other. Databricks machine-to-machine OAuth documents the Basic method:
authentications:
- name: databricks-oauth
type: OAuth2
url: https://${{ inputs.workspace_host }}/oidc/v1/token
clientId: ${{ inputs.client_id }}
clientSecret: ${{ inputs.client_secret }}
grantType: client_credentials
scope: sql
tokenEndpointAuthMethod: client_secret_basic
Request keys
Every request has these common keys plus the keys of one source variant.
| Key | Required | Meaning |
|---|---|---|
name | Yes | Stable identifier, used in expressions and diagnostics. Must start with a lowercase letter and can contain lowercase letters, numbers, and -. |
displayName | No | Readable name. Can contain spaces and capital letters. Changing it does not change the identifier. |
type | Yes | Request type, such as HttpGet, PostgreSql, S3Bucket, or AzureBlob. |
description | No | One-line description. Can use template expressions. |
semanticEffect | No | Business effect, used for live Preview safety: read_export, unknown, or business_mutating. Defaults to unknown. Hypermeter does not derive it from type or the HTTP method. |
if | No | Conditional expression. A falsy result skips the request. |
load | No | Whether to load the fetched document. Defaults to true. Use false for discovery requests that only produce outputs. |
metadata | No | Object with string values, attached to loaded documents. |
auth | No | Authentication reference: a name, or { name, options }. AWS options commonly include region and service details. |
matrix | No | Dimensions that repeat the request. |
pagination | No | Response source and continuation request. |
decompression | No | Gz or Zip, applied before output parsing and loading. |
outputs | No | Values captured from the response body or headers for later requests. |
Zip extracts every file entry, and each entry becomes one loadable artifact in archive order. A single-entry archive behaves like an ordinary body. A request that reads its response body (outputs from the body, fromBody keys, body pagination, or body polling) cannot use an archive with more than one entry. An empty archive fails the request. So does an archive with more than 10,000 file entries, in Preview and in Production: the error names the limit and the entry count.
Conditional requests
Use if to skip a request, for example for an empty batch or missing input data.
- When the condition is false, Hypermeter makes no source call and stores no artifact. The extraction history records the request as skipped. In Production, the URL, headers, body, authentication options, and
outputs[].key.fromValueexpressions are not evaluated. - When the condition passes, Hypermeter prepares and validates the request before it contacts the source.
- An error in the condition or in the request preparation fails the request with a dependency diagnostic.
Public business metadata
Use metadata for public business values such as an account, invoice, region, or billing period, including matrix values.
- Each key and each rendered value can contain at most 1,024 UTF-8 bytes.
- Workflow validation rejects forbidden keys, such as
object-key,storage-prefix,authorization, andaccess-token. The check ignores case and common separators. Use a public business identifier instead. - A value cannot be a secret reference, an authorization value, a signed query, a complete URL, another URI scheme, or a nested sensitive URL. The error names the field and does not show the value.
- Relative references with public query parameters are allowed, such as
/invoices/42?provider=azure. Nested query values have a maximum depth of four.
For lineage, each loaded row already records its artifact in the Loader system column source_artifact_id. See Published schema.
For Azure billing accounts, use the exact key billing-account-id. It accepts the format <UUID>:<UUID>_2019-05-31, with two complete UUIDs and no spaces, percent encoding, query parameters, or fragments. Supply it directly or through a public String input:
metadata:
billing-account-id: ${{ inputs.billing-account-id }}
region: ${{ inputs.region }}
Source variants
| Request family | type values | Required keys | Optional keys |
|---|---|---|---|
| HTTP | HttpGet, HttpPut, HttpPost, HttpPatch, HttpDelete, HttpOptions | type, url | headers, body, onError |
| SQL query | PostgreSql, MySql, MariaDb, SqlServer, OracleDb | type, query | None |
| SQL table | PostgreSql, MySql, MariaDb, SqlServer, OracleDb | type, table | None |
| Amazon S3 | S3Bucket | type, bucketName, region, path | endpoint |
| Google Cloud Storage | GcsObject | type, bucketName, region, path | None |
| Azure Blob | AzureBlob | type, blobName, containerName | None |
The common request keys apply to every family.
Write each SQL query in the dialect of its source type. A PostgreSql request uses PostgreSQL syntax, not the DuckDB syntax of a Transform job.
For the full source list, see Data sources.
Response formats
Do not set a response format in a request. Hypermeter detects the format of each completed response, and Preview shows it.
- HTTP and object requests support
CSV,JSON,NDJSON, andPARQUET. - Database query and table requests produce
CSV.
An unsupported or unclear format stops the request before the Load job uses the artifact.
Matrix expansion
matrix runs the same request for multiple values.
matrix:
customer: ${{ outputs.customers }}
subscription: ${{ outputs.subscriptions_by_customer[matrix.customer] }}
- Independent dimensions form a Cartesian product.
- A dimension can reference an earlier dimension through
matrix.<name>to create a layered sub-matrix. - Self references, circular references, and references to undefined dimensions fail validation.
- Sample Preview runs the first five matrix variants of each request. Full validation runs the complete matrix unless a hard safety limit stops it.
Pagination
The normal request fields define the first page. pagination describes how to get the later pages.
| Key | Meaning |
|---|---|
source.body | Response-body selector for the continuation state. |
source.header.name | HTTP response header that holds the continuation state. Matching is case-insensitive. |
source.header.relation | Relation to select from the HTTP Link header. Use name: Link with it. |
continueWhen | Optional separate Boolean rule. Must resolve to true or false. |
nextRequest | Only the fields that change for the next page. |
Select the continuation state from one source. Query, Table, and Storage requests can use only source.body.
The selected value is available as next, only in continueWhen and nextRequest. These two fields can also use template functions, inputs, outputs, and the current matrix values.
The example replaces the first URL with the URL from nextLink. When the response returns a cursor object and a separate continuation flag, select the object and test the flag:
url: ${{ inputs.base_url }}/v1/invoices
query:
size: 100
pagination:
source:
body: $.pagination
continueWhen: ${{ next.has_more }}
nextRequest:
query:
cursor: ${{ next.cursor }}
For RFC-compliant Link pagination, select the next relation:
url: ${{ inputs.base_url }}/v1/invoices?size=100
pagination:
source:
header:
name: Link
relation: next
nextRequest:
url: ${{ next }}
nextRequest must use fields of the same request family:
| Request family | Allowed continuation fields | How they apply |
|---|---|---|
| HTTP | url, query, headers, body, and auth.options | query and headers values merge over the first request, and a null value removes that key or header. url and body replace the first value. The authentication type and identity stay fixed. |
| Database query | query | Replaces the complete SQL query. |
| Database table | table | Reads the complete next table. |
| S3 | bucketName, region, path, and endpoint | Reads the next object, without listing the bucket. |
| GCS | bucketName, region, and path | Same as S3. |
| Azure Blob | containerName and blobName | Reads the next blob, without listing the container. |
An HTTP continuation URL can be absolute or relative. A relative value is resolved against the exact request URL that produced the response. The resolved URL must use HTTP or HTTPS, contain no user information, and keep the same scheme, host, and effective port.
Every scalar request target must resolve to one scalar value. Select a child path when a matrix or continuation value is an object or list.
When pagination stops
- Pagination stops when the source is missing, null, empty, whitespace-only, or an empty collection. You need
continueWhenonly for a separate Boolean rule. - Do not write
continueWhen: ${{ next }}whennextis a URL or cursor. That expression returns a string, so the request fails with a configuration error. - The completed page counts for the response and the outputs before
continueWhenis evaluated. A false result prevents only the next request. - Sample Preview fetches at most two pages for each request execution and matrix variant. It reports Preview limit reached · more source pages exist when the source has more pages than the sample fetched.
- Full validation continues until pagination ends, a hard cap stops execution, or a runtime error occurs.
Outputs
Outputs capture values for later requests of the same Extract job.
| Key | Required | Meaning |
|---|---|---|
name | Yes | Output name. Later requests read it as outputs.<name>. |
selector | Yes | Selector on the response body, or on the headers when from: Headers. |
from | No | Body or Headers. Defaults to Body. |
default | No | Value used when output extraction fails and the request error behavior allows continuation. |
kind | No | Auto, Single, List, MapAuto, MapSingle, or MapList. Defaults to Auto, or to MapAuto when you add key. |
key | For map outputs | Map key. Use a template string, { fromValue }, { fromBody }, or { fromHeader }. |
| Kind | Behavior |
|---|---|
Auto | A single value stays single. A second value turns it into an array. |
Single | Expects exactly one value. Multiple values fail. |
List | Always stores an array. |
MapAuto | Map output. A single value per key stays single. Duplicate keys become arrays. |
MapSingle | Map output with exactly one value per key. Duplicate keys fail. |
MapList | Map output with an array for every key. |
The Outputs tab of a request shows an example for each kind. See Extractors.
XML response bodies
An XML response body is read in the same JSON shape that the Loader uses, so an output selector and a Loader sourcePath use the same path. Every child element is an array under its local name, even when it occurs once. Use [0] for an element that occurs once and [*] for every occurrence. ["@name"] reads an attribute, ["#text"] the exact text of an element with any CDATA, and ["#ns"] its namespace URI.
outputs:
- name: prefixes
selector: $.ListBucketResult[0].CommonPrefixes[*].Prefix[0]["#text"]
kind: List
- name: next-token
selector: $.ListBucketResult[0].NextContinuationToken[0]["#text"]
Selecting a value in the Preview response tree writes the selector in this form.
The request fails when the XML has a document type definition, uses an encoding other than UTF-8, or is nested deeper than a Loader path can reach. Selectors, outputs, and pagination can read an XML response of up to 100 MiB. The Loader loads XML only up to 8 MiB.
HTTP error handling
HTTP requests can define onError per status code pattern: an exact code such as 429 or a wildcard family such as 4xx.
| Value | Meaning |
|---|---|
Ignore | Continue without treating the response as fatal. |
Abort | Stop on that response. This is the default for uncaught errors. |
{ action: Retry } | Retry with the retry keys below. |
An Abort rule can also stop a successful HTTP response. The error then names the status and the onError Abort action.
Retry keys:
| Key | Default | Meaning |
|---|---|---|
maxAttempts | 3 | Maximum retry attempts. |
initialDelaySeconds | 1 | Delay before the first retry. |
backoffFactor | 1 | Multiplier for exponential backoff. |
maxDelaySeconds | 60 | Maximum delay between retries. |
onExhaustedRetries | Abort | Abort or Ignore after the retries fail. |
httpHeaderRules.waitDurationHeader | Retry-After | Header with the wait duration that the server provides. |
httpHeaderRules.waitDurationFormat | seconds, httpDate, or unixEpoch. |
If a request times out, independent requests can finish, but the Extract job fails. Preview keeps their stored outputs as incomplete evidence. In Production, downstream jobs do not receive the batch as a successful extraction.
Example
$schema: https://hypermeter.com/extractor.schema.json
inputs:
- name: base_url
type: String
- name: api_token
type: SecretRef
- name: billing_month
type: String
requests:
- name: invoices
displayName: Fetch Invoice Pages
type: HttpGet
semanticEffect: read_export
description: Fetch invoice pages for ${{ inputs.billing_month }}
url: ${{ inputs.base_url }}/v1/invoices?size=100
headers:
Authorization: Bearer ${{ inputs.api_token }}
X-Billing-Month: ${{ inputs.billing_month }}
metadata:
billing_month: ${{ inputs.billing_month }}
source: partner-api
pagination:
source:
body: $.nextLink
nextRequest:
url: ${{ next }}
outputs:
- name: invoiceids
selector: $.items[*].id
kind: List
onError:
429:
action: Retry
maxAttempts: 5
initialDelaySeconds: 2
backoffFactor: 2
httpHeaderRules:
waitDurationHeader: Retry-After
waitDurationFormat: seconds
- name: invoice-lines
displayName: Fetch Invoice Lines
type: HttpGet
semanticEffect: read_export
url: ${{ inputs.base_url }}/v1/invoices/${{ matrix.invoiceid }}/lines
headers:
Authorization: Bearer ${{ inputs.api_token }}
matrix:
invoiceid: ${{ outputs.invoiceids }}
metadata:
billing_month: ${{ inputs.billing_month }}
invoice_id: ${{ matrix.invoiceid }}
OAuth2 example:
authentications:
- name: partner-oauth
type: OAuth2
url: ${{ inputs.token_url }}
clientId: ${{ inputs.client_id }}
clientSecret: ${{ inputs.client_secret }}
scope: invoices.read
requests:
- name: usage
type: HttpGet
semanticEffect: read_export
url: ${{ inputs.base_url }}/usage
auth:
name: partner-oauth
Authoring checklist
- The instructions keep the source IDs, periods, currencies, quantities, and customer or account scope that reconciliation needs.
- Secret fields of an authentication use
SecretRefinputs. Hypermeter rejects a plaintext value in such a field when you save the authentication. - Pagination stops when no next token exists, and matrix dimensions are bounded.
metadataholds the values that the Loader and Transformer need, especially customer, account, invoice, region, and billing period.- Preview confirms status codes, retries, decompression, selectors, pagination, and empty responses.
- Each request has the correct
semanticEffect:business_mutatingwhen it changes business state,unknownwhen the effect is not known. - Every
${{ }}expression parses. Draft validation reportstemplate_expression_invalidwith the field and the position. - The instructions stay under 131,072 bytes once encoded. Draft validation reports
instruction_too_largeabove that. Reuse a repeated expression instead of copying it into many fields.