Rate limits and errors
How many requests the API accepts, what happens when you send too many, and how errors are returned.
Rate limits#
The API counts requests in rolling one-minute windows. When you go over the limit, it answers with HTTP status 429 Too Many Requests and doesn't run the query.
To stay within the limit:
- Use webhooks instead of polling. HirePass tells you when a check is requested and when the applicant submits information. See Working with webhooks.
- Fetch in one request. Use Fetch all results at once rather than one request per check element.
- Back off on 429. Wait until the minute has passed, then retry. If you get
429again, double the wait before the next retry.
If your integration needs a higher limit, for example to import a large cohort, email [email protected] with the expected volume.
How errors are returned#
The API follows the GraphQL convention: errors come back in an errors array in the response body, next to any data that could be returned.
{
"errors": [
{
"message": "Unauthorized",
"extensions": {
"code": "UNAUTHORIZED"
}
}
],
"data": null
}messagesays what went wrong in plain words. Log it, and don't show it to applicants.extensions.codeis a code you can use in your own logic.
Error codes#
| Code | What it means | What to do |
|---|---|---|
UNAUTHORIZED | The API key is missing, wrong or revoked | Check the header is Authorization: Bearer hp_client_token_… and that the key is Active in Workspace |
FORBIDDEN | The key is valid but can't do this action | Check the record belongs to your organisation |
NOT_FOUND | The check, package or record doesn't exist in your organisation | Check the reference, such as the externalId |
BAD_REQUEST | The request couldn't be processed as sent | Check the fields and values in your query |
VALIDATION | One or more fields failed validation | Read message: it lists the fields to fix |
GRAPHQL_VALIDATION_FAILED | The query asks for a field or argument that doesn't exist | Compare your query with the examples in these docs |
INTERNAL_SERVER_ERROR | Any other error. The message says what to fix, for example "Unauthorized" or a list of invalid fields | Fix what the message names. If it reads "Unable to process your request at this time.", retry after a short wait |
HTTP statuses#
Most errors return HTTP 200 with the errors array, so always check the body. Errors with one of the HirePass codes above also set the matching status, such as 401 for UNAUTHORIZED or 404 for NOT_FOUND.
| Status | When |
|---|---|
200 | The request reached the API. Check the body for errors |
400 | The body isn't valid JSON or GraphQL, or a BAD_REQUEST or VALIDATION error |
401, 403, 404 | UNAUTHORIZED, FORBIDDEN, NOT_FOUND |
429 | Too many requests, see Rate limits |
5xx | A temporary problem on our side. Retry with backoff, and check HirePass status |
If an error persists, email [email protected] with the time of the request, the query name and the message you received. Never send your API key.