Errors
Error response format and common status codes of the QA Sphere Public API
A request that fails returns a 4XX or 5XX status code with a JSON body of this shape:
{
message: string // Why the request failed
}Every endpoint uses this format, including validation errors. The message is meant for people: show or log it, but branch on the status code, as messages may be reworded.
A path that doesn't exist returns 404 Not Found, and so does one with an ID that is malformed or matches nothing, such as /project/BD/run/abc. A request body or query string that is malformed or fails validation returns 400 Bad Request with a message starting invalid request:. It names each field by its path in the request, the way you sent it:
{
"message": "invalid request: title is required; steps[0].description must be a string, not a number"
}A 502 Bad Gateway, 503 Service Unavailable or 504 Gateway Timeout can also come from the infrastructure in front of the API, such as a gateway timeout, and then may not have a JSON body.
Status Codes
These can come from any endpoint. Endpoint pages list only the cases specific to them, along with any other status code they use.
| Status Code | Meaning | Common causes |
|---|---|---|
| 400 | Bad Request | A malformed JSON body; a missing or invalid field; a test case or other item in the body that can't be found in the project; too many items in a bulk request |
| 401 | Unauthorized | A missing, malformed or revoked API key, or an expired or revoked OAuth access token. See Authentication |
| 403 | Forbidden | Your role can't perform the action; a write to an archived project; a suspended workspace or user; an IP address outside the allowlist; a restricted key; an OAuth token granted for another endpoint |
| 404 | Not Found | The path, or the project or an item in it, doesn't exist or isn't visible to you. Projects you aren't a member of return 404 Not Found, not 403 Forbidden |
| 405 | Method Not Allowed | The path exists, but not for this HTTP method. The Allow header lists the methods it takes |
| 409 | Conflict | A duplicate, such as a folder title already taken among its siblings; or a state that blocks the request, such as restoring a test case before its folder |
| 413 | Payload Too Large | A request body over the endpoint's size limit, such as a file larger than the upload limit |
| 429 | Too Many Requests | The rate limit was exceeded. See Rate Limiting |
| 500 | Internal Server Error | An unexpected error. Retry later with backoff; contact support if it persists |
An ID in the request body that matches nothing in the project returns 400 Bad Request; only an ID in the path returns 404 Not Found.
Roles
Each workspace user has a role, and an API key or OAuth authorization acts with the role of the user who created or approved it:
- Viewer can read.
- Test Runner can also work with test runs, test plans, milestones and results, and restore them from the trash.
- User can also change test cases, folders and the other parts of the test repository.
- Admin and Owner can also manage projects and workspace settings.
A request beyond your role returns 403 Forbidden.
Retrying
429 Too Many Requests: wait for theRetry-Afterheader, then retry.5XX: retry with exponential backoff. A write that failed with a5XXmay still have been applied, so check before repeating it.- Other
4XX: don't retry the same request; fix it first.