Skip to main content

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 an X-API-KEY header are billed to that account as usual. x402 applies only to requests without a key.

How it works

  1. The client calls an endpoint with no X-API-KEY header.
  2. The API returns 402 Payment Required. The PAYMENT-REQUIRED header contains the payment terms: the amount, the USDC contract on Base, and the receiving address.
  3. The client signs a USDC transfer authorization for that amount and retries the request with a PAYMENT-SIGNATURE header.
  4. The API verifies the signature with the payment facilitator, returns the data, and settles the payment on-chain. The response includes a PAYMENT-RESPONSE header with the transaction hash.
The x402 client libraries handle steps 2 to 4.

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 the PAYMENT-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

Not covered: Search, which is in alpha and requires an API key. The free helper lists, such as /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

The stock screener is a POST with a JSON body. The same session pays for it:
Python

Payment terms

The PAYMENT-REQUIRED header is base64-encoded JSON:
Read the amount from the header on each request.

Receipts

Every paid 200 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 the X-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_url works 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 return 402 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.

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.