Skip to content

Errors and request IDs ​

Every response from the runtime API carries an X-Request-Id header. When something fails, quote that value to support and we can trace the request. If you send your own X-Request-Id (8 to 64 characters: letters, digits, ., _, -), we echo it back so you can match it to your own logs.

Error body ​

json
{
  "error": "An unexpected error occurred. Please try again or contact support if the problem persists.",
  "code": "internal_error",
  "docUrl": "https://docs.tenancyengine.com/api/errors#internal_error",
  "requestId": "req_3f1c0a9e5b7d4c2e8a6f1b2c3d4e5f60"
}
FieldMeaning
errorA message you can show to a person. It never contains stack traces or internal detail.
codeA stable, machine-readable code. Branch on this, never on the message text.
docUrlLink to the section of this page for the code.
requestIdThe same value as the X-Request-Id response header.

Every failed call to the /api/ surface has this body, including the ones that used to come back empty (401, 403, 404, 405, 429). Endpoints that return their own more specific error body keep it and still carry the X-Request-Id header.

Look up a failed request ​

Signed in to the console, GET /api/v1/console/request-lookup/{requestId} returns what we recorded about a failed call: HTTP method, route pattern, status, how long it took, the error code and a link to its section below. We never store request or response bodies, headers or query strings. Records are kept for 7 days and only exist for failed calls (status 400 and above) made by a signed-in user or an organization API key. The lookup itself is available to signed-in console users.

You can only look up your own requests and requests made in organizations you can access. Anything else, including an id that does not exist, returns the same 404.

Codes ​

bad_request ​

HTTP 400. The request body, query string or route values are missing or could not be read. Check that the body is valid JSON and that every required field is present, then retry.

unauthorized ​

HTTP 401. No credentials were sent, or they are expired or invalid. Sign in again or send a valid API key or access token. Do not retry the same credentials.

forbidden ​

HTTP 403. The credentials are valid but are not allowed to do this. Check the API key scopes or the signed-in user's role.

environment_not_allowed ​

HTTP 403. The API key is limited to some environments (Development, Staging, Production) and the request addresses another one: an environment you named, the environment a tenant was created in, or, for application webhook endpoints (which receive every environment's events), any key that does not allow every environment. Routes that omit environment default to Production (tenant create, offerings), so a key limited to Development must name Development. The body carries requestedEnvironment when there is one. Use a key whose environments include it, or create one that does. Keys with no environment setting are never refused for this reason. See API key levels, lifetime and rotation.

invalid_environment ​

HTTP 400. For a key limited to some environments, the environment value is not exactly one of Development, Staging or Production (a number, a comma-separated list or a repeated parameter is refused), or it is missing on a route that has no default. The 400 is not audited. Routes that bind the environment as a required typed parameter (usage meters, paywall and usage-widget tokens) behave the same for a value that is present but malformed (invalid_environment, refused before binding); only an absent or empty value is refused by the framework's own plain 400, before this check runs, so that body has no invalid_environment code.

not_found ​

HTTP 404. The route or the resource does not exist, or you cannot see it. Check the path and the ids.

method_not_allowed ​

HTTP 405. The route exists but not for this HTTP method. The Allow header lists the supported methods when the server can tell.

conflict ​

HTTP 409. The request conflicts with the current state, for example a name that is already taken. Fetch the current state and decide before retrying.

unsupported_media_type ​

HTTP 415. Send the body as application/json with a matching Content-Type header.

validation_failed ​

HTTP 422. The request was understood but a value is not valid. The message says which one.

rate_limited ​

HTTP 429. Too many requests. Wait for the number of seconds in the Retry-After header, then retry with backoff.

internal_error ​

HTTP 500 and other 5xx. Something went wrong on our side. Retrying is safe for idempotent calls. If it persists, contact support and include the requestId.

TenancyEngine platform documentation