Skip to content

Errors and Rate Limits

The Crewsum customer API uses HTTP status codes to show whether a request succeeded. Error responses have a JSON body with a message that describes the problem.

StatusMeaning
200 OKThe request succeeded.
201 CreatedThe request succeeded. Some create endpoints use this status. Each endpoint page gives its success status.
400 Bad RequestThe request is not correct, for example a required value is missing, or the body is not valid JSON.
404 Not FoundThe record does not exist, or the URL does not match an endpoint.
409 ConflictThe request conflicts with the current data. Only some endpoints use this status.
429 Too Many RequestsYou sent too many requests. See Rate limits.
500 Internal Server ErrorAuthentication failed, or the request could not be completed. Read the message.

Each endpoint page lists the errors that the endpoint returns.

Error responses use one of two JSON shapes.

Errors from an endpoint have a message:

{
"message": "Client not found: client-doesnotexist"
}

Some error responses also include an internalError field. It is for Crewsum diagnostics. Do not rely on its contents.

Errors that the API server returns outside an endpoint have statusCode, error, and message. Authentication errors, rate limit errors, request body parse errors, unknown URLs, and unexpected server errors use this shape:

{
"statusCode": 500,
"error": "Internal Server Error",
"message": "Insufficient scopes, this endpoint requires the following scopes: projects:read"
}

Some of these errors also include a code, such as FST_ERR_CTP_INVALID_JSON_BODY.

To handle both shapes, check the HTTP status, and then read message.

All of these errors currently return status 500 with the request error shape.

messageCauseWhat to do
The x-api-key header missing or in an incorrect formatThe x-api-key header is missing.Send the key in the x-api-key header. A Bearer token in Authorization is not accepted.
The provided api key was not foundThe key does not exist, was deleted, or is not complete.Check that you send the full key. If the key was deleted, generate a new one.
The provided api key could not be validatedThe key has a valid format but the secret part is wrong.Check that you copied the full key correctly.
Insufficient scopes, this endpoint requires the following scopes: <scope>The key does not have the scope that the endpoint requires.Generate a key that has this scope. See Scopes.
An internal error has occurred. please try again laterCrewsum could not check the key or the subscription.Retry later. If it continues, contact Crewsum.

The API requires an active Crewsum subscription. A trial counts as active.

messageCause
An active Crewsum subscription was not found.Your Crewsum account has no subscription.
Your subscription is currently inactive, please resume your subscription to use this api.Your Crewsum subscription is inactive.

Both return status 500. A Tenant Admin can manage the subscription in the Crewsum app.

StatusBodyCause
400{"statusCode": 400, "code": "FST_ERR_CTP_INVALID_JSON_BODY", "error": "Bad Request", "message": "Body is not valid JSON but content-type is set to 'application/json'"}The body is not valid JSON.
400{"statusCode": 400, "code": "FST_ERR_CTP_EMPTY_JSON_BODY", "error": "Bad Request", "message": "Body cannot be empty when content-type is set to 'application/json'"}Content-Type: application/json is set, but the body is empty.
400{"message": "Error parsing body"}The body does not match the schema. Only the contacts endpoints check the body schema.
500VariesA required field is missing or has the wrong type, or the Content-Type header is missing.

Most endpoints do not check the request body against a schema before they process it. A missing or wrong field often returns 500 instead of 400, and an unexpected value can be saved as sent. Send the fields and types shown on each endpoint page, and always set Content-Type: application/json.

The API allows 1,000 requests per minute for each IP address. The limit applies to all endpoints together.

Responses to requests that pass authentication include these headers:

HeaderDescription
x-ratelimit-limitThe number of requests allowed in each one-minute window (1000).
x-ratelimit-remainingThe number of requests left in the current window.
x-ratelimit-resetThe number of seconds until the window resets.

When you go over the limit, the API returns 429 and a retry-after header with the number of seconds to wait:

HTTP/1.1 429 Too Many Requests
x-ratelimit-limit: 1000
x-ratelimit-remaining: 0
x-ratelimit-reset: 23
retry-after: 23
content-type: application/json; charset=utf-8
{"statusCode":429,"error":"Too Many Requests","message":"Rate limit exceeded, retry in 23 seconds"}
  • 429: wait for the number of seconds in retry-after, and then send the request again.
  • 500 with an authentication, scope, or subscription message: do not retry. Fix the key, its scopes, or the subscription first.
  • Other 500 errors: a retry can succeed. Before you retry a POST, check whether the first request created the record, so that you do not create it twice.
  • 400 and 404: do not retry without changing the request.
  • Log the status and message of each failed request. They help Crewsum support find the problem.