Errors
beginnerHTTP error codes, error response format, validation errors, and retry strategies for the Engramma API.
Error response format
The Engramma API uses FastAPI's standard error format.
Validation errors (422):
{
"detail": [
{
"loc": ["body", "text"],
"msg": "field required",
"type": "value_error.missing"
}
]
}
Simple errors (401, 403, 404, etc.):
{
"detail": "Not authenticated"
}
Validation error fields
| Field | Type | Description |
|---|---|---|
loc | array[string|integer] | Path to the field that failed (e.g. ["body", "text"]) |
msg | string | Human-readable error message |
type | string | Error type identifier |
input | any | The value that caused the error (when available) |
ctx | object | Additional context (when available) |
HTTP status codes
400 Bad Request
The request body is malformed or cannot be parsed.
| Situation | Fix |
|---|---|
| Invalid JSON body | Check JSON syntax, ensure Content-Type is application/json |
| Missing required Content-Type | Add -H "Content-Type: application/json" |
401 Unauthorized
Authentication failed or was not provided.
| Detail message | Fix |
|---|---|
Not authenticated | Add X-API-Key header or Authorization: Bearer header |
Invalid API key | Verify the API key is correct and active |
Token expired | Refresh using POST /v1/auth/refresh |
Token revoked | Create a new API key or re-login |
403 Forbidden
Authentication succeeded but the action is not allowed.
| Situation | Fix |
|---|---|
| Insufficient scope | Create a key with broader scopes |
| Not an organization admin | Ask an org admin to perform the action |
| Account suspended | Contact support |
404 Not Found
The resource or endpoint doesn't exist.
| Situation | Fix |
|---|---|
| Wrong URL path | Check the API docs for correct paths |
| Resource deleted | The pattern/org/user may have been removed |
405 Method Not Allowed
Wrong HTTP method for the endpoint.
| Situation | Fix |
|---|---|
| GET on a POST-only endpoint | Use the correct HTTP method (e.g. POST /v1/memory/text/retrieve, not GET) |
409 Conflict
The request conflicts with current state.
| Situation | Fix |
|---|---|
| Email already registered | Use login instead, or use a different email |
| Consolidation already running | Wait for the current cycle to complete |
422 Unprocessable Entity
The request is well-formed JSON but fails validation.
| Common validations | Constraint |
|---|---|
text field missing | Required on store/retrieve/recall |
text too long | Max 10,000 characters (store), 5,000 (query) |
top_k out of range | Must be 1-50 (text endpoints) |
threshold out of range | Must be 0.5-1.0 (forget endpoint) |
items too large | Max 50 items (batch-store) |
password too short | Minimum 12 characters |
429 Too Many Requests
You've exceeded your plan's quota.
| Situation | Fix |
|---|---|
| Daily query limit reached | Upgrade plan or wait until tomorrow |
| Pattern storage full | Upgrade plan or delete unused patterns |
Rate limit headers:
HTTP/1.1 429 Too Many Requests
Retry-After: 60
500 Internal Server Error
Something went wrong on our side.
| Situation | Fix |
|---|---|
| Unexpected error | Retry the request with exponential backoff |
| Persistent failures | Contact support |
Retry strategy
Recommended retry behavior:
| Attempt | Delay | Retries on |
|---|---|---|
| 1st retry | 1s | 429, 500, 502, 503 |
| 2nd retry | 2s | 429, 500, 502, 503 |
| 3rd retry | 4s | 429, 500, 502, 503 |
| Give up | — | Return the error |
Never retry:
- 400 (bad request — fix the input)
- 401 (auth failed — fix credentials)
- 403 (forbidden — fix permissions)
- 404 (not found — resource doesn't exist)
- 405 (wrong method — use correct HTTP verb)
- 409 (conflict — resolve the conflict)
- 422 (validation — fix the data)
Next steps
- API Overview — Base URL, auth, rate limits
- Memory Core — Core memory endpoints
- Authentication — Auth flow