Rate limiting

You can make 300 requests per minute to each API in our system. Check the returned HTTP headers of any API request to see your current rate limit status. When you reached your rate limit, the API will return 429 status code

By default we return the following status codes

Status code
Description

200

Success

429

Too many requests from rate limiting

And the following headers

Response header
Description

X-RateLimit-Limit

The maximum number of requests that the consumer is permitted to make per minute (by default 300 per minute).

X-RateLimit-Remaining

The number of requests remaining in the current rate limit window.

X-RateLimit-Reset

The number of seconds to wait until the rate limit window resets. This header is sent for each response.

Here is an example in python to handle rate limiting

#make sure you have requests installed or run the following pip3 install requests

from datetime import datetime
from time import sleep
import requests

url = "https://{subdomain}.everreal-dev.co/api/reporting/graphql"
token =  'ey...'

payload="{\"query\":\"query {\\r\\n  users(input: { paging: { take: 10, skip: 0 }, filter: { email: \\\"email@domain.com\\\" } }) {\\r\\n    id\\r\\n    email\\r\\n  }\\r\\n}\",\"variables\":{}}"
headers = {
  'Authorization': f'Bearer {token}',
  'Content-Type': 'application/json',
}

for i in range(0,100):
    response = requests.request("POST", url, headers=headers, data=payload)
    print(f"response code {response.status_code} at {datetime.now()}")
    print("remaining", response.headers['X-RateLimit-Remaining'])
    if(response.headers['X-RateLimit-Remaining'] == 0):
        print(f"Sleeping {response.headers['X-RateLimit-Reset']}")
        sleep(int(response.headers['X-RateLimit-Reset']))
    print("-------------------------------------------------------")

Last updated