SwishXKnowledge Base
API Reference

Errors

Error shape, types, and codes.

Errors are returned as a JSON body with a single error object, alongside a non-2xx HTTP status:

{
  "error": {
    "type": "invalid_request_error",
    "code": "missing_parameter",
    "message": "Missing required parameter: 'prompt'.",
    "param": "prompt"
  }
}
FieldDescription
typeBroad error category — see below.
codeSpecific, stable machine-readable identifier. Safe to branch on.
messageHuman-readable explanation. May change wording; don't parse it.
paramPresent on invalid_request_error — which request field caused the error.
stagePresent on compliance_error — which pipeline stage rejected the request.

Error types

typeHTTP statusMeaning
invalid_request_error400Malformed or missing parameters.
authentication_error401Missing, invalid, or revoked API key.
insufficient_balance402Account balance can't cover the request.
compliance_error422Rejected by claim-linking or output verification — see Compliance & verification.
rate_limit_error429Too many requests — see Rate limits.
api_error500Something went wrong on our end. Safe to retry with backoff.

Retrying

api_error and rate_limit_error are safe to retry with exponential backoff. invalid_request_error, authentication_error, insufficient_balance, and compliance_error won't succeed on retry without changing the request itself.

Idempotency

POST /v1/videos and POST /v1/images accept an optional Idempotency-Key header. Retrying the same request with the same key returns the original generation instead of creating a duplicate — safe to always send one on retries.

On this page