Payment model
Both paid endpoints are gated by the OKX Agent Payments Protocol. You are only charged for a successful 200.
How it works
Both /analyze and /discover are gated by the OKX Agent Payments Protocol (x402), using the exact scheme with EIP-3009 transferWithAuthorization. The call pays for itself; there is no account, key, or invoice.
| Step | What happens |
|---|---|
| 1. Unpaid request | You call the endpoint with no payment header. You get back 402 Payment Required with a PAYMENT-REQUIRED header (base64-encoded JSON) describing what to pay: token, amount, recipient, network, and the input schema for the paid replay. |
| 2. Paid replay | You sign the authorization and re-send the same request with a PAYMENT-SIGNATURE header carrying the signed payment. |
| 3. Settled response | The server verifies the signature, runs the work, and only if the result is 200 redeems the payment on-chain and attaches a PAYMENT-RESPONSE header: a base64-encoded receipt with the settlement transaction hash. |
You do not assemble these headers by hand
The 402 challenge
Start with an ordinary unpaid request.
curl -X POST https://aspscout.xyz/analyze \
-H "Content-Type: application/json" \
-d '{"agentId":"1891","maxPeers":3}'The response is 402 Payment Required. Its body, which is also what the PAYMENT-REQUIRED header carries once decoded, spells out the terms in full.
{
"x402Version": 1,
"resource": "https://aspscout.xyz/analyze",
"accepts": [
{
"scheme": "exact",
"network": "eip155:196",
"asset": "0x779Ded0c9e1022225f8E0630b35a9b54bE713736",
"payTo": "0x4E1fd7974f3b8c609EaCB0bA8228CEaA517819B4",
"amount": "50000",
"maxAmountRequired": "50000",
"decimals": 6,
"resource": "https://aspscout.xyz/analyze",
"description": "ASP-Scout: on-chain-verified agent trust score + ranked category peers",
"mimeType": "application/json",
"maxTimeoutSeconds": 120,
"extra": { "name": "USD₮0", "version": "1" },
"outputSchema": {
"input": {
"type": "http",
"method": "POST",
"bodyType": "json",
"body": {
"type": "object",
"required": ["agentId"],
"properties": {
"agentId": { "type": "string", "description": "OKX agentId to analyze (e.g. \"1891\")" },
"maxPeers": { "type": "integer", "description": "max category peers to rank (1-5)", "default": 5, "minimum": 1, "maximum": 5 }
}
}
}
}
}
]
}amount is in atomic units: 50000 at 6 decimals is 0.05 USDT0. The /discover challenge is identical except for the resource, the description, and an outputSchema that describes query instead of agentId.
The gate runs before validation
Gate values
These are the live values, also served unauthenticated from GET /x402/status. No private key is ever exposed there.
What you pay for
You are charged for a successful 200 and nothing else. A 400, 404, 429, or 503 costs nothing: the signed authorization simply expires unused, because settlement only happens after the work succeeds.
| Status | Charged | Meaning |
|---|---|---|
| 200 | Yes | Success. 0.05 USDT0 redeemed; PAYMENT-RESPONSE carries the settlement tx hash. |
| 400 | No | Bad request: a required parameter is missing. |
| 402 | No | Payment required, or the payment failed verification. |
| 404 | No | Agent not listed, or no on-topic match. |
| 429 | No | A payment from the same payer is still settling. Retry after it clears. |
| 503 | No | Gate not configured, listing unverifiable, or index not ready. Retryable. |