If the API responds with status code 401, your request could not be authenticated. With v2 of the API you will see one of these two responses:
{
"error": "Missing or invalid Authorization header. Use: Authorization: Bearer <token>"
}{
"error": "Invalid or inactive token"
}How to send your API key in v2
Your v2 API key must be sent as a Bearer token in the Authorization header of every request. There are no query-string or body alternatives: putting the key in the URL (?secret=YOUR_API_KEY) worked in v1 but does not work in v2.
curl "https://v2.taapi.io/indicator/rsi?exchange=binance&symbol=BTCUSDT&timeframe=1h" \
-H "Authorization: Bearer YOUR_API_KEY"
Common causes
You are using your v1 key (you get "Invalid or inactive token"): v1 and v2 use different keys. Log in to app.taapi.io, open API Keys and use the Production key (it starts with
taapi_live_sk_). If you don't have one yet, generate it there. The Legacy API key (v1) only works with the oldapi.taapi.ioAPI.The header is missing or malformed (you get "Missing or invalid Authorization header"): the header must read exactly
Authorization: Bearer YOUR_API_KEY, with a single space afterBearer. This error also appears if you are still passing the key as?secret=in the URL.The API key was copied incorrectly (you get "Invalid or inactive token"): make sure you copied the whole key, with no extra spaces or line breaks.
You recently regenerated your key: your previous v2 key stops working as soon as you generate a new one. Make sure your code uses the new key. See How can I reset my API key.
Your account is not active: if your key is correct and you still get "Invalid or inactive token", check your subscription under Billing at app.taapi.io.
If the problem persists, get in touch with us and share a sample of the code that returns the error (please remove your API key first).