apidata.one docs Get a key

Rate limits

Requests are metered in token buckets: a bucket holds a burst of tokens, refills at a steady rate, and each request takes one. Three buckets exist:

Bucket Rate Burst Who is charged
a secret key (sk_) 50 a second 100 that key's requests only. A server's traffic never shares a bucket with anyone else's, whatever address it comes from
a publishable key (pk_) 20 a second 50 that key's requests, and the address bucket
an address (IP) 20 a second 50 every request from that address that carries no valid secret key: publishable keys, no key, a malformed, unknown or revoked key, and public routes such as GET /v1/status

The address bucket is charged before any key lookup, so a flood of bad keys from one address gets 429 rate_limited once the bucket is empty, not a stream of 401s. A valid secret key is looked up first and never touches the address bucket; a secret key that turns out unknown or revoked is charged to the address.

The client address is the one our own front door reports for your connection. A forwarding header you send, such as X-Forwarded-For, is never used, so a forged header can't move a request into another bucket.

Headers

Every response carries the standard headers for the tighter of the buckets that applied:

A refused request is 429 rate_limited with Retry-After in seconds.

A site can read its 429s. When your publishable key's own bucket refuses a request from one of your listed origins, the 429 carries that origin's CORS headers; when the address's bucket refuses, it carries Access-Control-Allow-Origin: *, since that answer says nothing about any account. Both expose Retry-After and the RateLimit-* headers to scripts (Access-Control-Expose-Headers). A site that isn't on the account's list still gets 403 origin_not_allowed with no CORS headers, and never spends your key's bucket.

The key list

GET /v1/listings/keys (secret keys only) has a bucket of its own for each key, on top of that key's usual one:

Bucket Rate Burst
the key list, for a secret key one request every 2 seconds 5

Every request to the route takes a token from it, whatever it is answered. Past it: 429 rate_limited with Retry-After. On the route's answers the RateLimit-* headers show whichever bucket has the fewest requests left, this one or the key's own. Ask for 5,000 keys a page: a full list of a million keys is then about 210 requests, a few minutes.

Place outlines

GET /v1/places/{placeId}/geometry (Premium) has two limits of its own, per key, on top of the buckets above:

Limit Refusal Counted
60 outlines in any 60 seconds 429 rate_limited with Retry-After a rolling count: a slot is free again 60 seconds after its outline was served
5,000 outlines a UTC day 429 quota_exceeded with Retry-After to the next 00:00 UTC in the database, so a restart doesn't reset it

Only outlines actually served count toward either: a 404, a 400 or a refused request costs nothing.

On an outline answer, RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset show whichever applies with the fewest requests left: the key's or the address's bucket, or the 60-a-minute limit (then RateLimit-Limit is 60). The day has its own three headers, on every outline answer (200, 404 and both 429s):

A browser script can read all of them.

Browser traffic

A site that calls the API from the browser with a publishable key shares its visitors' address buckets with every other publishable-key user at those addresses (an office, a campus, a mobile carrier's gateway). Keep per-page calls few, debounce autocomplete, and move anything heavy to your server behind the secret key.

This page as Markdown