Errors
Every error response has the same shape. Branch on error.code; it never
changes. The message says what is wrong and how to fix it, and is written
so an assistant can correct its own request. doc_url links to the code's
section on this page.
{
"error": {
"code": "validation_failed",
"message": "1 problem in the request. Fix it and send it again.",
"details": [
{
"path": "questions[0].correct",
"question_id": "capital",
"code": "out_of_range",
"message": "quiz 'capital': correct is 4 but there are 4 options (valid: 0–3). correct is a 0-based index into options."
}
],
"doc_url": "https://sparka.io/docs/errors#validation_failed",
"request_id": "req_01K7Q3W8Z9G5H2M4N6P8R0S2T4"
}
}
Messages below are templates: the parts in italics are filled in for each
request. When a response has a Retry-After header, wait that many seconds
before trying again.
The error object
| Field | Type | Description |
|---|---|---|
code required | string | Stable machine-readable code; the canonical list with HTTP statuses is contracts/errors.json. One of invalid_json, validation_failed, invalid_request, missing_credentials, invalid_credentials, not_signed_in, quota_exceeded, wrong_credential_type, secret_key_in_browser, csrf_failed, recent_auth_required, session_full, nickname_rejected, presentation_not_found, session_not_found, pin_not_found, question_not_found, key_not_found, grant_not_found, oauth_request_not_found, route_not_found, method_not_allowed, session_ended, idempotency_conflict, version_conflict, payload_too_large, rate_limited, internal_error, no_live_capacity, service_unavailable. |
message required | string | One or two sentences saying what is wrong, the valid values, and the fix. |
details | array of object | Present for validation errors; every problem is reported at once. |
details[].path required | string | Example questions[2].correct. |
details[].question_id | string | Pattern ^[a-z][a-z0-9_-]{0,31}$. |
details[].code required | string | Example out_of_range. |
details[].message required | string | |
doc_url required | string | Format uri. Example https://sparka.io/docs/errors#validation_failed. |
request_id required | string | Pattern ^req_[0-9A-HJKMNP-TV-Z]{26}$. |
limit | string | One of sessions_per_month, presentations, concurrent_live_sessions, keys. |
used | integer | |
max | integer | |
resets_at | string | null | Format date-time. |
upgrade_url | string | Format uri. |
retry_after_s | integer | At least 0. |
400 Bad Request
invalid_json
HTTP 400 · Fix the request before retrying
The request body is not valid JSON ({reason}). Send a JSON object with Content-Type: application/json.
validation_failed
HTTP 400 · Fix the request before retrying
{count} problem(s) in the request. Fix them and send it again.
Extra fields: details.
invalid_request
HTTP 400 · Fix the request before retrying
{reason}
401 Unauthorized
missing_credentials
HTTP 401 · Fix the request before retrying
This endpoint needs credentials. Send Authorization: Bearer {accepted}.
invalid_credentials
HTTP 401 · Fix the request before retrying
This key or token is unknown or has been revoked. Create a new key at https://sparka.io/account.
not_signed_in
HTTP 401 · Fix the request before retrying
You are not signed in. Sign in at https://sparka.io/sign-in and try again.
402 Payment Required
quota_exceeded
HTTP 402 · Fix the request before retrying
This account has reached its {plan} plan limit for {limit} ({used} of {max}). {reset_or_upgrade}
Extra fields: limit, used, max, resets_at, upgrade_url.
Limits: sessions_per_month, presentations, concurrent_live_sessions, keys.
403 Forbidden
wrong_credential_type
HTTP 403 · Fix the request before retrying
This endpoint does not accept a {given}. It accepts: {accepted}.
secret_key_in_browser
HTTP 403 · Fix the request before retrying
Secret keys must never be used in a deck or web page. Use the presentation ID to start sessions; see https://sparka.io/docs/decks
csrf_failed
HTTP 403 · Fix the request before retrying
This request could not be verified. Reload the page and try again.
recent_auth_required
HTTP 403 · Fix the request before retrying
For your security, sign in again (within the last 15 minutes) before doing this.
session_full
HTTP 403 · Fix the request before retrying
This session is full. Ask the presenter for help.
nickname_rejected
HTTP 403 · Fix the request before retrying
Please choose a different nickname.
404 Not Found
presentation_not_found
HTTP 404 · Fix the request before retrying
No presentation {presentation_id} for this credential. Check the ID, or list presentations with GET /v1/presentations.
session_not_found
HTTP 404 · Fix the request before retrying
No session {session_id} for this credential.
pin_not_found
HTTP 404 · Fix the request before retrying
No live session with PIN {pin}. Check the code on the screen.
question_not_found
HTTP 404 · Fix the request before retrying
No question '{question_id}' in this session. Valid ids: {question_ids}.
key_not_found
HTTP 404 · Fix the request before retrying
No key {key_id} on this account. List keys with GET /v1/keys.
grant_not_found
HTTP 404 · Fix the request before retrying
No connected app {grant_id} on this account. Reload the page to see your connected apps.
oauth_request_not_found
HTTP 404 · Fix the request before retrying
This sign-in request has expired or does not exist. Start again from your app.
route_not_found
HTTP 404 · Fix the request before retrying
No route {method} {path}. Did you mean {suggestion}?
405 Method Not Allowed
method_not_allowed
HTTP 405 · Fix the request before retrying
{method} is not allowed on {path}. Allowed: {allowed}.
Headers: Allow.
409 Conflict
session_ended
HTTP 409 · Fix the request before retrying
Session {session_id} has ended. Start a new session to run the presentation again.
idempotency_conflict
HTTP 409 · Fix the request before retrying
Idempotency-Key '{key}' was already used with a different body. Use a new key for a different request.
412 Precondition Failed
version_conflict
HTTP 412 · Fix the request before retrying
The presentation is at version {current}, not {given}. Fetch it again, reapply your change, and resend.
413 Payload Too Large
payload_too_large
HTTP 413 · Fix the request before retrying
The request body is {size} bytes; the limit is {limit}.
429 Too Many Requests
rate_limited
HTTP 429 · Safe to retry later
Too many requests. Retry after {retry_after_s} s.
Extra fields: retry_after_s.
Headers: Retry-After.
500 Internal Server Error
internal_error
HTTP 500 · Safe to retry later
Something went wrong on our side. Retry once; if it keeps failing, contact hi@sparka.io with request id {request_id}.
503 Service Unavailable
no_live_capacity
HTTP 503 · Safe to retry later
No live capacity is available right now. Retry after {retry_after_s} s.
Extra fields: retry_after_s.
Headers: Retry-After.
Live connection close codes
A deck holds a WebSocket to its live session. When it closes, the close code says what to do next.
| Code | Name | What to do |
|---|---|---|
| 1000 | normal | Reconnect with backoff |
| 1001 | going_away | Reconnect with backoff |
| 1006 | abnormal | Reconnect with backoff |
| 1011 | internal | Reconnect with backoff |
| 4001 | auth_failed | Stop; do not reconnect |
| 4002 | protocol | Stop; do not reconnect |
| 4003 | too_many_presenters | Stop; do not reconnect |
| 4004 | session_not_found | Stop; do not reconnect |
| 4008 | heartbeat_timeout | Reconnect with backoff |
| 4009 | replaced | Stop; do not reconnect |
| 4010 | moved | Reconnect right away |
| 4013 | unavailable | Reconnect right away |
| 4029 | slow_consumer | Reconnect with backoff |
| 4100 | session_ended | Stop; do not reconnect |