GOTH LABS.
Guides

Errors

Errors use standard HTTP status codes and a JSON body with a stable code you can branch on.

{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_parameter",
    "message": "duration must be an integer from 3 to 15.",
    "param": "duration"
  }
}

Codes

HTTPCodeMeaning
400invalid_parameterA parameter is missing, unknown or out of range. See param. Nothing is charged.
400invalid_mediaA media URL is not public HTTPS, could not be fetched, or is not a supported file. See param. Nothing is charged.
400invalid_requestThe job was created but rejected when it started (for example, an image that cannot be decoded). The charge was refunded; error.job_id names the failed job.
401invalid_api_keyThe API key is missing, malformed or revoked.
402insufficient_creditsThe account balance does not cover this job. Nothing is created or charged.
403model_not_permittedYour key is not approved for this model.
404not_foundThe job does not exist for your account.
409idempotency_conflictAn Idempotency-Key was reused with a different body.
429rate_limitedToo many requests, running jobs, or jobs this hour. See Rate limits.
500internal_errorSomething failed on our side. Safe to retry.
502generation_failedThe job could not be started. The charge was refunded; error.job_id names the failed job. Safe to retry.
503capacity_unavailablePricing or capacity is temporarily unavailable. Nothing is charged. Retry with backoff.

Retrying safely

Send an Idempotency-Key header (any unique string, up to 64 characters) on POST requests. Retrying with the same key and body returns the original job instead of creating — and charging — a second one. Retry 429, 500, 502 and 503 with exponential backoff; do not retry other 4xx errors without changing the request.