Errors
The response format, and the status codes your code should handle.
Response format
Every response has a success flag. Successful responses put the result in data:
{
"success": true,
"data": { "id": "1152921504606846977", "firstName": "Priya" }
}Errors have success: false, the HTTP status and a message:
{
"success": false,
"statusCode": 404,
"error": "Contact not found"
}Responses can also include fields such as timestamp, path and method. Some errors add an errorCode that your code can check.
Status codes
| Status | Meaning |
|---|---|
400 | The request is invalid, for example a required field is missing. |
401 | The API key is missing or invalid. |
402 | Your plan doesn't include this feature. The body has "errorCode": "FEATURE_NOT_ENABLED". |
403 | The key isn't allowed to do this. |
404 | The record doesn't exist. |
500 | Something went wrong on our side. Try again later. |
Ids are strings
Record ids are 64-bit numbers, which is more than JavaScript numbers can hold exactly, so the API always sends them as strings. Store and compare them as strings.