Skip to main content
AI agents that operate autonomously — executing trades, monitoring markets, or orchestrating multi-step workflows — need to call paid APIs without a human authorizing each transaction. The x402 protocol combined with ERC-8004 on-chain agent identity makes this possible: an agent signs its own payment proof, attaches it to the API request, and receives the response in a single round trip, with no human-in-the-loop billing step.

ERC-8004 On-Chain Agent Identity

ERC-8004 is a token standard on Arc testnet that gives each deployed agent a unique, verifiable on-chain identity. When your agent includes its ERC-8004 identity headers in an x402 request, API providers can:
  • Grant reputation-based discounts to agents with a strong payment history
  • Enforce per-agent rate limits independent of IP address or API key
  • Whitelist high-trust agents for access to restricted tiers
  • Build trust graphs across multi-agent workflows
An agent’s identity is expressed as a compact string: 8004:<chainId>:<tokenId>. For Arc testnet, that looks like 8004:5042002:1042.
Agents without an ERC-8004 identity can still call x402 endpoints — they are treated as anonymous callers. However, providers may apply stricter rate limits or decline to offer discounts to unidentified agents. Registering an on-chain identity is strongly recommended for production agents.

Required Request Headers

Every authenticated agent request must include three headers. These are sent alongside the standard HTTP request to any x402-protected endpoint:
string
required
The agent’s ERC-8004 identity string in 8004:<chainId>:<tokenId> format. Identifies which on-chain agent is making the request.
string
required
An EIP-712 signed timestamp that proves the request was authorized by the wallet controlling the agent’s ERC-8004 token. Prevents replay attacks.
string
required
A Circle Nanopayment authorization proof signed by the agent’s Circle Smart Contract Account (SCA) wallet. This is what triggers USDC settlement on Arc testnet.

Getting an Agent Identity and Wallet

Before an agent can sign payment proofs, it needs a tokenId and a Circle SCA wallet. Deploy an agent through the FlareHQ API to provision both:
The response includes your agent’s tokenId and the Circle SCA wallet address your agent will use to sign payment proofs. Store the wallet’s private key securely — it is used to generate both the X-Agent-Signature and the X-402-Payment-Proof on every request.
The agent’s wallet private key is the sole credential for signing payments. There is no password recovery. Store it in a secrets manager (e.g., AWS Secrets Manager, HashiCorp Vault) and never commit it to source control.
For a complete walkthrough of deploying and configuring agents, see Deploying Agents.

Calling a Marketplace Listing as an Agent

The FlareHQ SDK handles header construction, EIP-712 signing, and Circle Nanopayment proof generation automatically when you pass an agentId:
The SDK will:
  1. Resolve the listing price and payTo address from the Marketplace
  2. Sign a Circle Nanopayment authorization using the agent wallet
  3. Sign the EIP-712 timestamp payload for X-Agent-Signature
  4. Attach all three required headers and submit the request to POST /api/x402/pay
  5. Return the upstream API response in result.data

Batch Execution

When an agent needs to call multiple listings in a single workflow, you can execute them concurrently using Promise.all. Each call is independently settled — there is no batched payment transaction:
Concurrent executeRequest calls share the same agent wallet but generate independent payment proofs per call. Each proof is single-use and tied to a specific listing, so there is no risk of double-spend across parallel requests.

Direct REST Call (Without the SDK)

If you are building an agent runtime outside of Node.js, you can construct the payment headers manually and submit directly to the REST endpoint:
You are responsible for generating valid X-Agent-Signature (EIP-712 signed current timestamp) and paymentProof (Circle Nanopayment authorization) values. The FlareHQ SDK handles this automatically — use it unless your runtime has a specific constraint.

Summary

All three headers are required for fully authenticated, reputation-tracked agent requests. The FlareHQ SDK assembles and signs all three automatically when agentId and agentPrivateKey are configured.