Skip to content

Rate Limits ​

The Layota API enforces rate limits to ensure fair usage and service stability.

Limits by Authentication ​

ContextLimit
Reading a published map (GET /api/p/...) — no key, or a read API key300 requests / minute per IP
Analytics ingestion (POST /api/p/{id}/analytics/)300 requests / minute per IP
Other anonymous requests60 requests / minute per IP
Signed in (JWT)300 requests / minute per user
Write API key300 requests / minute per key
Webhook test ping10 requests / minute per user
Team invitations (POST /api/organization-members/)20 / hour per organization

How Limits Work ​

Rate limits are applied per IP address (anonymous callers), per user account (signed in) or per key (a write API key). An IPv6 caller is counted by its /64 network — all addresses of one network share a limit.

A read API key is public by design — it sits in the HTML of every page that embeds the map — so a request that carries one is counted like an anonymous one, by the visitor's address. The visitors of your pages do not share a limit with each other, or with you. A server that shares its address with others (a cloud function, an office network) and wants a limit of its own uses a write key: it is counted per key, wherever the request comes from.

Reading a published map is counted on its own, apart from everything else a caller does. One opened map is one request, and the guests of a venue usually share the address of its Wi-Fi — so this limit is five times the general anonymous one. A response may also be answered by a shared cache on the way (see Response Headers); such a request is not counted at all.

When you exceed the limit, the API responds with:

http
HTTP/1.1 429 Too Many Requests
Retry-After: 30
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Retry-After

Wait for the duration specified in the Retry-After header before retrying. On the public map API a page on any origin can read this answer and the header.

The embedded map does this by itself: after a 429 it waits as long as Retry-After says and asks again, up to twice. When the wait would be longer than a few seconds — or the third answer is a 429 as well — its "Couldn't load the map" card tells the visitor that too many maps are being opened from their network, with a Reload button (see When the Map Does Not Load).

Request Size ​

A JSON body has a size limit that depends on who sends it:

CallerLargest body
Anonymous, or a read API key256 kB
Signed in (JWT), or a write API key25 MB
  • A larger body is answered 413 with {"detail": "Request body is too large."}, before it is parsed. Sign-in, the forms and an analytics batch are a few kB; the large bodies are project saves.
  • Content-Encoding: gzip is accepted from signed-in callers and write keys only, and the limit then applies to the inflated body. A compressed body from anyone else — or any other content encoding — is answered 415.
  • A body with an implausible number of nested values (more than 1,000,000 objects and arrays, or 3,000,000 values) is answered 413 as well, whatever its size and charset: parsed, such a body costs far more memory than it has bytes. The largest real map has about 30,000 and 150,000.

Analytics Batching ​

The analytics endpoint (POST /api/p/{id}/analytics/) accepts batched events — send multiple events in a single request to stay within limits:

json
{
  "events": [
    { "event": "areaClick", "params": { "id": "a1" }, "timestamp": "..." },
    { "event": "markerClick", "params": { "id": "m1" }, "timestamp": "..." },
    { "event": "searchQuery", "params": { "query": "cafe" }, "timestamp": "..." }
  ]
}

The embedded map batches events automatically (every 10 seconds).

A batch holds at most 200 events (the rest is ignored) and 256 kB (a larger body is answered 413). What one event may carry, and the per-project daily limits, are listed under Parameter Validation.

Best Practices ​

  • Cache public API responses when possible
  • Batch analytics events instead of sending them one by one
  • Implement exponential backoff when retrying after a 429 response
  • Use webhooks for real-time notifications instead of polling

Layota Documentation