API responses

API responses indicate if an API request is successful or not. A response consists of an HTTP response status code and a response body that indicates a successful response or an error response.

Hence, an API response consists of the combination of the following:

HTTP response status code + response body (success response or error response)

HTTP response status codes indicate if your request was successful or not. They are of the following types:

DescriptionStatus code
Informational response100 - 199
Successful response200 - 299
Redirection message300 - 399
Client error response400 - 499
Server error response500 - 599

Many requests return a response body in JSON format. The responses can be of the following types:

If your API request has gone through successfully, you get the success response with the required parameters, usually in JSON format.

For example, the success response for the /token endpoint is:

{
"access_token": "...",
"token_type": "bearer",
"expires_in": "...",
"scope": "...",
"refresh_token": "..."
}
JSON

If your API request doesn't go through successfully, you get an error response that consists of the following:

  • error HTTP status code
  • error code (usually carries different info than status code)
  • error message

For example, an error response can look like:

400,
{
'errorCode':'INVALID_QUERY_PARAM',
‘message’:'query param x must be either 1 or 2'
}
JSON