> For the complete documentation index, see [llms.txt](https://api-docs.everreal.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.everreal.co/rate-limiting.md).

# Rate limiting

You can make **300 requests per minute** to the reporting API (`/api/reporting/graphql`). The limit counts per [API client](https://api-docs.everreal.co/master/api-clientid-and-clientsecret.md) and per [company](https://api-docs.everreal.co/key-concepts.md#company): the requests of one API client in one company share the 300 requests. The minute is a clock minute, so the count starts again at the start of each minute. Check the returned HTTP headers of any API request to see your current rate limit status. When you reach your rate limit, the API answers with the status code `429`. Wait the number of seconds in `X-RateLimit-Reset`, then send the request again.

By default we return the following status codes

<table><thead><tr><th width="374">Status code</th><th>Description</th></tr></thead><tbody><tr><td><code>200</code></td><td>Success</td></tr><tr><td><code>429</code></td><td>Too many requests from rate limiting</td></tr></tbody></table>

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

```python
#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.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 int(response.headers['X-RateLimit-Remaining']) == 0:
        print(f"Sleeping {response.headers['X-RateLimit-Reset']}")
        sleep(int(response.headers['X-RateLimit-Reset']))
    print("-------------------------------------------------------")
```
