Error Reponses
We use conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.), and codes in the 5xx range indicate an error with our servers (these are rare).
Unauthorized Request
If the token or credentials are invalid, or code is expired, or the user is not authorized. Status 401 Unauthorized
.
Example
{
"errors": [
{
"error_type": "UNAUTHORIZED",
"error_message": "Invalid token."
},
{
"error_type": "ACCESS_DENIED",
"error_message": "Wrong credentials provided."
},
{
"error_type": "EXPIRED_CODE_GRANT",
"error_message": "The authorization code grant has expired."
},
{
"error_type": "INVALID_REFRESH_TOKEN",
"error_message": "The provided refresh token is invalid or was revoked."
}
]
}
Resource Not Found
If the resource does not exist in RD Station Status 404 not found
.
Example
{
"errors": {
"error_type": "RESOURCE_NOT_FOUND",
"error_message": "Lead not found."
}
}
Invalid Content-Type Header
If the Content-Type is not set properly Status 415 Unsupported Media Type
.
Example
{
"errors": {
"error_type": "UNSUPPORTED_MEDIA_TYPE",
"error_message": "The payload is in a format not supported by this method on the target resource."
}
}
Malformed Body Request
If the body request is malformed accordingly to the Content-Type header Status 400 Bad Request
.
Example
{
"errors": {
"error_type": "BAD_REQUEST",
"error_message": "Could not parse the body of the request according to the provided Content-Type."
}
}
Invalid format
If an invalid format for an attribute is sent Status 400 Bad Request
.
Example
{
"errors": {
"email": [
{
"error_type": "CANNOT_BE_NULL",
"error_message": "email cannot be null."
}
],
"linkedin": [
{
"error_type": "INVALID_FORMAT",
"error_message": "linkedin must use only letters, numbers, '.', '-' and '_'"
}
],
"name" : [
{ "error_type": "CANNOT_BE_BLANK", "error_message": "Can not be blank" }
]
}
}
Uppercase Tags
If the tags contain uppercase characters:
Example
{
"errors": {
"tags": [
{
"error_type": "VALUES_MUST_BE_LOWERCASE",
"error_message": "must not contain capital letters"
}
]
}
}
Invalid data type
If an invalid data type is sent Status 422 Unprocessable Entity
.
Example
{
"errors": {
"name": [
{
"error_type": "MUST_BE_STRING",
"error_message": "Name must be string."
}
]
}
}
Read only fields
When trying to update a read only attribute Status 400 Bad Request
.
Example
{
"errors": {
"error_type": "INVALID_FIELDS",
"error_message": "Payload contains fields that cannot be modified: (available_for_mailing)"
}
}
Inexistent fields
When trying to update an attribute that does not exist Status 400 Bad Request
.
Example
{
"errors": {
"error_type": "INVALID_FIELDS",
"error_message": "Payload contains fields that do not exist: (attr)"
}
}
Conflicting field
When using the UPSERT like PATCH endpoint, and a field that was used to identify the lead appears again in the request payload Status 400 Bad Request
Example
{
"errors": {
"error_type": "CONFLICTING_FIELD",
"error_message": "The payload contains an attribute that was used to identify the lead"
}
}
Email already in use
When using the PATCH by uuid Contact endpoint and an email that already is used Status 400 Bad Request
.
Example
{
"errors": {
"error_type": "EMAIL_ALREADY_IN_USE",
"error_message": "email already in use"
}
}
HTTP status code
List of possible HTTP status codes used in our APIs to represent the errors generically:
400 (Bad request) | Malformed body request |
401 (Unauthorized) | Unauthorized request |
404 (Not found) | Resource Not Found |
415 (Unsupported Media Type) | Invalid Content-Type header |
422 (Unprocessable Entity) | Invalid Data type |
Error types
The possible error types that will give more detailed feedback for invalid requests:
Request related error types
Error type | Message |
---|---|
UNAUTHORIZED | Invalid token. |
BAD_REQUEST | Could not parse the body of the request according to the provided Content-Type. |
UNSUPPORTED_MEDIA_TYPE | The payload is in a format not supported by this method on the target resource. |
RESOURCE_NOT_FOUND | The resource couldn't be found. |
Validation related error types
Error type | Message |
---|---|
CANNOT_BE_NULL | Cannot be null |
CANNOT_BE_BLANK | Can not be blank |
INVALID | It is not valid |
TAKEN | Already in use |
TOO_SHORT | Is too short (minimum 0 characters) |
TOO_LONG | Is too long (maximum 0 characters) |
EXCLUSION | Already in use |
INCLUSION | It is not included in the list |