APITube Help Center

How to fix authentication (401) errors

Fix a missing, invalid, revoked or expired API key

Erick Horn

Written by Erick Horn

June 27, 2026

Updated October 16, 2026

Open this example in the API Playground ↗

How to fix authentication (401) errors

A 401 means the API could not authenticate your key. Read errors[0].code: ER0201 means no key arrived, ER0202 means the key is invalid or revoked, and ER0230 means it has expired.

curl "https://api.apitube.io/v1/news/everything?api_key=YOUR_API_KEY"

Send the key through the X-API-Key header or api_key query parameter. The public /ping, /openapi.json and /robots.txt routes do not require a key.

How to fix ER0201 — API key is required

Check that your key value is present and that the header or parameter name is correct. A proxy may also remove a header. Both forms below work:

# As a header
curl -H "X-API-Key: YOUR_API_KEY" "https://api.apitube.io/v1/news/everything"

# As a query parameter
curl "https://api.apitube.io/v1/news/everything?api_key=YOUR_API_KEY"

Header names are case-insensitive: X-API-Key and x-api-key are equivalent. An empty api_key= still counts as missing.

How to fix ER0202 — invalid API key

The key you sent does not match an active key. Copy it again from the dashboard and check for missing characters or extra spaces. Live keys start with api_live_; test keys start with api_test_.

Check the key’s status under API Keys. If it was revoked, use another active key or create a new one and update your app.

The keys table on the API Keys page where each key's Status column shows Active, Revoked or Expired

How to fix ER0230 — API key has expired

The key has passed its expires_at date. Extend or remove its expiry in the dashboard, or replace it with a new key. Requests will keep returning ER0230 until the key’s expiry is changed or you send another valid key.

Is a 403 the same as a 401?

No. A 403 means the key is recognized but the request is not permitted. ER0601 is an IP restriction, ER0602 a domain restriction, and ER0603 a missing endpoint permission. A plan restriction can also return 403.

Common Questions

Why does my key work in one request but fail in another?

Compare the exact key and how each client sends it. Check for a missing header, empty environment variable, expired key or accidental use of a different key. Both live and test keys can authenticate; test mode changes the returned content.

Is a 401 the same as running out of credits?

No. Insufficient quota or balance returns 402. See how to check your balance. Too many requests return 429; see rate-limit errors.

Should I put my API key in the URL or a header?

Both work. Prefer X-API-Key in production because URLs are more likely to appear in logs. Query parameters are convenient for quick tests. Keep the key private in either form.


Related Articles