Appearance
Rate Limits
The Layota API enforces rate limits to ensure fair usage and service stability.
Limits by Authentication
| Context | Limit |
|---|---|
| Anonymous (public API) | 60 requests / minute |
| Authenticated (JWT or API key) | 300 requests / minute |
| Analytics ingestion | 60 requests / minute per IP |
| Webhook test ping | 10 requests / minute per user |
How Limits Work
Rate limits are applied per IP address (anonymous) or per user account (authenticated). When you exceed the limit, the API responds with:
http
HTTP/1.1 429 Too Many Requests
Retry-After: 30Wait for the duration specified in the Retry-After header before retrying.
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).
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