Errors

Switch API uses conventional HTTP response codes to indicate the success or failure of an API request.

As a general rule:

  • Codes in the 2xx range indicate success.

  • Codes in the 4xx range indicate incorrect or incomplete parameters (e.g. a required parameter is missing, or an operation failed with a 3rd party, etc.).

  • Codes in the 5xx range indicate an error with Switch API servers.

Switch API returns an error message and a custom error code (not related to the HTTP status code) formatted in JSON:

{
    "errors": [
        {
            "message": "Unauthorized",
            "code": 3
        }
    ]
}

Last updated

Was this helpful?