Skip to main content

Errors

When integrating with the Mambo API, understanding error handling is essential for developing robust applications. This guide explains the types of errors you might encounter, how to interpret them, and best practices for handling them in your code.

Responses

Mambo API error responses can be broken down into three types:

  • General errors: are the bulk of the error types returned by the API. They include an object not found all the way to an unexpected server error.
  • Validation errors: are the most common type of error, and are raised by invalid request data or parameters.
  • OAuth2 errors: are raised when there is an error during API authentication.

General error example

JSON

Validation error example

JSON

OAuth2 error example

In order to conform to the OAuth 2 specification, the response below is not wrapped in an error property and uses snake case for the property names. The type information is added in order to align with the standard Mambo error responses.

Note: the invalid_token error will be returned using the old error format on versions prior to 8.0.0.

JSON

HTTP status codes

Mambo uses standard HTTP status codes to indicate the success or failure of a request.

More information on HTTP status codes can be found in the specifications.

Status codeNameDescription
200OKSuccess!
400Bad requestThe request is invalid. This is the status used when returning ValidationExceptions and other exceptions related to incorrectly formed requests.
401UnauthorisedThere was a problem authenticating the request. Check that the OAuth signature is being correctly applied and / or that your API keys are correct.
403ForbiddenThe request is understood but has been refused by the API. This is normally associated to a lack of permissions.
404Not foundThe URI requested is invalid or the resource requested, such as a user, does not exist.
405Method not allowedThe method specified is not allowed for the URI requested e.g. using POST on a GET resource.
406Not acceptableThe accept headers specify a format that is not supported by the URI resource requested.
409ConflictThe request could not be completed due to a conflict with the current state of the resource. For example, duplicate user UUIDs could generate this status code.
415Unsupported media typeThe server is refusing to service the request because the entity of the request is in a format not supported by the requested URI resource for the requested method.
429Too many requestsThe user has sent too many requests in a given amount of time.
500Internal server errorOops! Something broke down. Please get in touch and let us know if you come across this and we'll get our engineers to investigate immediately.
503Service unavailableThe API is running but appears to be overloaded and can't complete your response.

Error types

In addition to the status codes above, every error response will contain the type of error. The most common error types are grouped below for easier reference. For API specific errors, please see the API Explorer.

Validation and request (400)

TypeDescription
ValidationExceptionThe request is invalid or has invalid parameters.
BadRequestExceptionThe request is invalid for reasons other than validation.
ImpossibleDeleteExceptionThe requested resource cannot be deleted due to dependencies.
InvalidIdempotencyKeyExceptionThe format of the idempotency key is not valid.
ImageExceptionThere was a problem processing the image.
VersionExceptionThere was a problem processing the request's version information.
VersionParseExceptionThere was a problem parsing the request's version number.

Authentication (401, 403)

TypeDescriptionStatus code
OAuth2ExceptionThere was a problem with the OAuth2 authentication flow. Check the error code and description for more information.400 / 401 / 403
UnauthorizedExceptionThe request cannot be authenticated and is not a standard OAuth2 error.401
ForbiddenExceptionThe request is understood but has been refused usually due to a lack of permissions.403

Resource (404)

TypeDescription
KeyNotFoundExceptionThe requested resource could not be found.
UserNotFoundExceptionThe requested user could not be found.
TagNotFoundExceptionThe requested tag could not be found.
ApiNotFoundExceptionThe requested API endpoint could not be found.

Method and format (405, 406, 415)

TypeDescriptionStatus code
MethodNotAllowedExceptionThe method specified is not allowed for the URI requested e.g. using POST on a GET resource.405
NotAcceptableExceptionThe accept headers specify a format that is not supported by the resource requested.406
UnknownMediaTypeExceptionThe media type (e.g. XML) is not supported by the resource requested.415

Conflict (409)

TypeDescription
DuplicateExceptionThe resource you are trying to save already exists. For example, trying to save two users with the same UUID.
IdempotencyKeyAlreadyUsedExceptionThe idempotency key was previously used with different API, body or query parameters.
IdempotencyRequestInProgressExceptionA request with the same idempotency key is already in progress.

Server (500, 503)

TypeDescriptionStatus code
InternalServerExceptionThe server encountered an unidentified error processing the request.500
PersistenceExceptionThe database service has a problem and can't complete your request.503
StorageExceptionThe storage service has a problem and can't complete your request.503
ServiceUnavailableExceptionThe server or dependent service is overloaded and can't complete your request.503

SDK error handling

When working with the Mambo SDK, you should implement appropriate error handling to gracefully manage different error scenarios. The code sample below shows you how to handle exceptions using the different SDKs.

Java
.NET
PHP

Troubleshooting tips

When dealing with API errors, consider the following:

  1. For authentication errors, verify your API keys and OAuth implementation
  2. For validation errors, carefully review the params array for specific field issues
  3. For 429 errors, implement backoff strategies and respect rate limits
  4. For 5xx errors, implement retry logic with exponential backoff