Rate limits
IRIS HR API employs several safeguards against bursts of incoming traffic in order to maximise its stability. Users who send many requests in quick succession may see error responses.
Rate limits are currently set to:
-
100 API calls / minute / customer, or
-
144,000 API calls / day / customer.
100 per minute is the rate-limit. The rate-limit is just a speed bump. If you reach the limit, slow down and wait a minute, then continue making calls.
144,000 per day is a quota. Quota is a daily hard limit. Once you reach it, you must wait for the next day to start making calls again.
Recommended technique for handling the API rate limit (pseudo code)
pageSize = 250
currentPage = 0
wait_time = 1
loop
{
url = "https://api.iris.co.uk/hr/v2/employees?$skip={currentPage * pageSize}&$top={pageSize}"
response = get http response from {url}
if (response.code == 429)
{
wait {wait_time} seconds
wait_time = wait_time * 2
}
else
{
get results from response
store results
currentPage = currentPage + 1
wait_time = 1
}
}
until results.count > 0
As the code receives a 429 (TooManyRequests) response then the code waits and will double the wait time with each further 429 response. When the code next receives a 200 (OK) response then the wait time can be reset to a minimum value.