Which message, which cause
message | What happened | What to check |
|---|---|---|
| Missing or invalid Authorization header | No Authorization header, or one that does not start with Bearer (a Token … or bearer … scheme counts as missing). | The header name and the exact prefix Bearer with one space. Proxies and some HTTP clients drop Authorization on redirects. |
| Invalid API key | The token was read but matches no active key. A revoked key returns this same message - the API does not say "revoked". | Whitespace or quotes copied with the key; a key revoked in the dashboard; a key from another environment's .env. |
| Account suspended or unavailable | The key is valid but the account behind it is suspended or deleted. | Contact support - a new key on the same account will get the same answer. |
A key that was revoked in the dashboard - indistinguishable from a typo:
json
{
"request_id": "req_01M8RK47C62W1HPGTD7ZVCKZSC",
"error": { "code": "UNAUTHORIZED", "message": "Invalid API key" }
}Sending the key correctly
bash
curl -X POST https://api.astronode.dev/v1/charts/birth \
-H "Authorization: Bearer aie_test_..." \
-H "Content-Type: application/json" \
-d '{"date":"1973-04-24","time":"17:25:00","tz_offset_minutes":330,"lat":19.076,"lng":72.8777}'- Keys start with
aie_test_oraie_live_. The prefix is part of the key - send it. - Leading and trailing whitespace is ignored, but quotes are not: a
.envvalue pasted as"aie_test_..."sends the quotes as part of the key. - Call the API from your server. A key in a mobile app or browser bundle can be extracted, and once it is revoked every copy of the app gets this 401.
- A broken body does not hide an auth problem: the key is checked first, so a request with no key and an invalid body still gets this 401. Once the key is accepted, body problems come back as VALIDATION_ERROR.
On the chat API
POST /v1/chat/respond uses the same keys and the same messages. Its envelope adds "success": false:
json
{
"success": false,
"request_id": "req_01M8RK37C2FPH1TSEN6H032WAV",
"error": { "code": "UNAUTHORIZED", "message": "Missing or invalid Authorization header" }
}