HTTP status code reference
POST /generate
GET /jobs/
Handling errors programmatically
400 — Invalid input
A400 response means the API rejected your request before any job was created. Check that:
- The request body is valid JSON.
- The
promptfield is present and non-empty. - The
Content-Type: application/jsonheader is set.
400 response body example
401 — Unauthorized
Every request to the Whisul API must include your API key in theAuthorization header.
Correct header format
401, confirm that:
- You’re not sending the key as a query parameter or in the request body.
- The API key has not been revoked. Regenerate it in your dashboard if needed.
429 — Rate limit exceeded
When you receive a429, wait before retrying. A simple backoff strategy:
- On first
429: wait 5 seconds, then retry. - On second
429: wait 10 seconds, then retry. - On each subsequent
429: double the wait time, up to a maximum of 60 seconds.
GET /jobs/{job_id} more frequently than once every 5–10 seconds, which helps prevent hitting rate limits during job monitoring.
404 — Job not found
A404 from GET /jobs/{job_id} means the server has no record of that job. The most common causes are:
- A typo in the
job_id. - Using a
job_idfrom a different environment or account. - The job has expired from the system after an extended period.
job_id or poll_url returned directly from POST /generate.
500 — Server error
A500 indicates an unexpected failure on Whisul’s infrastructure. These are typically transient. Retry the same request after 10–30 seconds. If 500 errors persist across multiple retries, check the Whisul status page or contact support.
Handling failed jobs
A job with"status": "failed" is distinct from an HTTP error response. The HTTP status code will be 200 (the request itself succeeded), but the job inside could not complete.
Failed job response
"status": "failed":
- Read the
errorfield for a description of what went wrong. - Retry by submitting a new
POST /generaterequest — you cannot resume a failed job. - Consider adjusting your prompt if the failure may be related to the input.