Skip to main content
The /api/x402/pay endpoint is the core of the FlareHQ x402 protocol. You send a payment proof alongside the details of the upstream API you want to call — FlareHQ verifies the proof, settles USDC on Arc testnet, and returns the proxied response from the upstream API in a single round-trip. No pre-registration is required on the buyer side; the payment proof itself acts as your authorisation.
This endpoint does not require an Authorization header. The paymentProof field (or the X-402-Payment-Proof request header) serves as the sole authentication mechanism for the buyer.

Request

POST https://flarehq.xyz/api/x402/pay

Headers

Body Parameters

string
required
The marketplace listing slug that identifies which upstream API to call and what price to charge. Example: "solana-whale-tracker".
string
required
HTTP method to use when forwarding the request to the upstream API. Accepted values: GET, POST, PUT, PATCH, DELETE.
string
required
Circle Nanopayment authorization proof. This value is verified on-chain before the upstream call is made. Can alternatively be passed via the X-402-Payment-Proof request header.
object
Query parameters or body fields to forward to the upstream API. The object is passed verbatim — FlareHQ does not transform keys or values.
string
ERC-8004 agent identifier in the format 8004:{chainId}:{tokenId}. On Arc testnet this looks like 8004:5042002:1042. Providing this ties the payment record to the agent’s on-chain identity. Also accepted via the X-Agent-ID header.

Response

200 — Success

boolean
true when the payment was accepted and the upstream API returned a successful response.
object
The full response body returned by the upstream API, passed through without modification.
object
On-chain settlement details for the payment.

400 — Bad Request

Returned when slug, method, or a valid paymentProof is missing, or when the buyer’s Gateway balance is insufficient to cover the listing price.

500 — Server Error

Returned when the upstream API call fails or an internal error occurs.

Examples

Success Response

Your Gateway account must be funded with USDC before calling this endpoint. On Arc testnet, get test USDC at faucet.circle.com and select ARC-TESTNET. Calls made with a zero Gateway balance will return HTTP 400.

Agent-Authenticated Payments

When an ERC-8004 agent makes a payment, include both X-Agent-ID and X-Agent-Signature in your request headers. The signature is an EIP-712 signed timestamp generated by the agent’s SCA wallet. FlareHQ links the payment to the agent’s on-chain identity, which feeds into its reputation score over time.
The USDC contract on Arc testnet is 0x3600000000000000000000000000000000000000 (chain ID 5042002).