Two shapes of the same code
Every VALIDATION_ERROR uses the standard error envelope, but there are two shapes and your client should handle both. When the body fails the endpoint's schema - a missing field, a wrong type, a value out of range, an extra key - the message is always Request validation failed and details is an array with one entry per problem:
POST /v1/charts/birth without lat - the real response:
{
"request_id": "req_01M8RK47D7JVPTN9RXBH9RRJ2P",
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"keyword": "invalid_type",
"instancePath": "/lat",
"schemaPath": "#/lat/invalid_type",
"message": "Invalid input: expected number, received undefined",
"params": { "expected": "number" }
}
]
}
}instancePath is a JSON Pointer to the offending field (/lat, /pairs/0/id, / for the object itself), and keyword says what kind of failure it was. Show details[].message to a developer, map instancePath to a form field for an end user. Every problem is listed at once - an empty {} body produces five entries, one for each birth field.
When the body is well-formed but impossible - the calculation itself rejects it - there is no details, and the message carries the reason in plain English:
"time": "25:10" passes the HH:MM pattern, so the engine rejects it:
{
"request_id": "req_01M8RK47E8ZC85RARMHEYPG091",
"error": { "code": "VALIDATION_ERROR", "message": "hour must be 0..23, got 25" }
}The messages you will actually see
| You sent | message / details[].message | Fix |
|---|---|---|
"timezone": "Asia/Kolkata" as an extra key | Unrecognized key: "timezone" | Birth input is strict: send only date, time, tz_offset_minutes, lat, lng. Resolve the zone to an offset yourself. |
"tz_offset_minutes": 5.5 | Invalid input: expected int, received number | The field is minutes, not hours: IST is 330. |
"date": "24/04/1973" | date must be ISO YYYY-MM-DD | Zero-padded ISO date: 1973-04-24. |
"time": "25:10" | hour must be 0..23, got 25 | 24-hour clock, HH:MM or HH:MM:SS. |
| A truncated JSON body | Body is not valid JSON but content-type is set to 'application/json' | Serialize with your JSON library, not by string concatenation. |
"division": 13 to /v1/charts/varga | Unsupported varga division: 13. Use one of 2, 3, 7, 9, 10, 12, 16, 20, 24, 27, 30, 40, 45, 60 | Pick a division from the list in the message. |
An Idempotency-Key header of 256 characters | Idempotency-Key exceeds 255 characters | Use a shorter key, e.g. a UUID. |
| Placidus houses for Tromsø in December | Placidus house cusps are undefined at latitude 69.65° … | See polar latitude errors. |
What is checked first
The API checks your key before it reads the body. A request with no key, or a bad one, gets 401 UNAUTHORIZED even if its body is also broken - we sent {} with no Authorization header and got Missing or invalid Authorization header, not a 400. Only once the key is accepted is the body validated.
With a valid key, schema validation comes before the plan check and the rate limiter. A Free key sending {} to a Hobby endpoint gets VALIDATION_ERROR, not PLAN_REQUIRED. These schema failures carry no x-ratelimit-* headers and do not use a slot in your per-minute window. Engine-level 400s (bad hour, unsupported division, polar latitudes) happen after rate limiting, so they do carry the headers and use a slot. Both kinds appear in your usage history; neither is billed - no 400 consumes monthly quota.
One 400 with a different code: INVALID_INPUT
POST /v1/dasha/lookup checks its target date itself and answers an unparseable one with a code that appears nowhere else in the API:
{
"request_id": "req_01M8RK47EB88177TNXT7XR1K0M",
"error": { "code": "INVALID_INPUT", "message": "Invalid date: next tuesday" }
}Treat INVALID_INPUT exactly like VALIDATION_ERROR - same status, same fix (send an ISO 8601 date-time such as 2026-12-01T00:00:00Z). If your client switches on error.code, add it to the same branch.