Errors

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

Generally, any response code in the 2xx range indicates success.

Codes in the 4xx range indicate an error with the API request, these errors are generally missing data or data in the incorrect format. Other typical issues include missing documents or when a Greenlight Request has been CANCELLED.

Codes in the 5xx range indicate an issue on the Greenlight servers.

Common HTTP Error Codes

Code

Meaning

200 - OK

Success, working as expected

400 - Bad Request

The request was incorrect, often due to a missing required parameter.

401 - Unauthorized

Either

  • The API Key header is incorrect
  • The Authorization Token is missing or invalid
  • The Authorization Token has expired

404 - Not Found

Typically the request document is no longer present OR the Greenlight Request has been CANCELLED

422 - Unprocessable Entity

The request was incorrect, often due to a missing or incorrectly formatted input parameter

429 - Too Many Requests

Too many requests hit the API too quickly. We recommend an exponential backoff of your requests

500, 502, 503, 504 - Server Errors

Something went wrong on Greenlight's end.

Error from Greenlight, specifically 400 - 422, will contain a response body with the following fields

  • statusCode - same as the response status code
  • message - description of the issue
  • requestId - unique identifier for this transaction, useful when reporting issues back to Greenlight
  • invalidFields - If the issue is missing, incorrect, or not propertly formatted fields in the request, the fields in question will be listed here
    • invalidField - the name of the field.
    • invalidMessage - description of the issue with this field

Error Example:

{
    "invalidFields": [
        {
            "fieldMessage": "string doesn't match the regular expression \"^[0-9]{3}-[0-9]{3}-[0-9]{4}$\"",
            "fieldName": "mobilePhone"
        }
    ],
    "message": "Does not match schema requirements",
    "statusCode": 400
}

If the request body contained an array, the invalidFields will indicate which position within the array the field has an issue.

For Example:

{
    "invalidFields": [
        {
            "fieldMessage": "string doesn't match the regular expression \"^[0-9]{3}-[0-9]{3}-[0-9]{4}$\"",
            "fieldName": "requests[0].practicePhone"
        }
    ],
    "message": "Does not match schema requirements",
    "statusCode": 400
}