API errors

Handle the stable JSON error envelope and each public error code.

View Markdown

Error envelope

Every API error uses the same JSON shape and includes a request_id. The same value is returned in X-Request-Id for support correlation. Validation errors also include a details array with a param or path and a message.

json
{
  "error": {
    "code": "validation_error",
    "message": "Check the request and try again.",
    "doc_url": "https://sprachpass.com/docs/api/errors#validation_error",
    "details": [{ "param": "board", "message": "Invalid option" }]
  },
  "request_id": "req_0123456789abcdef0123456789abcdef"
}

Error codes

missing_api_key

The Authorization header is absent. Add the client key and retry.

invalid_api_key

The credential is malformed or does not match a known key. Check the server configuration before retrying.

api_key_revoked

The matching credential was revoked. Replace it with an active key.

api_client_suspended

The client account is suspended. Contact Sprachpass before retrying.

not_found

The path or eligible item was not found. An ineligible item is also hidden with this response.

method_not_allowed

The endpoint does not support the method. Read the Allow response header.

validation_error

A parameter, body field, option id, prompt id, or field id is invalid. Read the details array.

rate_limit_exceeded

The client used its minute allowance. Wait for Retry-After before resuming.

internal_error

The request failed closed. Retry with backoff and keep the request details for support.

insufficient_scope

The credential is valid but cannot use this operation. An API key never reads learner practice data. Use a credential of the right kind.

practice_unavailable

Learner practice data could not be read, so no allowance is shown. Retry with backoff.

target_not_available

Practice is not open for this exam, level and skill right now. Use a target from GET /api/v1/access.

part_not_offered

This exam part cannot be practised on its own right now. Start the run without board_part_id.

practice_limit_reached

The learner used today's free run for this skill. The error shows resets_at and account_url, the learner's account page. The hosted MCP server leaves account_url out.

idempotency_conflict

This Idempotency-Key was already used for a different start. Use a new key for a new request, and the same key only for a retry.

session_started_elsewhere

A run for this skill is already open on the Sprachpass website. The learner finishes it there first; continue_url opens it. No daily run was used.

answer_final

This question already has a saved answer, or the run is finished. A saved answer cannot be changed. Send the same answer with the same key to read the saved result again.

item_version_mismatch

The answer could not be matched to the question version that was issued. This is a server fault, not a learner mistake. Read the session again and retry.

session_incomplete

The run cannot be finished yet because some questions have no saved answer. Answer every question first.

Safe retries

Retry 429, 500, and 503 responses with bounded exponential backoff. Do not retry a 401, 403, 404, 405, or 422 response without changing the request or credential.