Overview
x402 is an open payment protocol. A client pays for each HTTP request with USDC on Base. No API key or account is required. Requests that include anX-API-KEY header are billed to that account as usual. x402 applies only to requests without a key.
How it works
- The client calls an endpoint with no
X-API-KEYheader. - The API returns
402 Payment Required. ThePAYMENT-REQUIREDheader contains the payment terms: the amount, the USDC contract on Base, and the receiving address. - The client signs a USDC transfer authorization for that amount and retries the request with a
PAYMENT-SIGNATUREheader. - The API verifies the signature with the payment facilitator, returns the data, and settles the payment on-chain. The response includes a
PAYMENT-RESPONSEheader with the transaction hash.
Supported endpoints
Every documented data endpoint accepts x402, except Search, which is in alpha. Parameters and response formats are the same as with an API key. The amount differs by endpoint; read it from thePAYMENT-REQUIRED header.
Prices and metrics
Financial statements
For
POST /financials/search/line-items, send the tickers and the line items as a JSON body.Stock screener
Send the filters as a JSON body.
GET /financials/search/screener/filters lists every valid filter field and needs no payment.Company, filings, earnings, and news
GET /filings/items returns 503 with a Retry-After header when we have not read the filing yet. That request is not charged. Send it again after the wait.Ownership and holdings
Macro
IPOs and KPIs
/prices/tickers and /macro/inflation/series, need no payment and no key.
In ticker, every stock endpoint also accepts a Coinbase stock name (AAPL-USD), a Base token symbol (NVDAc), or a Base token address (base:0x...). GET /tokenized-stocks lists the tokens, free and with no key. Those endpoints return data for the stock. GET /tokenized-stocks/prices/snapshot returns the token’s own price on Base.
Requirements
- A wallet on Base whose private key the client holds. The client signs each payment locally.
- USDC on Base in that wallet.
- No ETH is needed. The facilitator pays the gas.
Example
POST with a JSON body. The same session pays for it:
Python
Payment terms
ThePAYMENT-REQUIRED header is base64-encoded JSON:
Read the amount from the header on each request.
Receipts
Every paid200 response includes a PAYMENT-RESPONSE header. It is base64-encoded JSON with success, network, payer, and transaction (the on-chain transaction hash).
Feedback
Every response to a valid payment also carries a one-time feedback code: in theX-Feedback-Code header and in the feedback_code field of the JSON body. An error response carries one too. Send the code with a note to POST /feedback to tell us what is missing, wrong, or unclear. The call is free and needs no API key. A code works once, for 24 hours. See Feedback.
Limits
- Rate limit. 10,000 requests per minute per wallet.
- Pagination.
next_page_urlworks the same as with an API key. Each page is a separate paid request. - Settlement. Payment is settled only after a successful response. Error responses are not charged.
- License. Data accessed with x402 is for Non-Professional use. Professional use requires a plan at financialdatasets.ai.
Errors
Payment errors return402 with a JSON body. The error field identifies the cause.
A
503 with a Retry-After header means the facilitator is temporarily unavailable. Retry after the given interval.
Related
Agent Onboarding
Create an API key programmatically for endpoints not covered by x402.
Endpoint map
Every endpoint with parameters, in llms.txt form.
Announcement
Introducing x402 payments, on the Financial Datasets news page.