Skip to main content
When a request fails, the Sevalla API returns a 4xx or 5xx status code and a JSON body with three fields: message, status and data. The status code tells you what kind of error it is, and message says what went wrong.

Error body

string
What went wrong, such as Application not found or This API key is missing the APP:UPDATE permission. Grant it to the key or use a key that has it.
integer
The HTTP status code, the same as the response’s.
object
Details, when there are any. Usually empty ({}). On most 500 responses, it has code, the request ID, and message, which asks you to contact support with that code. On some 400 responses, it has issues: see Schema validation errors.
A path or method that doesn’t exist returns 404 with a different body:

Status codes

Successful requests return 200 or 201 with the object or list, 202 when the work continues in the background (see Long-running operations), or 204 with no body. Errors use these codes:

Schema validation errors

A body, query parameter or path parameter that doesn’t match the operation’s schema returns 400 with the message Request doesn't match the schema. The API checks the schema before the API key, so a malformed request gets 400 even without a valid key. On operations whose reference page doesn’t list a 400 response, such as Get application, data.issues describes each problem:
On operations that list a 400 response, such as Create application, data is empty. Compare the request with the operation’s body and parameters in this reference.

Request IDs

Every response has an x-request-id header. If you send your own x-request-id header, the response carries the same value, so you can match your logs with Sevalla’s. On most 500 responses, data.code holds the same ID, and data.message asks you to contact support with it. Include the request ID when you contact support.

Handle errors in code

Check the status code first, then read message. This helper throws an error that carries both, with the request ID:
sevalla.ts

Retry safely

  • 4xx errors fail again until you change the request or the state it depends on. Don’t retry them unchanged, except 429.
  • 429: wait the number of seconds in retry-after, then retry. See Handle 429 responses.
  • 500: retry GET requests with exponential backoff. Before you retry a write, check whether it took effect, for example by listing the application’s deployments before you trigger another one.