Skip to main content

How do I send my API key? (Bearer authentication)

How to authenticate your requests with an Authorization header in v2

Every request to the TAAPI.IO v2 API must include your v2 API key as a Bearer token in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Where to find your v2 key

Log in to app.taapi.io and open API Keys. Your v2 key is the Production key and starts with taapi_live_sk_. If you don't have one yet, click Generate to create it.

The Legacy API key (v1) on the same page only works with the old api.taapi.io API. Using it with v2 returns a 401 error.

Examples

curl

curl "https://v2.taapi.io/indicator/rsi?exchange=binance&symbol=BTCUSDT&timeframe=1h" \
-H "Authorization: Bearer YOUR_API_KEY"

JavaScript (fetch)

const res = await fetch(
"https://v2.taapi.io/indicator/rsi?exchange=binance&symbol=BTCUSDT&timeframe=1h",
{ headers: { Authorization: "Bearer YOUR_API_KEY" } }
);
const data = await res.json();

Python (requests)

import requests

res = requests.get(
"https://v2.taapi.io/indicator/rsi",
params={"exchange": "binance", "symbol": "BTCUSDT", "timeframe": "1h"},
headers={"Authorization": "Bearer YOUR_API_KEY"},
)
data = res.json()

Good to know

  • The v1 method of putting the key in the URL (?secret=YOUR_API_KEY) does not work in v2.

  • Because the key is sent in a header, you can't test a request by pasting a URL into your browser. Use curl, Postman, Insomnia or your own code.

  • For WebSocket streaming, send the same v2 key in the auth message: { "type": "auth", "token": "Bearer YOUR_API_KEY" }.

  • Keep your key private. Never put it in front-end code that runs in your users' browsers. If it leaks, regenerate it.

Did this answer your question?