Request Validation
Before any payment is requested, every batch endpoint validates the request body in this order. A request failing any step below is rejected with400 and no payment is charged.
Schema validation
The request body must match the endpoint’s schema (correct field names, types, required fields). Validation errors are returned as:error string is built as "<field path>: <message>", joined with ; if multiple fields fail. Common cases:
Batch size limit
Duplicate token rejection
If the same token identifier (case-insensitive) appears more than once intokens, the entire request is rejected — you are not charged for the duplicate:
Token resolution
After passing the checks above, every identifier in the batch is resolved against on-chain/market data. Resolution fails closed on the whole batch — if even one identifier can’t be resolved, the entire request is rejected with404 and, again, no payment is charged:
Error Handling Overview
Errors fall into four categories:- Request validation errors —
400(Request Validation) - Duplicate-token errors —
400(Duplicate token rejection) - Token resolution errors —
404(Token resolution) - x402 payment errors —
402, generated by the payment middleware, not the application wrapper (HTTP 402 — Payment Required)
502 on /v1/token-prices, 404 on /v1/top-performers and /v1/aggregate-metrics if their underlying logic fails).
HTTP 400 — Validation Error
error string is derived from schema validation and will reference the offending field path (e.g. tokens, tokens.0.identifier).
HTTP 400 — Batch Limit Error
Requests with more than 5 tokens are rejected before any payment is requested:HTTP 400 — Duplicate Token Error
Requests containing the same token identifier more than once (case-insensitive) are rejected before any payment is requested:HTTP 404 — Token Resolution Error
If any identifier in the batch can’t be resolved, the entire batch is rejected — no payment is requested:/v1/top-performers and /v1/aggregate-metrics also return 404 (with the same wrapper) if their underlying logic returns an unsuccessful result — in that case payment has already been made, since these are non-batch endpoints without a pre-payment resolution step.
HTTP 502 — Backend Error
/v1/token-prices returns 502 if its underlying price logic fails, using the standard response wrapper.
Status Code Summary
Nullable Fields
Consumers must not assume these fields are always numeric.
x402 docs: Overview · Quickstart · Payment Flow · API Reference · Errors & Troubleshooting · Examples