> TickerLayer documentation for AI agents and LLMs, the Markdown version of https://tickerlayer.com/docs/rest
> REST base URL https://api.tickerlayer.com, API key in the `x-api-key` header. WebSocket wss://stream.tickerlayer.com?apiKey=YOUR_API_KEY.
> Any docs page reads as Markdown at its URL plus `.md`. Index: https://tickerlayer.com/llms.txt · Full API reference: https://tickerlayer.com/llms-full.txt

# Conventions

Shared rules that apply to every REST endpoint in the API. All routes return JSON and require an API key via the x-api-key header.

## Base URL

**Base URL**

```
https://api.tickerlayer.com
```

- **Format:** JSON, with `Content-Type: application/json`.
- **Timestamps:** Unix milliseconds (`number`).
- **Methods:** `GET` for every data endpoint.

## Authentication

| Method | Send the key as | Use |
| --- | --- | --- |
| Header | `x-api-key: <YOUR_API_KEY>` | Preferred. |
| Query parameter | `?apiKey=<YOUR_API_KEY>` | Compatibility fallback; keeps the key in logged URLs, so prefer the header. |

**Example**

```bash
curl -sS "https://api.tickerlayer.com/crypto/quote/BTCUSD" \
  -H "x-api-key: <YOUR_API_KEY>"
```

More in the [Authentication guide](https://tickerlayer.com/docs/authentication).

## Response shape

- **Null fields:** Keys stay in the schema; a value temporarily missing from the aggregated view is `null`, not left out. Individual fields may be optional depending on market conditions; see each route for response details.
- **404 vs empty:** A missing symbol or resource returns `404`, for example `{ "statusCode": 404, "message": "symbol not available" }`; an empty list returns `200` with an empty array.
- **Bad parameters:** `400` with a message that lists the valid values.

## Errors & metering

The per-second limit is checked first, so a throttled request never uses monthly quota.

| Status | error | Details |
| --- | --- | --- |
| `429` | `REST_RATE_LIMIT_EXCEEDED` | Per-second limit, with `limitRps` and `retryAfterMs`. |
| `429` | `REST_QUOTA_EXCEEDED` | Monthly quota, with `limit`. |
| `503` | `USAGE_METERING_UNAVAILABLE` | Usage storage is unreachable; the request fails closed. |

See [Rate limits](https://tickerlayer.com/docs/limits) and the [Errors reference](https://tickerlayer.com/docs/errors).

## OpenAPI, Postman & SDKs

Every REST endpoint, with its parameters, error responses and a real example response, is in one OpenAPI 3.1 file. Import it into an API client or a code generator.

**OpenAPI 3.1**

```
https://tickerlayer.com/openapi.json
```

To send requests without writing code, open the [Postman collection](https://www.postman.com/tickerlayer/tickerlayer-market-data-api), paste your key into its `apiKey` variable and run any request.

For JavaScript and TypeScript, the [tickerlayer](https://www.npmjs.com/package/tickerlayer) package wraps every route above and the WebSocket stream, with typed responses and reconnects handled for you. It has no dependencies and runs on Node.js 18 and newer, Deno, Bun and in browsers.

**npm**

```bash
npm install tickerlayer
```

```javascript
import { TickerLayer } from 'tickerlayer';

const tl = new TickerLayer({ apiKey: process.env.TICKERLAYER_API_KEY });
const quote = await tl.quote('stocks', 'US:KO');
```

For Python 3.9 and newer, the [tickerlayer](https://pypi.org/project/tickerlayer/) package has the same methods in a sync and an async client, and the stream as an async iterator.

**pip**

```
pip install tickerlayer
```

```python
from tickerlayer import TickerLayer

tl = TickerLayer()  # reads TICKERLAYER_API_KEY
quote = tl.quote("stocks", "US:KO")
```
