The Onward API returns semantic HTTP response codes that can be used to determine your next step.
| Code | Meaning | Body |
|---|---|---|
| 200 OK | The request was processed successfully | Resource as JSON |
| 201 Created | The resource was created | Resource as JSON |
| 400 Bad Request | The request body could not be parsed as JSON | Parse errors as JSON |
| 401 Unauthorized | The API key is missing or invalid | Error as JSON |
| 404 Not Found | The resource you're referencing does not exist | Empty |
| 409 Conflict | The resource you're trying to create already exists | Empty |
| 422 Unprocessable Entity | Input did not pass validation | Validation errors as JSON |
In the case of a 422 Unprocessable Entity, you can look to the JSON body for detail of the errors:
{
"errors": [
"Amount protected doesn't match the calculation in 'purchased_quote_token'"
]
}Some common error messages you can expect to see in the errors[] array of a 422 response body include:
- Cart amount is above the maximum protected amount.
- Order amount is above the maximum protected amount.
- Amount protected doesn't match the calculation in 'purchased_quote_token'
- Order is already protected.
- [field name] is required
- [field name] can't be blank
- [enum field name] should be one of these values: [enum options]
- [field name] is not included in the list