Skip to content

Authorize a single x402 payment

Authorize a single x402 payment for a specific resource using the agent's JWT. On success the response contains an X-Payment authorization to attach to the retried resource call.

POST
/api/payment/x402V1Payment

Authorizations

agentJwt

Agent registration JWT. Send as Authorization: Bearer <agent-jwt>.

Type
HTTP (bearer)

Request Body

application/json

Body for authorizing a single x402 payment. Fields mirror the bill being paid.

x402 payment scheme.

Blockchain network the payment settles on.

Payment amount in the asset's base (atomic) units.

Currency symbol of the payment asset.

On-chain contract address of the payment asset.

Recipient wallet address the payment is directed to.

Host of the resource being paid for.

Full URL of the resource being paid for.

Human-readable description of the payment.

Name of the payment token (used for EIP-712 domain).

Version of the payment token (used for EIP-712 domain).

How long the resulting payment signature remains valid, in seconds. If a resource returns an expiration error, request a fresh authorization.

If a previous call returned an approvalId, include it on the next call so the server can skip user approval again.

Optional intent metadata: human-readable description of the spending intent. Informational in V1.

Optional intent metadata: category label. Informational in V1.

Optional intent metadata: total budget in atomic units. Informational in V1.

Optional intent metadata: per-transaction cap in atomic units. Informational in V1.

Optional intent metadata: ISO timestamp for the start of the intent window. Informational in V1.

Format"date-time"

Optional intent metadata: ISO timestamp for the end of the intent window. Informational in V1.

Format"date-time"

Responses

Payment authorized. Response contains xPaymentB64 to attach as the X-Payment header when retrying the original call.

application/json

Successful payment authorization. Attach xPaymentB64 as the X-Payment header when retrying the original resource call.

Result status of the authorization.

Base64-encoded X-Payment authorization to attach as the X-Payment header on the retried request.

Decoded X-Payment authorization payload.

Identifier of the recorded payment.

Unix timestamp (seconds) at which the payment authorization expires.

LLM guidance / remediation context for agents.

{
  "status": "<string>",
  "xPaymentB64": "<string>",
  "xPayment": {
    "x402Version": "<integer>",
    "scheme": "<string>",
    "network": "<string>",
    "payload": {
      "signature": "<string>",
      "authorization": {
        "from": "<string>",
        "to": "<string>",
        "value": "<string>",
        "validAfter": "<integer>",
        "validBefore": "<integer>",
        "nonce": "<string>"
      }
    }
  },
  "paymentRecordId": "<string>",
  "expiresAt": "<integer>",
  "payment_model_context": {}
}

Released under the MIT License.