Pay

Prepare an x402 payment from a 402 challenge

Send the exact bytes the paywall served. The vault parses them, pins the amount that will actually be signed (not the maxAmountRequired ceiling), computes the digest a person will authorize, and stores the preimage so the authorize page renders from what the vault saw rather than what the caller claims. authorization in the response says what the payment needs next: allow, require_passkey, require_grant, or deny: <reason>.

post/v1/agents/{agent_id}/pay/prepare

Request

  • Base URL: https://api.1claw.co
  • URL: https://api.1claw.co/v1/agents/{agent_id}/pay/prepare
  • Auth: HTTP bearer

Path parameters

agent_idstring uuid required

Request body

challenge_b64string required

The exact bytes the paywall served, base64. Sent verbatim rather than parsed by the caller: the digest a person authorizes is computed from this preimage, so anything reinterpreted first would fall outside the binding.

methodstring required
resource_urlstring uri required
idempotency_keystring

Reused by a caller retrying after a crash so one 402 cannot become two payments. Generated server-side when absent.

mode'strict' | 'session' | 'auto'

A request, not an instruction — the vault decides.

Example request

{
  "method": "GET"
}

Response

Session created; digest and quote returned

session_idstring uuid
payment_digeststring
sign_idempotency_keystring
quoteobject
valid_beforestring date-time nullable
expires_atstring date-time
authorizationstring

allow | require_passkey | require_grant | deny: <reason>

short_windowboolean

The paywall's window is under 30 seconds and may expire while a person is reading the authorize page.

Changes

No recorded changes to this operation across all 1 revision of this API.