Skip to content

Error Handling

The Cosmic API uses the following error codes:

Error CodeMeaning
200OK - Everything worked as expected.
400Bad Request - Your request is invalid.
401Unauthorized - Your access key is incorrect.
402Payment Required - Your Bucket needs to be upgraded to continue use.
403Forbidden - You are not allowed to access this content.
404Not Found - The requested resource doesn't exist.
429Too Many Requests - Too many requests hit the API too quickly.
500, 502, 503, 504Internal Server Error - Something went wrong on our end.

We try to provide verbose error messages as well. For example:

"status": 400,
"message": "Metafield validation: invalid 'value' for metafield with key: 'number' and type: 'number'"