Docs
Documentation / Ren 1.1

Errors

Use the HTTP status and the shared JSON error envelope.

API errors use one JSON shape:

json
{"code": "invalid_key", "message": "A valid API key is required."}

Branch on the HTTP status and stable code, not the prose in message. Messages never repeat your request content. Intermediaries can still return non-JSON failures; treat those as transport failures rather than successful decisions.

Every response, success or error, carries an X-Request-Id header (req_ and 32 hex characters). Log it and quote it when contacting Secnd. The SDK errors expose it as requestId (TypeScript) and request_id (Python).

StatusMeaningYour next step
400Malformed JSON or compression, or JSON nested deeper than 64 levelsFix the body or headers
401Missing, invalid, or revoked bearer keyFix credentials; do not blindly retry
413Body over 4 MB, or input over 2048 tokensReduce the request; no automatic truncation
415Unsupported content type or content encodingUse JSON and a supported single encoding
400 unknown_modelUnknown, shortened, or case-variant model IDUse ren-1.1.0, ren-latest, or ren-preview
422Unknown or missing fields at any level, option or level count, duplicate IDs, invalid levelsFix the schema
429Key or account rate limit reachedHonor retry-after-ms or Retry-After and back off
502Invalid or unavailable inference responseRetry within a bounded budget
503Gateway temporarily unavailableRetry within a bounded budget
504Inference timed outRetry within a bounded budget
529Inference overloadedBack off and reduce concurrency

If inference fails, do not manufacture an answer or proceed as if the gate passed. Queue review or return a temporary failure from your own application.

A 429 always means the same request can succeed later. Requests the gateway can reject outright (400, 413, 415, 422) are rejected for what they are, before rate limiting, and do not count against your limit. The 2048-token limit is checked by inference after rate limiting, so an over-limit request counts as one request and returns 413.

The SDKs retry 429 and server errors with bounded backoff. Apply a separate application timeout and avoid wrapping SDK retries in an unbounded retry loop. Authentication and validation errors need corrected input.

Read Markdown ↗