Responses
API success and error responses
Our success and error responses have a consistent structure so that integrations to endpoints only have a binary path. The response is either successful, or there was an error.
Our success responses will always be in the following format (unless explicitly documented differently on certain calls).
Key | Type |
header | 200 OK |
status | String (success) |
data | Array / Object / String (The endpoint response payload) |
hash | String (A unique hash of the data response) |
response_time | Float (How long the API call took in seconds) |
Our recommended implementation of a response is shown in the following example (done in basic syntax for simplicity):
if (response.status == "success"){
// Do something with the data
let data = response.data;
}
else{
// Something went wrong.
console.log(response.message);
}
Our error responses will always contain a "message" and "status". Header errors follow standard set at https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
Key | Type |
header | 400 - 500 |
status | String (error) |
message | String (A message detailing the error) |
Last modified 1yr ago