API reference

April 18, 2026 · View on GitHub

x402 verification, settlement dispatch, workflow status, and fee quotes. These endpoints are consumed by the @x402/express middleware (or any x402-compatible server); they are not usually called by hand.

POST /verify

Synchronously validate an x402 payment payload before returning the resource to the buyer. This endpoint never moves funds — it only answers "is this payment authorization valid?". Target latency: p95 < 50 ms.

Rate limit: 1000 requests per minute per IP.

Request body

Standard x402 v2 verification payload:

FieldTypeRequiredDescription
x402Versionnumberyes2.
paymentPayloadobjectyesx402 payment object.
paymentPayload.payload.signaturestringyesBuyer's signature (≥ 10 chars).
paymentPayload.payloadobjectyesScheme-specific data (EIP-3009 authorization, Soroban tx, SPL instruction).
paymentRequirementsobjectyesThe server's declared requirements.
paymentRequirements.schemestringyes"exact".
paymentRequirements.networkstringyesCAIP-2.
paymentRequirements.payTostringyesFacilitator address on network. Must match the relay's own address for that network.
paymentRequirements.amountstringyesAmount in base units. Must be > 0.
paymentRequirements.extra.merchantIdstringyesIdentifies the target seller.

Response 200 OK

FieldTypeDescription
isValidbooleantrue if the payment is acceptable.
invalidReasonstringMachine-readable reason when isValid: false.
invalidMessagestringHuman-readable detail.
payerstringBuyer address, if recoverable.

Validation rules

  • extra.merchantId must exist.
  • The seller identified by merchantId must exist.
  • network must be enabled.
  • payTo must equal the relay's facilitator address on network.
  • payload.signature must be present.
  • amount must be > 0.

Errors

StatuserrorCause
400validationMalformed body.
429RATE_LIMIT

Note: a valid JSON payload with a semantically invalid payment returns 200 OK with isValid: false, not a 4xx. Only request malformed-ness produces a 4xx.

POST /settle

Dispatch a Temporal workflow to pull USDC from the buyer and deliver it to the seller. Returns immediately with a workflowId; settlement happens asynchronously.

Rate limit: 500 requests per minute per IP.

Request body

Identical shape to POST /verify.

Response 200 OK

FieldTypeDescription
successbooleantrue if dispatch succeeded.
transactionstringThe Temporal workflowId — use it with /bridge/status/:workflowId.
networkstringBuyer network (CAIP-2).
payerstringBuyer address.
errorReasonstringPresent when success: false.
errorMessagestring

Workflow selection

  • Buyer network === seller network → sameChainSettle.
  • Different networks → crossChainSettle.

Errors

StatuserrorCause
400INVALID_PAYMENTMissing merchantId, zero amount, etc.
404SELLER_NOT_FOUNDmerchantId unknown.
409REPLAY_DETECTEDSame signature already settled (EIP-3009 nonce or equivalent).
429RATE_LIMIT
503CIRCUIT_BREAKERPer-tx limit, daily volume limit, or global pause is active.

GET /bridge/status/:workflowId

Query the current state of a settlement workflow.

No rate limit.

Path params

ParamDescription
workflowIdThe value returned as transaction by POST /settle.

Response 200 OK

Shape depends on the workflow type.

sameChainSettle:

FieldTypeDescription
status / stepstringpulling, transferring, recording, settled, or failed.
pullTxHashstring?Populated once the pull tx lands.
transferTxHashstring?Populated once the transfer to seller lands.
errorstring?Populated if failed.

crossChainSettle:

FieldTypeDescription
status / stepstringpulling, burning, attesting, minting, recording, settled, or failed.
pullTxHashstring?
burnTxHashstring?
attestationstring?Circle attestation hex, once received.
mintTxHashstring?
errorstring?

Errors

StatusCause
404workflowId unknown.

GET /bridge/fees

Quote the fee breakdown for a given route and amount. This is the authoritative source for gas allowances — the static schedule in fees is for reference only.

No rate limit.

Query parameters

ParamRequiredDescription
fromyesBuyer network (CAIP-2).
toyesSeller network (CAIP-2).
amountyesGross amount in base units.

Response 200 OK

FieldTypeDescription
platformFeestringBase-unit amount deducted as platform fee. Currently "0".
gasAllowancestringBase-unit amount deducted to reimburse facilitator gas.
totalDeductionstringplatformFee + gasAllowance.
sellerReceivesstringamount - totalDeduction.
currencystring"USDC".
decimalsnumber6 for EVM and Solana, 7 for Stellar.
notestringPlain-text explanation of the allowance.

Errors

StatuserrorCause
400validationMissing from / to / amount.
404ROUTE_NOT_CONFIGUREDNo gas schedule for this pair.

Example

curl "https://api.402md.com/bridge/fees?from=eip155:8453&to=stellar:pubnet&amount=1000000"
{
  "platformFee": "0",
  "gasAllowance": "500",
  "totalDeduction": "500",
  "sellerReceives": "999500",
  "currency": "USDC",
  "decimals": 6,
  "note": "Gas allowance covers pull + burn + mint on this route."
}