# Get a stock, forex or crypto quote with TickerLayer's API

TickerLayer's API returns the latest quote for a stock, a currency pair or a crypto pair: the top bid and ask, the size at each, and the time of the observation. A stock quote costs $0.01, paid per request. Send `GET https://agents.tickerlayer.com/zcj/tawx16vws11c/stocks/quote/US:KO` with your agent credential, pay the 402 price quote, and send the same request again; stock symbols must carry their market prefix, so `US:KO` works and `KO` does not.

## At a glance

- **Endpoint:** `GET https://agents.tickerlayer.com/zcj/tawx16vws11c/stocks/quote/{symbol}`, also `/forex/quote/{symbol}` and `/crypto/quote/{symbol}`. No body; the symbol goes in the path, one per call.
- **Symbol:** stocks take `CC:SYMBOL` such as `US:KO` or `DE:BMW`, forex a six-letter pair such as `EURUSD`, crypto a spot pair such as `BTCUSD`. A bare ticker such as `KO` is refused.
- **Price per quote:** stocks $0.01, forex $0.01, crypto $0.01
- **Credential:** an agent credential on every call, as `Authorization: Bearer <token>`. Registering is one free call at [auth.md](https://agents.tickerlayer.com/zcj/tawx16vws11c/auth.md), and its assertion is then exchanged for an access token.
- **Payment:** a 402 is the price quote, which you pay and retry. x402 and MPP are the wallet rails, settling in USDC; card buyers use prepaid Credits.
- **Response:** `symbol`, `bid`, `ask`, `bid_size`, `ask_size`, `timestamp` (Unix milliseconds)
- **Data:** derived, indicative market data built from non-exchange sources. Values can arrive late and can differ from official exchange prices.
- **Full purchase flow:** [buyer skill](https://agents.tickerlayer.com/zcj/tawx16vws11c/SKILL.md)

## Get the first quote

1. Get an agent credential and exchange it for an access token, following [auth.md](https://agents.tickerlayer.com/zcj/tawx16vws11c/auth.md). The steps there leave the token in `ACCESS_TOKEN`. A call without it is answered with `401 bearer_required` before any price is quoted.

2. Request the quote:

   ```bash
   curl -s https://agents.tickerlayer.com/zcj/tawx16vws11c/stocks/quote/US:KO -H "Authorization: Bearer $ACCESS_TOKEN"
   ```

   The storefront answers with a 402. Its JSON body carries `payment.amountUsd` with the exact amount, the `plan`, and a `protocols` block holding an `x402` and an `mpp` challenge; the same challenges also arrive in the `payment-required` and `www-authenticate` headers. Nothing is charged yet, so you can stop here.

3. Pay the challenge and send the identical request again with the proof and your credential. On x402 the proof goes in `x-payment` and the bearer stays in `Authorization`. On MPP the proof takes `Authorization: Payment <credential>`, so the bearer moves to `ZC-Agent-Authorization: Bearer <token>`. The Zero CLI sends the credential and both requests in one command:

   ```bash
   zero fetch https://agents.tickerlayer.com/zcj/tawx16vws11c/stocks/quote/US:KO
   ```

   Any other x402 or MPP client works the same way, as long as the credential is on both requests.

4. Read the response. It is a JSON object with six fields:

   ```json
   {"symbol": "<as requested>", "bid": <number>, "ask": <number>, "bid_size": <number>, "ask_size": <number>, "timestamp": <Unix milliseconds>}
   ```

   `bid`, `ask` and the two sizes can be null. The example request paid $0.01.

## Use the right symbol for each asset class

The symbol format is where a first call goes wrong. Each asset class has its own route, its own format and its own symbol list.

| Asset class | Quote route | Symbol format | Example | Symbol list (price) |
| --- | --- | --- | --- | --- |
| Stocks | `/stocks/quote/{symbol}` | Market code, colon, ticker | `US:KO`, `DE:BMW` | `GET /stocks/symbols`, optional `?market=US` ($0.02) |
| Forex | `/forex/quote/{symbol}` | Six-letter pair, no prefix | `EURUSD`, `GBPJPY` | `GET /forex/symbols` ($0.02) |
| Crypto | `/crypto/quote/{symbol}` | Spot pair, no prefix | `BTCUSD`, `ETHUSD` | `GET /crypto/symbols` ($0.02) |

Forex and crypto symbols are uppercased before lookup. The stock symbol list returns each row's `symbol`, `base_symbol`, `market` and company `name`, so look up `KO` there and send its `symbol`.

A bare ticker such as `KO` on the stock route is refused before any price is quoted, and nothing is charged. The refusal is a JSON body with `error` and `message`. A forex quote for `EURUSD` returns the same six fields as a stock quote. That example paid $0.01. A crypto quote for `BTCUSD` also returns the same six fields, and paid $0.01.

## Make the next calls for the same symbol

Once a symbol answers a quote, the same symbol works on the other routes of its asset class. Each is one request with the same credential and payment.

| Call | Stock route | Returns | Price |
| --- | --- | --- | --- |
| Last trade | `/stocks/trade/last/{symbol}` | `price`, `size`, `timestamp` | $0.01 |
| Snapshot | `/stocks/snapshot/{symbol}` | Bid, ask, last trade, `prev_close`, `change`, `change_percent` | $0.02 |
| Previous bar | `/stocks/agg/{symbol}/prev` | The last completed daily bar; `?interval=5m` and the other listed sizes return the latest settled bar at that size | $0.01 |
| Historical bars | `/stocks/agg/{symbol}/{multiplier}/{timespan}/{from}/{to}` | OHLCV bars between two UTC dates, paged | By `limit`: up to 100 $0.03, up to 500 (default) $0.05, up to 1,000 $0.10 |

A historical request looks like `GET https://agents.tickerlayer.com/zcj/tawx16vws11c/stocks/agg/US:KO/1/day/2026-09-28/2026-09-30?limit=100`. Follow `next_offset` until it is null to read the whole range.

Forex and crypto take the same paths under `/forex/` and `/crypto/`, each with its own meter, such as $0.02 for a forex snapshot and $0.05 for a default page of crypto bars.

Indices, ETFs and commodities offer the same set of calls, at prices such as $0.01, $0.01 and $0.01 for a quote. Index codes carry no prefix (`US500`, `DE40`). ETF codes look like `US500ETF`, with a few prefixed Asian listings such as `HK:2800`. Commodity codes look like `XAUUSD` or `WTIUSD`. Each service's routes are in `https://agents.tickerlayer.com/zcj/tawx16vws11c/services/<slug>/openapi.json`, with the slug from [the services list](https://agents.tickerlayer.com/zcj/tawx16vws11c/services).

## Limits

- One symbol per quote call. There is no batch quote parameter on these routes.
- Bars come at 1, 5 or 15 minutes, 1 or 4 hours, or 1 day. The longest range per request runs from 31 days for 1-minute bars to 5,000 days for daily bars; a longer range is refused.
- An unpaid 402 charges nothing. A paid call returns the API's own status and body.
- The data is derived and indicative, and a value can lag or differ from the official price. A forex quote is an indicative view built from several sources, not a rate you can execute at.

## Errors

| Response | Meaning | Action |
| --- | --- | --- |
| `401 bearer_required` | No agent credential on the call; no price quoted | Register at [auth.md](https://agents.tickerlayer.com/zcj/tawx16vws11c/auth.md) and retry with the bearer |
| `402` | The price quote; nothing charged yet | Pay and resend the identical request, or stop |
| Symbol refused before any price | Bare ticker or unknown symbol; `message` says why, and `hint` may name the routes for another asset class | Send `CC:SYMBOL`, or check the list route |
| `settlement_failed` | The payment did not settle; `settlementReason` says why | Fix the wallet and start again from a fresh request |
| `429` with `REST_RATE_LIMIT_EXCEEDED` | Per-second limit reached | Wait `retryAfterMs` milliseconds, then retry |

## Frequently asked questions

### Why does KO fail when US:KO works?

Stock symbols are market-qualified, written as `CC:SYMBOL`. The route refuses a bare ticker before quoting a price, so nothing is charged. Look up the full symbol with the stock symbol list, a $0.02 call, and send that.

### How much does a stock quote cost?

$0.01 per quote, the same as a last trade or a previous bar. A snapshot with the previous close and change is $0.02. The 402 states the exact amount before you pay.

### Can I pay for a single quote by card?

A pay-as-you-go card payment needs a call of at least $0.50, and a quote costs less. Buy prepaid Credits instead, at least $0.50 by card, with `POST /plans/{planId}/purchase` and the plan id from [the catalog](https://agents.tickerlayer.com/zcj/tawx16vws11c/manifest.json); each quote then draws down the balance.

### Is the quote an official exchange price?

No. TickerLayer's market data is derived and indicative, aggregated from non-exchange sources. A value can arrive late or differ from the official price.

### Does the stock quote API need an upstream API key?

No. Every call carries your agent credential as a bearer, and each request is paid on its own or from prepaid credit. The storefront handles access to TickerLayer's API.

## Keep reading

- [Buyer skill](https://agents.tickerlayer.com/zcj/tawx16vws11c/SKILL.md): the full purchase flow
- [How to pay](https://agents.tickerlayer.com/zcj/tawx16vws11c/payment.md): x402, MPP, card and Credits
- [Identity](https://agents.tickerlayer.com/zcj/tawx16vws11c/auth.md): registering and presenting the agent credential
- [Stocks API reference](https://agents.tickerlayer.com/zcj/tawx16vws11c/services/stocks/openapi.json): every stock route and field
- [Error reference](https://agents.tickerlayer.com/zcj/tawx16vws11c/errors.md): every storefront error code

---

Updated 2026-11-17. All TickerLayer guides: https://agents.tickerlayer.com/guides.md. Storefront: https://agents.tickerlayer.com/zcj/tawx16vws11c/llms.txt.
