Limits and errors

What a client should expect when it is throttled, unauthorized, or asking for too much.

Rate limit

Default API_RATE_LIMIT_PER_MINUTE is 60. The value is copied onto the key at creation. The limiter is an in-memory 60-second window on each Cloud Run instance. Two instances can each allow 60, so the account-wide ceiling is higher than 60 when the service has scaled out. That is the basic limiter. It is not a Redis counter.

HTTP 429 body:

{"detail": "Rate limit exceeded", "retry_after": 12, "limit": 60}

Retry-After is in seconds. Back off. Do not rotate keys to dodge the limit. Ten active keys is the cap, and creating an eleventh returns 400.

Page sizes

Surface Max rows
GET /v1/providers 100 per page
App CSV export 5,000 per download
MCP search_providers 25 per call

There is no bulk "download the nation" route. Ask for a file delivery if that is the job.

HTTP errors

Code Meaning
401 No key, unknown key, or revoked key.
400 Malformed NPI, or too many active keys.
404 NPI not found.
405 GET or DELETE on /mcp. Use POST.
429 Rate limit.
503 BigQuery or the key table could not be used.

MCP tool failures that happen after auth (bad NPI, unknown tool) are JSON-RPC results with isError: true and HTTP 200, so the assistant can read the message. Auth failures stay HTTP 401 and are not wrapped in JSON-RPC.

Data errors to expect in a successful body

Practice locations are best-effort. A problem reading that table sets provider.practice_locations_error and returns an empty location list. The provider record itself is still returned.

Empty strings and nulls are empty source fields. Do not treat them as zeros.