Skip to main content

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​

KeyRequiredMeaning
$schemaNoSchema identifier for validation: https://hypermeter.com/extractor.schema.json.
inputsNoInput definitions, used as inputs.<name> in template expressions.
coverageNoRequested business period for Production source data.
authenticationsNoNamed authentication definitions that requests reference with auth.
requestsYesOrdered request definitions, at least one.

Inputs​

KeyRequiredMeaning
nameYesInput key. Must start with a lowercase letter and can contain lowercase letters, numbers, _, and -.
typeNoString, Boolean, Numeric, DateTime, or SecretRef. Defaults to String.
defaultNoValue 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.start and coverage.requested.end must reference public DateTime inputs. You choose the input names.
  • coverage.timezone must be an IANA timezone, such as UTC or Europe/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.

TypeRequired keysOptional keys
Basicname, type, username, passwordNone
OAuth2name, type, url, clientId, clientSecretgrantType, scope, tokenEndpointAuthMethod
Jwtname, type, url, issuer, audience, duration, privateKeyscope
DbConnectionname, type, host, database, username, passwordport
Azurename, type, account plus one of accessKey, sasToken, bearerTokenNone
AWSname, type, accessKey, secretKeysessionToken
GCPname, type, accessKey, secretKeysessionToken
AWS_STSname, type, roleArnaccessKey, 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.

ValueToken request
Omitted or client_secret_postclient_id and client_secret are form fields in the body.
client_secret_basicThe 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.

KeyRequiredMeaning
nameYesStable identifier, used in expressions and diagnostics. Must start with a lowercase letter and can contain lowercase letters, numbers, and -.
displayNameNoReadable name. Can contain spaces and capital letters. Changing it does not change the identifier.
typeYesRequest type, such as HttpGet, PostgreSql, S3Bucket, or AzureBlob.
descriptionNoOne-line description. Can use template expressions.
semanticEffectNoBusiness 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.
ifNoConditional expression. A falsy result skips the request.
loadNoWhether to load the fetched document. Defaults to true. Use false for discovery requests that only produce outputs.
metadataNoObject with string values, attached to loaded documents.
authNoAuthentication reference: a name, or { name, options }. AWS options commonly include region and service details.
matrixNoDimensions that repeat the request.
paginationNoResponse source and continuation request.
decompressionNoGz or Zip, applied before output parsing and loading.
outputsNoValues 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.fromValue expressions 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, and access-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 familytype valuesRequired keysOptional keys
HTTPHttpGet, HttpPut, HttpPost, HttpPatch, HttpDelete, HttpOptionstype, urlheaders, body, onError
SQL queryPostgreSql, MySql, MariaDb, SqlServer, OracleDbtype, queryNone
SQL tablePostgreSql, MySql, MariaDb, SqlServer, OracleDbtype, tableNone
Amazon S3S3Buckettype, bucketName, region, pathendpoint
Google Cloud StorageGcsObjecttype, bucketName, region, pathNone
Azure BlobAzureBlobtype, blobName, containerNameNone

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, and PARQUET.
  • 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.

KeyMeaning
source.bodyResponse-body selector for the continuation state.
source.header.nameHTTP response header that holds the continuation state. Matching is case-insensitive.
source.header.relationRelation to select from the HTTP Link header. Use name: Link with it.
continueWhenOptional separate Boolean rule. Must resolve to true or false.
nextRequestOnly 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 familyAllowed continuation fieldsHow they apply
HTTPurl, query, headers, body, and auth.optionsquery 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 queryqueryReplaces the complete SQL query.
Database tabletableReads the complete next table.
S3bucketName, region, path, and endpointReads the next object, without listing the bucket.
GCSbucketName, region, and pathSame as S3.
Azure BlobcontainerName and blobNameReads 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 continueWhen only for a separate Boolean rule.
  • Do not write continueWhen: ${{ next }} when next is 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 continueWhen is 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.

KeyRequiredMeaning
nameYesOutput name. Later requests read it as outputs.<name>.
selectorYesSelector on the response body, or on the headers when from: Headers.
fromNoBody or Headers. Defaults to Body.
defaultNoValue used when output extraction fails and the request error behavior allows continuation.
kindNoAuto, Single, List, MapAuto, MapSingle, or MapList. Defaults to Auto, or to MapAuto when you add key.
keyFor map outputsMap key. Use a template string, { fromValue }, { fromBody }, or { fromHeader }.
KindBehavior
AutoA single value stays single. A second value turns it into an array.
SingleExpects exactly one value. Multiple values fail.
ListAlways stores an array.
MapAutoMap output. A single value per key stays single. Duplicate keys become arrays.
MapSingleMap output with exactly one value per key. Duplicate keys fail.
MapListMap 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.

ValueMeaning
IgnoreContinue without treating the response as fatal.
AbortStop 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:

KeyDefaultMeaning
maxAttempts3Maximum retry attempts.
initialDelaySeconds1Delay before the first retry.
backoffFactor1Multiplier for exponential backoff.
maxDelaySeconds60Maximum delay between retries.
onExhaustedRetriesAbortAbort or Ignore after the retries fail.
httpHeaderRules.waitDurationHeaderRetry-AfterHeader with the wait duration that the server provides.
httpHeaderRules.waitDurationFormatseconds, 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​

  1. The instructions keep the source IDs, periods, currencies, quantities, and customer or account scope that reconciliation needs.
  2. Secret fields of an authentication use SecretRef inputs. Hypermeter rejects a plaintext value in such a field when you save the authentication.
  3. Pagination stops when no next token exists, and matrix dimensions are bounded.
  4. metadata holds the values that the Loader and Transformer need, especially customer, account, invoice, region, and billing period.
  5. Preview confirms status codes, retries, decompression, selectors, pagination, and empty responses.
  6. Each request has the correct semanticEffect: business_mutating when it changes business state, unknown when the effect is not known.
  7. Every ${{ }} expression parses. Draft validation reports template_expression_invalid with the field and the position.
  8. The instructions stay under 131,072 bytes once encoded. Draft validation reports instruction_too_large above that. Reuse a repeated expression instead of copying it into many fields.