REST API reference: Errors and troubleshooting
When a request fails, the API answers with an HTTP status and a small JSON object that names the error. Branch on the error code, not on the message.
The error object
Every error body has the same two fields: error, a stable code in lower case with underscores, and message, one English sentence for people. A request for a run that does not exist answers 404 with { "error": "not_found", "message": "The requested resource was not found." }. Codes never change within v1; messages may be reworded.
Status codes
400 and 405 mean the request itself must change, and 401 means the key is missing or no longer valid. 403 and 404 mean the key may not do or see what you asked, so check its access level and project scope. 409 and 422 concern the test or the plan: wait for its current run, try that kind again later, or check what the plan includes. Both 429 codes ask you to wait the Retry-After seconds, and 503 asks you to retry later with a growing pause.
Troubleshooting
If you see invalid_request (400), read the message: it names the rejected parameter, such as limit, status or kind. Fix the value and send the request again; a POST or PATCH body must be valid JSON of at most 16 KiB.
If you see unauthorized (401), check that the Authorization header holds Bearer followed by the full key. If it does, the key was revoked, has expired or belongs to a member who left; create a new key.
If you see forbidden (403), the key's access level is too low for the endpoint: starting runs needs run, and creating, changing or deleting tests needs manage. Deleting a test also needs a key whose creator is an owner or admin; create a key with the right access for that job.
If you see not_found (404), check the id and the path. Then check the key's project scope: resources outside it answer 404 on purpose.
If you see method_not_allowed (405), the path exists but not with that method. The Allow header lists the methods it accepts.
If you see run_in_progress (409), the test already has a queued or running run. Read that run with GET /tests/{id}/runs?limit=1 and wait for it instead of starting another.
If you see kind_unsupported (422), this server cannot run tests of that kind right now, for example because no browser or AI provider is available. Try again later; if it lasts, contact support.
If you see plan_limit_reached (422), the organisation's plan does not allow the change: it already has as many tests as the plan includes, or the plan does not include that kind. Delete a test you no longer need or move to a larger plan. On GET /runs/{id}/artifacts and GET /runs/{id}/files it means the plan does not include run evidence (screenshots, proof shots, video and PDF reports), so the run kept none: the message is Run evidence is not included in your plan. Runs keep their evidence again once the organisation is on a plan that includes it; ZIPs stored earlier still download. On PATCH /tests/{id} it means the body selects notification channels (notificationRouting.scope selected) on a plan that does not include them: the message is Notification channels are not included in your plan., and nothing was saved.
If you see run_limit_reached (429), your organisation has used its hourly run budget or a daily or monthly run quota of its plan; the message says which. Wait the Retry-After seconds (3600 for the hourly budget; for a quota, until 00:00 UTC of the next day or month) before you start the next run.
If you see rate_limited (429), you sent too many requests, or this address had too many failed authentications. Wait the Retry-After seconds, then poll runs no more than once every 10 seconds.
If you see unavailable (503), the database or the file store failed for a moment. Retry after a pause that grows with each attempt, for example 5, 10 and 20 seconds.
Error codes
| Code | Status | When it happens |
|---|---|---|
invalid_request | 400 | A path, filter or limit is invalid, or a JSON body is unreadable, too large or invalid. |
unauthorized | 401 | The key is missing, malformed, unknown, revoked or expired, or its creator is no longer a member. WWW-Authenticate: Bearer realm="Optisway API" |
forbidden | 403 | The key’s access level is too low: a read key tried to start a run, or a key without manage tried to change tests. Also when the key’s creator may not delete tests. |
not_found | 404 | The resource does not exist or is outside the key’s scope. |
method_not_allowed | 405 | The path exists, but not for this method; Allow lists the methods. Allow |
run_in_progress | 409 | The test already has a run in progress. |
kind_unsupported | 422 | This server cannot run the test’s kind right now. |
plan_limit_reached | 422 | The organisation’s plan does not allow it: the test limit is reached, the kind is not included, or (on artifact downloads) run evidence is not included in the plan. |
run_limit_reached | 429 | The organisation has used its hourly run budget or its plan’s daily or monthly run quota; Retry-After says when to try again. Retry-After |
rate_limited | 429 | The key sent too many requests; wait the seconds in Retry-After. Retry-After |
unavailable | 503 | A temporary problem on our side; try again later. |
Example response
invalid_request 400
{
"error": "invalid_request",
"message": "The request is invalid."
}unauthorized 401
{
"error": "unauthorized",
"message": "A valid API key is required in the Authorization header."
}forbidden 403
{
"error": "forbidden",
"message": "This API key can only read; use a key with run access to start runs."
}not_found 404
{
"error": "not_found",
"message": "The requested resource was not found."
}method_not_allowed 405
{
"error": "method_not_allowed",
"message": "This method is not allowed on this path."
}run_in_progress 409
{
"error": "run_in_progress",
"message": "This test already has a queued or running run."
}kind_unsupported 422
{
"error": "kind_unsupported",
"message": "This server cannot run tests of this kind right now."
}plan_limit_reached 422
{
"error": "plan_limit_reached",
"message": "The organisation's plan does not allow this: it has reached its test limit or does not include this kind of test."
}run_limit_reached 429
{
"error": "run_limit_reached",
"message": "The organisation has used its 30 manual and API runs for this hour."
}rate_limited 429
{
"error": "rate_limited",
"message": "Too many requests; retry after the Retry-After interval."
}unavailable 503
{
"error": "unavailable",
"message": "The service is temporarily unavailable; try again shortly."
}