Data and Errors
Standard success and error formats
When interacting with the Drift API, we'll follow some standardized conventions for success and error responses.
Success 👍
Happiness, money, fame, and more? The Drift API will return a top-level data field for successful responses. Sometimes we'll return metadata fields like "pagination" on the top-level as well, but generally the objects you care about will be inside data.
{
"data": {
...
}
}
Errors 👎
Whether we've made a mistake or you've made a mistake, any errors should be inside a top-level error field. This field has a type which is one of several defined types and a message which is human readable.
{
"error": {
"type": some_error,
"message": "Oh no!"
}
}
Here are the errors you can expect to receive from the Drift API:
| Type | HTTP code | Description |
|---|---|---|
| validation_error | 400 | One or more fields are invalid |
| authentication_error | 403 | Missing proper authorization |
| not_found | 404 | The requested resource was not found |
| internal_error | 500 | Something went wrong in our system |
| rate_limit | 429 | You have maxed your number of API calls for the provided time window |
Updated over 4 years ago
