API and integrationsI get 429 Too Many Requests

I get 429 Too Many Requests

What to do when the Opttab API answers 429 RATE_LIMITED.

Each API key can make 60 requests per 60 seconds. Request 61 gets 429 with "code": "RATE_LIMITED" and a Retry-After header.

Fix it

  1. Wait and retry. Read the Retry-After header and wait that many seconds before the next request.
  2. Fetch more per request. Use pageSize=100 on list routes instead of the default 20.
  3. Spread requests out. Space calls about one second apart, and back off longer each time you get 429 again.
  4. Check for shared keys. The limit counts per key. Several servers or scripts using one key share the same 60 requests.
Give each tool its own key. It keeps their limits apart and lets you revoke one without breaking the others.

See also: Authentication, limits and errors.