When a request cannot be completed, the Semji API returns a JSON error object alongside an appropriate HTTP status code. All errors follow the same structure, making them straightforward to handle in code. This page documents every error code the API can return, explains what triggers each one, and provides guidance on how to respond.Documentation Index
Fetch the complete documentation index at: https://developers.semji.com/llms.txt
Use this file to discover all available pages before exploring further.
Error response format
Every error response — regardless of cause or status code — uses the following shape:A stable, machine-readable string identifying the error type. Use this field in your error-handling logic — it will not change between API versions.
A human-readable explanation of the error. For
validation_error responses, this describes the specific field that failed validation. Useful for debugging but not guaranteed to be stable across releases.Error codes reference
| HTTP status | error.code | Meaning |
|---|---|---|
| 400 | bad_request | The request was malformed or a required field is missing |
| 401 | unauthorized | API key is missing, invalid, or revoked |
| 403 | forbidden | Authenticated but not permitted to access this resource |
| 404 | not_found | The resource does not exist |
| 409 | conflict | Request conflicts with current state, e.g. version mismatch |
| 422 | validation_error | Request body failed schema validation |
| 429 | rate_limited | Too many requests — hourly or burst limit exceeded |
| 500 | internal_error | Unexpected server error |
| 502 | bad_gateway | The upstream service returned an error |
| 503 | service_unavailable | Service temporarily unavailable |
Detailed error reference
400 Bad Request — bad_request
400 Bad Request — bad_request
Returned when the request is structurally malformed — for example, a required query parameter is missing, a path parameter cannot be parsed, or the request body is not valid JSON.How to handle: Inspect the
Example response
message field for details on what is wrong. Check that all required parameters are present and that your request body is valid JSON with the correct Content-Type: application/json header.401 Unauthorized — unauthorized
401 Unauthorized — unauthorized
403 Forbidden — forbidden
403 Forbidden — forbidden
Returned when the API key is valid but the authenticated user does not have permission to access the requested resource. Common causes: accessing a workspace the user is not a member of, or attempting an admin-only action with a Member-role key.How to handle: Confirm that the user associated with your API key has the required role in the workspace or organization. To check your current user and role, call
Example response
GET /v1/me and GET /v1/users.404 Not Found — not_found
404 Not Found — not_found
Returned when the resource identified by the URL or a path parameter does not exist, or the authenticated user cannot see it.How to handle: Double-check the ID in your request path. Note that resources in workspaces you don’t have access to also return
Example response
404 rather than 403, to avoid leaking information about what exists.409 Conflict — conflict
409 Conflict — conflict
Returned when the request conflicts with the current state of the resource. The most common cause is an optimistic locking conflict on content updates: the How to handle: Re-fetch the resource to get the latest
version field you submitted does not match the current version on the server, meaning another client updated the resource since you last fetched it.Example response
version value, apply your changes to the fresh copy, and retry the update with the new version.422 Unprocessable Entity — validation_error
422 Unprocessable Entity — validation_error
Returned when the request body is structurally valid JSON but fails schema validation — for example, an enum field contains an unrecognized value, a required field is How to handle: Read the
null, or a string exceeds its maximum length. The message field names the specific field that failed.Example response
message to identify the offending field and correct the value in your request. Do not retry without fixing the input — the same request will fail again.429 Too Many Requests — rate_limited
429 Too Many Requests — rate_limited
Returned when you exceed the rate limit for your API key — either 1,000 requests per rolling hour or 20 requests per second. The response includes a How to handle: Wait at least the number of seconds in the
Retry-After header indicating how many seconds to wait.Example response
Retry-After header before retrying. Use exponential backoff with jitter for repeated 429s. See Rate Limits for full retry guidance.500 Internal Error — internal_error
500 Internal Error — internal_error
Returned when an unexpected error occurs on the server. This is not caused by your request.How to handle: Retry the request using exponential backoff. If the error persists, contact Semji support.
Example response
502 Bad Gateway — bad_gateway
502 Bad Gateway — bad_gateway
Returned when the Semji gateway successfully received your request but the upstream service returned an error. This is typically a transient infrastructure issue.How to handle: Retry with exponential backoff. A
Example response
502 is not caused by your request and will usually resolve within seconds.503 Service Unavailable — service_unavailable
503 Service Unavailable — service_unavailable
Handling errors in code
The following pattern covers the most important cases — retry on transient server errors, respect rate limit headers, and surface actionable messages for client errors:- Retry on
429,500,502, and503using exponential backoff - Do not retry on
400,401,403,404,409, or422— these indicate a problem with the request that must be fixed first - Re-fetch then retry on
409— get the latest resource version before submitting your update again - Check
error.messageon422to identify which field failed validation