Skip to main content

Error: You are not authenticated to query this endpoint!

What to do when you run into an error with a "statusCode": 401 and a response "not authenticated"

Updated this week

Have you received an error message like this?

Authentication errors, particularly 401 errors, are common when API keys are improperly configured or requests are incorrectly structured.

In this guide, we simplify understanding the reasons behind authentication failures and offer actionable solutions to resolve them effectively.

{
"message": "You are not authenticated to query this endpoint! Please check your secret key, otherwise please get in touch with us.",
"statusCode": 401
}

In most cases, this issue is caused by one of these reasons:

  1. Incorrectly Copied API Key: Ensure the API key is fully and accurately copied, avoiding spaces or typos.

  2. Improper JSON Formatting: Verify the JSON request body is well-structured and meets TAAPI.IO's specifications.

  3. Missing or Incorrect Headers: Always include headers like Content-Type: application/json.

  4. Invalid Endpoint URL Formatting: Confirm that the API key is correctly placed in the URL; for instance, it must follow https://[api-endpoint]?secret=[YOUR_API_KEY]&[other-parameters].

If the problem persists, get in touch with us and share a sample of your code that is returning the error message.

Additionally, validate your API key details in your TAAPI.IO account and use tools like JSON validators to identify formatting mistakes in your payload or URLs.

Did this answer your question?