
# Errors

Every error has the same shape:

```json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Unknown field: pan",
    "details": { "unknown": ["pan"], "fields": ["name", "gstin", "bank_ifsc"] }
  }
}
```

| Field | Always present | Meaning |
|---|---|---|
| `code` | Yes | Stable, machine-readable. Branch on this |
| `message` | Yes | One sentence a person can read |
| `details` | No | What exactly was wrong: the unknown keys, the allowed values, the existing id |

## Codes

| Status | Code | Meaning | What to do |
|---|---|---|---|
| 400 | `VALIDATION_ERROR` | A value is missing or malformed, or names a field the object doesn't have | Fix the request. `details` names the bad input and, where it helps, what's allowed |
| 400 | `INVALID_JSON` | The body isn't valid JSON, or isn't a JSON object | Send a JSON object |
| 401 | `UNAUTHORIZED` | Missing, wrong or expired key | See [Authentication](/docs/api/authentication) |
| 403 | `FORBIDDEN` | The key lacks the permission | Use a key with that scope |
| 404 | `NOT_FOUND` | No such object, field or record in your organization | Check the id. Ids from another organization also answer 404 |
| 409 | `CONFLICT` | The slug or key already exists | `details.id` is the existing one; use it instead |
| 422 | `FIELD_RETIRED` | A value was sent for a retired field | Drop the field from the request. Retired fields keep their history but take no new values |

## All or nothing

A request that sets several values is checked in full before anything is written. If one key is unknown or retired, nothing is changed.
