By using this website you implicitly accept our cookies. For more informations read our Cookie policy

Handling errors

Marketcloud uses 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, or a parameter received wrong value, etc.), and codes in the 5xx range indicate an error with Marketcloud's servers (these are rare).

Example error response

{
  "code": 401, 
  "message": "Unauthorized", 
  "type": "Unauthorized"
}

Not every error simply map into a HTTP error, for example when you are registering a new customer to your app, but the email is already taken, simply returning 400 status would not be very useful. For this reason it is important to check the type property in error responses.

In the case of validation errors, the error response has additional fields to help identify what went wrong:

{
  "code": 400, 
  "failedValidator": "required", 
  "invalidPropertyName": "name", 
  "message": "Missing required property 'name'", 
  "type": "BadRequest", 
  "valid": false
}
        

Server responses

Code Type Description
200 OK The request was successful.
400 Bad Request The request could not be understood or was missing required parameters.
401 Unauthorized Authentication failed or user doesn’t have permissions for requested operation.
404 Not Found Resource not found.
405 Method Not Allowed Requested method is not supported for resource.
500 Internal Server Error Something went wrong during your request

Questions?

We're super happy to help with any question you might have! Send us an email, or get in touch with us in our Slack channel !