# Rate limits

Turn on the Drive API's per-minute quotas, so a request past its price group's share returns Drive's 429 rateLimitExceeded error.

Check that your client backs off when Drive runs out of quota, rather than failing the job or retrying at once. Turning on [`rate_limits: real`](https://www.rystic.ai/docs/network-profiles.md) applies the per-minute counts in [Rate limits](https://www.rystic.ai/docs/simulators/google-drive.md#rate-limits). The examples run out the list methods, 3,250 a minute per token, since a list needs no file to call.

With no setting nothing is refused, so 3,252 lists sent through one connection all return 200. They still count, so once the limits go on the next list is refused. After a reset, the same 3,252 lists return 200 up to the list limit. Next come a `files.generateIds` call, another token's user and a list under that token, a list as another user and a batch holding one list, then a second reset:

```bash
AUTH='Authorization: Bearer ya29.placeholder'
LIST="$RYSTIC_URL/drive/v3/files?pageSize=1"
curl -s -H "$AUTH" -w '%{http_code}\n' $(for i in $(seq 3252); do echo "-o /dev/null $LIST"; done) | sort | uniq -c | awk '{print $2, $1}'
# -> 200 3252
curl -s -X POST "$RYSTIC_URL/_rystic/network" -o /dev/null -w '%{http_code}\n' -d '{"rate_limits": "real"}'
# -> 204
curl -s -o /dev/null -w '%{http_code}\n' -H "$AUTH" "$LIST"
# -> 429
curl -s -X POST "$RYSTIC_URL/_rystic/reset" -o /dev/null -w '%{http_code}\n'
# -> 204
curl -s -H "$AUTH" -w '%{http_code}\n' $(for i in $(seq 3252); do echo "-o /dev/null $LIST"; done) | sort | uniq -c | awk '{print $2, $1}'
# -> 200 3250
# -> 429 2
curl -s -H "$AUTH" "$LIST" | jq -c '.error | {code, reason: .errors[0].reason, domain: .errors[0].domain}'
# -> {"code":429,"reason":"rateLimitExceeded","domain":"usageLimits"}
curl -s -D - -o /dev/null -H "$AUTH" "$LIST" | tr -d '\r' | awk 'tolower($0) ~ /^retry-after:/ {n++} END {print n + 0, "Retry-After headers"}'
# -> 0 Retry-After headers
curl -s -o /dev/null -w '%{http_code}\n' -H "$AUTH" "$RYSTIC_URL/drive/v3/files/generateIds?count=1"
# -> 200
curl -s -H 'Authorization: Bearer ya29.another' "$RYSTIC_URL/drive/v3/about?fields=user(permissionId)" | jq -r .user.permissionId
# -> member
curl -s -o /dev/null -w '%{http_code}\n' -H 'Authorization: Bearer ya29.another' "$LIST"
# -> 200
curl -s -o /dev/null -w '%{http_code}\n' -H "$AUTH" -H 'X-Rystic-Actor: 10222233334444555567' "$LIST"
# -> 429
printf -- '--b\r\nContent-Type: application/http\r\n\r\nGET /drive/v3/files?pageSize=1\r\n\r\n--b--\r\n' | curl -s -H "$AUTH" -H 'Content-Type: multipart/mixed; boundary=b' --data-binary @- "$RYSTIC_URL/batch/drive/v3" | grep '^HTTP/'
# -> HTTP/1.1 200 OK
curl -s -X POST "$RYSTIC_URL/_rystic/reset" -o /dev/null -w '%{http_code}\n'
# -> 204
curl -s "$RYSTIC_URL/_rystic/network" | jq -r .rate_limits
# -> real
curl -s -o /dev/null -w '%{http_code}\n' -H "$AUTH" "$LIST"
# -> 200
```

The next two lists got Drive's 429 body and no `Retry-After` header, so a client picks its own wait. Google advises exponential backoff starting near one second. `files.generateIds` is in another price group, so the empty list count left it alone.

Drive counts per user, and the simulator counts per token instead. The second token acts as the scenario's own user, `member`, as the first does, yet it started with a count of its own. Acting as another user with `X-Rystic-Actor` kept the first token's empty count. The batch's list part returned 200, because a batch's parts spend no count. After the second reset `rate_limits` still reads `real` and lists succeed again.

### All tokens share one count

Beside each token's count, each price group keeps one count for all tokens together: 10,000 lists a minute. After a reset, four tokens send 2,500 lists each, and a fifth token's first list is refused. Last, the limits go off:

```bash
LIST="$RYSTIC_URL/drive/v3/files?pageSize=1"
curl -s -X POST "$RYSTIC_URL/_rystic/reset" -o /dev/null -w '%{http_code}\n'
# -> 204
for t in 1 2 3 4; do curl -s -H "Authorization: Bearer ya29.token$t" -w '%{http_code}\n' $(for i in $(seq 2500); do echo "-o /dev/null $LIST"; done); done | sort | uniq -c | awk '{print $2, $1}'
# -> 200 10000
curl -s -o /dev/null -w '%{http_code}\n' -H 'Authorization: Bearer ya29.token5' "$LIST"
# -> 429
curl -s -X POST "$RYSTIC_URL/_rystic/network" -o /dev/null -w '%{http_code}\n' -d '{"rate_limits": "off"}'
# -> 204
```

On Drive, a project that used the API between November 2025 and April 2026 keeps its earlier quotas, which the simulator does not apply.

---

Source: https://www.rystic.ai/docs/simulators/google-drive/features/rate-limits · Markdown: https://www.rystic.ai/docs/simulators/google-drive/features/rate-limits.md
