Skip to content

Rate limits

The Shepherd API enforces two rate limits per integration key:

WindowLimit
1 hour12,000 requests
1 minute800 requests

Both apply simultaneously: a burst of 800 in a minute is fine, but you cannot sustain it past the hourly cap. Limits are tracked per integration key, not per clinic, so a multi-clinic integration sharing one key shares the budget.

When you exceed either limit, the API responds with:

HTTP/1.1 429 Too Many Requests
Content-Type: text/plain
Rate limit exceeded

As with other errors, the body is JSON: here, a bare string carrying the message. See Errors.

There is no documented Retry-After header to lean on; back off and try again on your own schedule.

You can ask the API where you stand at any time:

POST /pav2/open-api-rate-limits

The response tells you how many calls have been consumed in the current minute and hour windows, so you can throttle proactively rather than waiting for a 429.

Terminal window
curl -X POST https://open-api.shepherd.vet/pav2/open-api-rate-limits \
-H "Content-Type: application/json" \
-H "X-Integration-Public-Key: $SHEPHERD_PUBLIC_KEY" \
-H "X-Integration-Private-Key: $SHEPHERD_PRIVATE_KEY" \
-H "X-Clinic-Id: $SHEPHERD_CLINIC_ID" \
-d '{}'

When you receive a 429 or a transient 5xx, retry with exponential backoff and jitter. A pattern that works well in production:

  1. On the first retry, wait 1s + random(0, 1s).
  2. On each subsequent retry, double the base: 2s, 4s, 8s, 16s, capped at 60s.
  3. Add a random jitter of up to 1 second to every wait, so concurrent workers do not synchronize.
  4. Give up after 5 or 6 attempts and surface the error to your caller.

Other practical tips:

  • Page in larger chunks. Use rpp up to 1000 where possible; one request returning 1000 records is far cheaper than 100 requests returning 10.
  • Cache lookups. Reference data (species, breeds, phone types) changes rarely; cache it instead of re-embedding on every request.
  • Schedule batch jobs off-peak. Bulk syncs at 03:00 clinic-local time are unlikely to collide with interactive traffic.
  • Avoid retry storms. If a backfill fails halfway through, do not immediately re-run the whole window; resume from the last successful page.

If your integration legitimately needs more headroom than 12,000 per hour, talk to your Shepherd account manager. Larger limits are negotiated per integration rather than self-service.