When a request fails, the response explains why:

{
  "success": false,
  "data": {
    "message": "Provided token is invalid",
    "errorCode": "Unauthorized.TokenNotValid",
    "errorDetails": {}
  }
}

Use errorCode in your code, because message is written for people and may change.

Status codes

Status Meaning What to do
200 Success.
400 The request is not valid, or the endpoint doesn’t exist. Check the body against the API reference.
401 The API key is missing, wrong, expired or disabled. Check the key, or create a new one.
402 You have reached a limit of your plan. Upgrade your plan or remove some records.
403 The key doesn’t have the permission this endpoint needs. Add the permission to your key.
404 The record doesn’t exist, or it belongs to another organization. Check the ID.
500 The request couldn’t be completed. Check that every field name you sent exists, then retry.

See Common errors for specific messages and fixes.