Sometimes requests to the API aren't successful. Failures can occur for many reasons. In all cases, the API returns an HTTP status code that indicates the nature of the failure, with a response body in JSON format containing additional information.
For server errors, the response body contains an error phrase.
| Code | Meaning | Description |
|---|---|---|
| 200 | Success | If data was requested, it's available in the data field at the top level of the response body. |
| 400 | Bad Request | This usually occurs because of a missing or malformed parameter. Check the documentation and the syntax of your request and try again. |
| 401 | Unauthorized | A valid authentication token was not provided with the request, so the API couldn't associate a user with the request. This could mean no token was provided, or the provided token was incorrect or disabled. |
| 403 | Forbidden | The authentication and request syntax was valid but the server is refusing to complete the request. This can happen if you try to read or write to objects or properties that the user doesn't have access to. |
| 404 | Not found | Either the request method and path supplied don't specify a known action in the API, or the object specified by the request doesn't exist. |
| 409 | Conflict | You're trying to create an object that already exists. |
| 415 | Unsupported media type | You're providing a payload in an unexpected format, or you haven't set the Content-Type header correctly. Perk uses application/json in all requests. |
| 429 | Too Many Requests | You've exceeded one of the enforced rate limits in the API. See Rate limits for more information. |
| 500 | Internal Error | Perk's servers have experienced a problem. Although this is rare, please contact support to report this error. |

