Skip to main content
Submission-error update — pending production rollout (2026-09-30). The new POST 422 response, top-level error task_id, and task-consistent retry guidance below describe the upcoming contract. Until rollout is confirmed, submission rejections can still return 502 upstream_provider_error without a task reference, even when the task has failed and been refunded. A proxy may replace the JSON body with HTML. Check the signed-in task dashboard or contact support with the request time and X-Request-Id when available; do not blindly create another task. GET task classification and successful 202 responses are unchanged.

Error response format

All error responses follow this structure:
Branch on error_code, not by parsing message. Every public API response also includes an X-Request-Id header. Record that identifier with your error logs and include it when contacting support. Common stable values include:

Failed tasks

The codes above describe a request that failed. A request can also succeed — POST /api/v1/task returns 202, credits are held, the task is created — and the task fail later. Poll GET /api/v1/task/{task_id} and that failure arrives on the task itself: After the pending production rollout: if the provider refuses submission before POST completes, Sunor may have already created and settled a failed task. The POST error then carries top-level task_id. When the stored error has classifiable text, its error_code, retryable and retry_after_seconds match GET. Content rejection is 422, invalid input 400, provider rate limiting 429, and genuine or unclassified upstream failure 502. Successful submission remains 202 with data.task_id. An empty, unclassifiable stored error remains a generic HTTP 502 with a task reference but no invented retry guidance; GET’s classification fields are null. If settlement is unconfirmed, a 500 can carry the reference without a retryable field or any assertion that credits were refunded. Query the task. An edge may replace a genuine 5xx body; when no reference reaches you, use the signed-in task dashboard or contact support with X-Request-Id and the request time. There is no v1 task-list endpoint.
The same rule applies: branch on error_code and retryable, not on error. error is prose and may be reworded at any time.
After the pending production rollout, when a provider rejects an over-length prompt during submission, the created task’s POST error and GET result will share the same invalid_task_input / retryable: false classification. This response fix does not add new local length validation: input constraints are still determined by the existing preflight and provider checks. Before rollout, POST can still report a generic 502 while GET contains the more specific task-level classification.
An error we have not classified reports upstream_provider_error with retryable: true. We never report invalid_task_input for an unrecognised failure — that would send you to debug a request that was fine.

Retrying correctly

retryable: false means the input must change. Retrying it unchanged consumes a credit hold and a provider round trip each time, and all but never clears — across 180 days, of 634 unchanged resubmissions after a moderation rejection we classify false, exactly one cleared:
Credits are refunded on every failure, whatever the code.

Error codes

400 — Bad Request

The request body is malformed or missing required fields. Common causes:
  • Missing model, task_type, or input in the request body
  • Unknown or unsupported task_type
  • Invalid input parameters for the selected task type

401 — Unauthorized

The API key is missing, invalid, or has been revoked. Common causes:
  • No x-api-key header in the request
  • API key does not exist or has been deleted
  • API key has been disabled

402 — Payment Required

Your account does not have enough available credits to cover the task cost. How to fix: Top up credits in your dashboard.

403 — Forbidden

The authenticated account is not currently allowed to create a task.

404 — Not Found

The requested resource does not exist. Common causes:
  • Invalid task ID
  • Task belongs to a different user

429 — Too Many Requests

You have exceeded the rate limit. How to fix: Wait for the duration in retry_after_seconds (or the Retry-After header) before retrying.

500 — Internal Server Error

An unexpected error occurred on the server. What to do: For read-only requests, retry after a short delay. For POST /api/v1/task, do not automatically submit the same task again when the result is unknown; the current endpoint does not yet accept an Idempotency-Key. If you already received a task_id, poll that task instead.

503 — Service Unavailable

A dependency this endpoint needs (our database) was temporarily unreachable, so the request was not processed and nothing was charged. This is not a problem with your API key — the same key keeps working once the dependency recovers. How to fix: Retry after the number of seconds in retry_after_seconds (or the Retry-After header). Read-only requests can be retried directly. For POST /api/v1/task a 503 means the task was never created, so resubmitting is safe.

502 — Bad Gateway

The upstream AI provider returned an error or is temporarily unavailable. What to do: If the provider failure is explicit, the failed task follows the normal refund path. For an uncertain network or gateway result from POST /api/v1/task, do not blindly create another task. If you already received a task_id, poll that task instead.

Handling errors

Always check the HTTP status code before parsing the body. Follow Retry-After for 429 and 503 responses — a 503 means a dependency of ours was down, not that your key is invalid. Exponential backoff is appropriate for safe/read-only requests. For POST /api/v1/task, an uncertain 5xx or network result should be treated as “create outcome unknown” rather than automatically submitted again. The API does not currently provide Idempotency-Key replay semantics.

Example error handling

Temporary free trial pause (pending rollout)

When the new trial guard is enabled after production acceptance, task creation may return HTTP 403 with error_code: "trial_temporarily_restricted", Retry-After, and a public trial object. A denied request creates no task, freezes no credits and calls no upstream provider. Existing tasks continue their normal settlement. Use GET /api/v1/account/trial-status for the current automatic-check and expiry times. POST to the same path requests an earlier check; the shared account cooldown is 60 seconds. Repeated requests do not extend a pause. A queued check is not a promise of immediate recovery. Confirmed paying accounts and mixed funds are excluded from this trial-only guard; normal account and credit checks still apply.