← Errors and troubleshooting

HTTP 400 · VALIDATION_ERROR

VALIDATION_ERROR: the request was rejected before any calculation

A 400 means the server understood your request well enough to know it cannot compute an answer from it. Nothing is wrong on our side and retrying the same body will fail the same way - the message or the details array says what to change.

Updated · every example recorded from a real API call

HTTP status
400 Bad Request
Retry?
Not with the same body - change the request first.
Counts toward your monthly quota?
No. Only successful (2xx) calls are billable; every 400 is free.
Returned by
Every endpoint that takes a body, on both the calculation API and the chat API.

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:

json
{
  "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:

json
{
  "request_id": "req_01M8RK47E8ZC85RARMHEYPG091",
  "error": { "code": "VALIDATION_ERROR", "message": "hour must be 0..23, got 25" }
}

The messages you will actually see

Real VALIDATION_ERROR messages and their fix
You sentmessage / details[].messageFix
"timezone": "Asia/Kolkata" as an extra keyUnrecognized 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.5Invalid input: expected int, received numberThe field is minutes, not hours: IST is 330.
"date": "24/04/1973"date must be ISO YYYY-MM-DDZero-padded ISO date: 1973-04-24.
"time": "25:10"hour must be 0..23, got 2524-hour clock, HH:MM or HH:MM:SS.
A truncated JSON bodyBody 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/vargaUnsupported varga division: 13. Use one of 2, 3, 7, 9, 10, 12, 16, 20, 24, 27, 30, 40, 45, 60Pick a division from the list in the message.
An Idempotency-Key header of 256 charactersIdempotency-Key exceeds 255 charactersUse a shorter key, e.g. a UUID.
Placidus houses for Tromsø in DecemberPlacidus 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:

json
{
  "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.