Error codes

Brex uses HTTP response status codes to indicate the success or failure of your API requests. If your request fails, Brex returns an error using the appropriate status code.

In general, there are 3 status code ranges you can expect:

  • 2xx: Success status codes confirm that your request worked as expected.
  • 4xx: Error status codes indicate an error because of the information provided (e.g., a required parameter was omitted).
  • 5xx: Error status codes are rare and indicate an error with Brex's servers.

All Brex API endpoints include an errors object in their response body when the request fails. It will contain a type, message, and optional code. For example:

HTTP/1.1 401 Not Authorized

Copy
Copied
{
    "type": "UNAUTHORIZED",
    "message": "PERMISSION_DENIED: Invalid or Revoked Token"
}

HTTP/1.1 404 Not Found

Copy
Copied
{
    "type": "NOT_FOUND",
    "message": "Not Found",
    "code": "USER_NOT_FOUND"
}
Copyright © Brex 2019–2021. All rights reserved.