# How to use x402stock with your AI agent

Get more done with your agent · How-to · Published 2026-10-12. Canonical page: https://zeroclick.ai/resources/how-to-use-x402stock-with-your-ai-agent

x402stock gives your AI agent market and economic data, starting at $0.01 per request. That includes US stock prices, Treasury yields and other macro series, SEC filings, and more. x402stock sells through ZeroClick. Your agent sends a normal request to the [x402stock storefront](https://agents.x402stock.xyz) with a free agent credential, pays that one request in USDC over x402 or MPP, and reads back JSON.

## Key takeaways

- Send requests to `https://agents.x402stock.xyz` with x402stock's own paths, such as `/api/v1/quote/{ticker}`, and pay the priced 402 that comes back.
- Most single lookups cost one or two cents. A stock quote and the Treasury yield curve each cost $0.01.
- Stock quotes are currently delayed, not real time, so read `is_delayed`, `delayed_by` and `as_of` before your agent uses a price.
- For steady volume, buy prepaid Credits from $0.50. An agent without a wallet can create one at no cost or hand a card checkout to a person.

## What x402stock is

x402stock is a market and economic data API built for autonomous agents. An agent needs no x402stock account or API key, only a free agent credential and a wallet. It calls an endpoint, pays a few cents, and gets JSON back. The catalog spans US stocks, ETFs and options, currencies, crypto including on-chain perpetual futures, energy commodities, US and global macro, SEC EDGAR filings, congressional trades and market sentiment. You can see the full range at [x402stock.xyz](https://x402stock.xyz/).

x402stock started out as an API meant to be called by autonomous agents, and the payment protocol is in its name. Market data suits that model well. A research agent checking a filing or a monitor watching rates needs a small, priced answer right away, and it has no time to negotiate a data contract. We tell the story of the partnership in [x402stock × ZeroClick: market data built for the agentic web](https://zeroclick.ai/blog/x402stock-market-data-built-for-the-agentic-web).

An agent storefront is the machine-readable version of a business. It is a URL where an agent reads the catalog, the live prices and the payment steps, then buys without anyone filling in a form. It sits in front of x402stock's API as a transparent proxy that handles payment, identity and forwarding. For how storefronts work, see [What is an agent storefront?](https://zeroclick.ai/resources/what-is-an-agent-storefront)

## What agents use x402stock for

The storefront groups well over a hundred operations into more than a dozen services. Here are common jobs, each matched to the call that answers it:

| Job your agent is given | Service | Call | Price |
|---|---|---|---|
| Get the latest price of a US stock | Stock Quotes & Market Data | `GET /api/v1/quote/{ticker}` | $0.01 |
| Pull price history for a chart or analysis | Stock Quotes & Market Data | `GET /api/v1/aggregates/{ticker}` | $0.02 |
| Compare two or three stocks on price, P/E, margins and yield | Company Fundamentals & Reference | `GET /api/v1/compare?tickers=AAPL,MSFT` | $0.05 |
| Get the latest US Treasury yield curve | US Macro & Rates | `GET /api/v1/treasury-yields` | $0.01 |
| See the average rate the Treasury pays on its debt | US Macro & Rates | `GET /api/v1/avg-interest-rates` | $0.01 |
| List upcoming CPI, jobs and GDP release dates and the next FOMC meeting | US Macro & Rates | `GET /api/v1/calendar` | $0.02 |
| Pull a company's reported financial facts from SEC XBRL | SEC Filings & Ownership | `GET /api/v1/company-facts/{ticker}` | $0.02 |
| Track one reported figure, such as revenue, across filings | SEC Filings & Ownership | `GET /api/v1/concept/{ticker}?tag=Revenues` | $0.02 |
| Find 13D and 13G stakes filed on a company | SEC Filings & Ownership | `GET /api/v1/beneficial-ownership/{ticker}` | $0.02 |
| List the clinical trials a company sponsors | FDA, Trials & Patents | `GET /api/v1/clinical-trials?sponsor=...` | $0.02 |

The aggregates call takes `multiplier`, `timespan` (minute through year), `from` and `to`. For one stock, the quote call is cheaper than compare. To find the path for any job, search the [API reference](https://agents.x402stock.xyz/openapi.json) with `https://agents.x402stock.xyz/openapi.json?q={text}`.

## Prices

Every service is pay as you go and billed per request. The Credits plan charges the same per-call rates.

| Service | From | Up to |
|---|---|---|
| Stock Quotes & Market Data | $0.01 | $0.05 |
| US Macro & Rates | $0.01 | $0.05 |
| SEC Filings & Ownership | $0.01 | $0.05 |
| Company Fundamentals & Reference | $0.01 | $0.05 |
| Technical Analysis | $0.01 | $0.03 |
| Global Macro, FX & Commodities | $0.01 | $0.02 |
| Crypto & Perps | $0.01 | $0.03 |
| On-Chain & Tokenized Assets | $0.01 | $0.04 |
| Sentiment & Positioning | $0.01 | $0.04 |
| FDA, Trials & Patents | $0.01 | $0.03 |
| Government & Policy | $0.02 | $0.03 |
| Options & Short Interest | $0.02 | $0.04 |
| Market Archive | $0.02 | $0.03 |
| Screeners, Scores & AI Research | $0.03 | $0.75 |

A morning brief stays small. Quotes on a 20-stock watchlist cost $0.20. Add the yield curve ($0.01) and the release calendar ($0.02), and the brief costs $0.23. A $5 Credits balance covers 500 one-cent calls.

Prices come from the live [price list](https://agents.x402stock.xyz/manifest.json), and every 402 states the exact amount before your agent pays. Read the price at call time rather than caching it.

## How to buy and call x402stock from your agent

1. Point your agent at the storefront's [agent guide](https://agents.x402stock.xyz/llms.txt), which links the catalog, the API reference and the payment steps.
2. Match the task to a call from the table above. You can also ask the free task guide at `https://agents.x402stock.xyz/zeroclick/agent/guide?goal=URL_ENCODED_TASK`, which needs no wallet and never buys anything.
3. Send the request to the storefront with your agent's credential as `Authorization: Bearer <token>` and no payment header, and expect a priced 402 in reply. Register the credential free once through the [identity guide](https://agents.x402stock.xyz/auth.md); one registration works at every ZeroClick storefront, so reuse one your agent already holds.
4. Check the 402's `payment.amountUsd` against your budget.
5. Pay the challenge from your wallet over x402 (USDC on Base) or MPP (USDC on Tempo).
6. Retry the identical request with the payment proof attached and the same bearer. The payment is bound to the request it priced, so the retry must match it exactly.
7. Read the JSON, checking `as_of` for freshness and, on quotes, `is_delayed` and `delayed_by`.

## Example requests

Send the unpaid request first. This one asks for the latest price of one stock:

```http
GET https://agents.x402stock.xyz/api/v1/quote/AAPL
Authorization: Bearer <access token>
```

Expect a 402 in reply. Its body carries `payment.amountUsd`, the `plan` and a `protocols` block with a challenge for each rail. The signable challenges also arrive as headers, so a standard x402 or MPP client can settle them without reading the body:

```http
HTTP/1.1 402 Payment Required
payment-required: <x402 challenge>
www-authenticate: <MPP challenge>
```

Sign the challenge and resend the same request with the proof and the same bearer. On x402 the payload goes in `x-payment`. On MPP, send `Authorization: Payment <credential>` and move the bearer to `ZC-Agent-Authorization`:

```http
GET https://agents.x402stock.xyz/api/v1/quote/AAPL
Authorization: Bearer <access token>
x-payment: <signed x402 payload>
```

We called this endpoint on 12 October 2026 at 17:35 UTC, paid $0.01 through Zero, ZeroClick's own payment layer for agents, and got a 200 in 4,224 ms. The answer had this shape, shown here with field types only:

```json
{
  "ticker": "string",
  "data": {
    "price": "number", "change": "number", "change_percent": "number",
    "day": { "open": "number", "high": "number", "low": "number",
             "close": "number", "volume": "number", "vwap": "number" },
    "previous_close": "number", "timestamp": "string",
    "is_delayed": "boolean", "delayed_by": "string"
  },
  "source": "string",
  "as_of": "string",
  "feedback": { "endpoint": "string", "method": "string", "free": "boolean", "note": "string" }
}
```

A macro call needs no ticker. We called `GET https://agents.x402stock.xyz/api/v1/treasury-yields` a few seconds later, paid $0.01 the same way, and got a 200 in 4,556 ms. The answer carried `source`, `as_of`, `series`, `unit` and `count`. It also held a list of 14 maturity labels and a `rates` list with one dated entry, whose rates are keyed from `1mo` through `30yr`. Each paid response also carries a `zc-billing` header that reconciles `authorizedUsd` against `chargedUsd`.

## If your agent has no wallet

Your agent has four options. The [payment guide](https://agents.x402stock.xyz/payment.md) covers each one.

- **Create a wallet.** Your agent can set one up itself at no cost, then follow the steps above.
- **Pay a single call by card.** Card pays for a single pay-as-you-go call priced at $0.50 or more, such as the backtest or tearsheet report ($0.50) and the research memo ($0.75). One-cent lookups fall under that floor, so fund them with Credits bought by card instead. The [card instructions](https://agents.x402stock.xyz/payment/card.md) cover the steps, including the hosted checkout for browser agents.
- **Buy Credits.** With the same agent credential, send `POST /plans/{planId}/purchase` with `Authorization: Bearer <token>` and an amount of at least $0.50, such as `{ "amountUsd": "5.000000" }`. Add `checkout: true` to pay by card, or settle the purchase 402 from a wallet. The Credits plan's id and `purchase.url` are in the price list. Calls draw the balance down, and `POST /extend` tops it up.
- **Hand off to a person.** Share any x402stock page as `https://agents.x402stock.xyz/outclick?url={URL-encoded seller page}` so the referral is recorded.

## What to know

**Freshness.** Stock quotes are currently delayed, and each quote response carries `is_delayed` and `delayed_by` to say by how much. Every response carries `as_of`, so your agent can tell how recent its answer is.

**Scope and limits.** Ticker endpoints take a US-listed symbol in uppercase. Compare takes one to three tickers. The release calendar looks up to 90 days ahead. Backtests run on at most five years of daily history.

**What is charged, and when.** Each pay-as-you-go call is one 402 and one charge, and paying it completes the purchase under ZeroClick's buyer terms. A delivered response without a `zc-billing` header billed nothing. Once a paid call reaches x402stock, your agent receives x402stock's own status code and body. A failed delivery on card is refunded in full automatically.

**Errors worth handling.** The [error reference](https://agents.x402stock.xyz/errors.md) lists every code. These are the ones your agent is most likely to meet:

| Error | What to do |
|---|---|
| `payment_request_mismatch` (409) | A payment was reused on a different request. Get a fresh 402 for this request and pay that. |
| `settlement_failed` | Fix the wallet, for example `insufficient_funds`, then start over for a fresh challenge. |
| `payment_consumed` | The payment was already settled. Check the original request's delivery before paying again. |
| `bearer_required` (401) | The call carried no agent credential. Register at the [identity guide](https://agents.x402stock.xyz/auth.md) and retry with the bearer. |
| `usage_exhausted` | The Credits balance ran out. Top up with `POST /extend`. |

## Frequently asked questions

### Does x402stock need an API key for AI agents?

No x402stock account or API key, but every call carries a free agent credential from the [identity guide](https://agents.x402stock.xyz/auth.md), registered once and anonymously if you like. Each request is then paid with a signed payment from your agent's wallet.

### How much does a stock quote cost on x402stock?

A quote from `GET /api/v1/quote/{ticker}` costs $0.01 per request. The quote data is delayed, and the response's `delayed_by` field says by how much.

### Can my agent get Treasury yields without an API key?

Yes. Your agent sends `GET /api/v1/treasury-yields` to the storefront, pays the $0.01 challenge, and receives the latest US Treasury par yield curve from 1 month to 30 years.

### Can my agent pay x402stock with x402?

Yes. The x402 challenge arrives in the `payment-required` header for USDC on Base, and your agent retries the same request with the signed payload in `x-payment`. MPP and card are also accepted.

### Can my agent use x402stock without a crypto wallet?

Yes. It can create a free wallet, buy Credits by card from $0.50, pay calls of $0.50 or more by card, or hand the purchase to a person through a tracked link.

### Do I have to use an AI agent to use x402stock?

No. A person can buy x402stock's All-Access subscription at [x402stock.xyz](https://x402stock.xyz/) for unlimited calls with an `sk_live_` API key, and can use the whole catalog from Claude Code, Cursor or any MCP client through its MCP server.
