Skip to main content
GET /v1/data/<template>?<params> is a round. The gateway derives the template’s source (or reuses one it derived in the last 10 minutes for the same parameters), then hands the request to its execute route exactly as if you had posted that source yourself: The execute route’s answer is passed on unchanged, with one added header, Molpha-Source-Id, naming the derived source. The gateway uses its current registry version.

Choose the quorum

signaturesRequired is the one query parameter that is not a template parameter. It defaults to 3.
  • It must be a whole number from 1 to 255 (400 PARAM_INVALID otherwise). The round is then refused with 400 for a quorum below the protocol minimum of 3 or above the registry’s node count, and on a subscription with 403 above your plan’s maximum.
  • A tolerance-mode source needs at least 3.
  • It is not part of the sourceId, but it is part of the round, the x402 price and the signed message. On Solana a feed account is keyed by sourceId, signaturesRequired and the submitter, so pick one quorum per feed.

Pay with x402

Without a session the first answer is the x402 quote:
  1. The 402 carries the x402 v2 requirements in the PAYMENT-REQUIRED header (base64) and in the body: Solana devnet USDC, the amount, payTo (the protocol treasury), extra.feePayer and extra.memo. The memo commits to the source, the quorum and the registry version.
  2. Sign a payment that matches the quote exactly, as x402 pay-per-request describes.
  3. Send the same GET again with PAYMENT-SIGNATURE: <base64 payment payload>. The gateway verifies the payment before it dispatches the round, and answers 200 with the attestation and a PAYMENT-RESPONSE settlement receipt.
The price is 0.05 + 0.01 × (signaturesRequired + redundancy buffer) USDC on this deployment: 0.10 USDC at the default quorum of 3. Always pay what the 402 quotes.

Pay with a subscription session

Sign in once with the wallet of the subscription owner or of one of its delegates (POST /v1/session/challenge, then POST /v1/session), and send the token as a bearer token:
Each value uses one round of your plan’s quota. An unknown, expired or revoked token is 401 at no cost. See Subscriptions.

Sign with RequestAuth

Template routes do not take RequestAuth, because a RequestAuth signature covers the sourceId, which you only learn from /source. Take the source from /source and request the round like any other source. With the SDK:
Without the SDK, post the source with RequestAuth (authSig, authTimestamp, consumerAuthority, subscriptionOwner, signaturesRequired, registryVersion) to POST /v1/round/execute.
The @molpha/sdk/data entry (MolphaDataClient) in @molpha/sdk 0.3.0 was written for a standalone Molpha Data service at data.molpha.io, which is not deployed. Use the gateway routes on this page.

The response

A 200 is the execute routes’ AttestationResponse:
For a snapshot, check keccak256(valuePreimage) == payload.value, then decode the preimage with the layout from /source.

Verify it

A template’s attestation is an ordinary Molpha attestation: verify it on Solana, an EVM chain or Starknet as Verify and publish describes. The SDK’s verifier helpers take its Attestation type, whose signature fields are named differently from the wire. Map them like this:
A valid signature does not replace your own policy. Check that payload.sourceId is the source you derived and re-hashed, that signaturesRequired is the quorum you require, and that timestamp / 1000 is fresh enough for you. A gateway response proves neither settlement nor on-chain verification.

Errors

The value route answers with the execute routes’ {status, error} body once the round starts, and with the Molpha Data error body for a failure before it. There is no idempotency key: every retry that reaches the nodes is a new round that spends another quota unit or needs another payment.