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 API. Use these to understand if a request was successful.

  • Name
    2xx
    Type
    Description

    A 2xx status code indicates a successful response.

  • Name
    401
    Type
    Description

    You are not authorized to view/do this.

  • Name
    429
    Type
    Description

    Validation error.

  • Name
    5xx
    Type
    Description

    A 5xx status code indicates a server error — if you see this, we'll get a notification that something is broken.


Validation error

Whenever a request is unsuccessful, the CollabPay API will return an error response with an error error array and message. You can use this information to understand better what has gone wrong and how to fix it. Most of the error messages are pretty helpful and actionable.

Here is an example of a validation error.

  • Name
    message
    Type
    Description

    Summary of the error.

  • Name
    errors
    Type
    Description

    Fields that have not passed the validation checks required for the endpoint.

Error response

{
    "message": "The amount field is required. (and 1 more error)",
    "errors": {
        "amount": [
            "The amount field is required."
        ],
        "name": [
            "The name field is required."
        ]
    }
}

Error response

{
   "message": "Payout has already been paid."
}

Rate limits - Error code 429

60 requests per minute.

Rate limit headers will be returned on each request. E.g.

X-RateLimit-Limit: 15
X-RateLimit-Remaining: 14