Errors
In this guide, we will talk about what happens when something goes wrong while you work with the API. Let's look at some status codes and error types you might encounter.
You can tell if your request was successful by checking the status code when receiving an API response. If a response comes back unsuccessful, you can use the error type and error message to figure out what has gone wrong.
Status codes
Here is a list of the different categories of status codes returned by the Collctiv API. Use these to understand if a request was successful.
- Name
200
- Description
Everything worked as expected.
- Name
400
- Description
The request was unacceptable, often due to missing a required parameter.
- Name
401
- Description
No valid API key provided.
- Name
402
- Description
The parameters were valid but the request failed.
- Name
403
- Description
The API key doesn't have permissions to perform the request.
- Name
404
- Description
The requested resource doesn't exist.
- Name
429
- Description
Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.
- Name
50x
- Description
Something went wrong on Collctiv's end. (These are rare.)
Error types
Whenever a request is unsuccessful, the Collctiv API will return an error response with an error type and message. You can use this information to understand better what has gone wrong and how to fix it.
Here is a list of the two error types supported by the Collctiv API — use these to understand what you have done wrong.
- Name
api_error
- Description
This means that there is an error on Collctiv's servers.
- Name
invalid_request
- Description
This means that there is an error on the client.
Error response
{
"type": "invalid_request",
"code": 401,
"message": "Invalid API key"
}