Reference
Rate limits
Each API key has a rate limit per minute for each group of endpoints. Additional limits are in place to protect your customers and workspace.
On this page
Our API rate limits are per key, per minute. Each group of endpoints has its own allowance. We’ve done this so that a high volume of search requests won’t use up your assistant’s allowance. Each count resets 1 minute after the key’s first request in that group.
Rate limits are separate from your plan’s monthly answered questions. Run out of those and /ask answers 402 plan_limit_exceeded, not 429.
Per-key limits
There are 4 groups of endpoints that increase with your plan. Below are the limits for our Starter plan, which is also what you get on your free trial. Larger plans have higher limits. All other groups of endpoints have the same limits on every plan.
| Group | Endpoints | Requests a minute per key on Starter |
|---|---|---|
| ask | /ask, /compare, /search | 120, higher on larger plans |
| suggested_questions | /suggested-questions | 120, higher on larger plans |
| recommendations | /recommendations | 240, higher on larger plans |
| conversation_read | /conversation, /conversations, /conversations/delete | 240, higher on larger plans |
| Group | Endpoints | Requests a minute per key |
|---|---|---|
| product_search | /product-search | 600 |
| autocomplete | /autocomplete | 1,200 |
| search_events | /search/events | 600 |
| product_questions | /product-questions | 600 |
| product_alerts | /product-alerts | 60 |
| feedback | /feedback, /feedback/{feedback} | 120 |
| track | /track | 600 |
| attribution | /attribution/ingest | 600 |
| escalation | /escalation, /escalation/contact, /escalation/rate | 20 |
| escalation_message | /escalation/message, /escalation/messages | 120 |
| ingest | Every /ingest write | 120 |
| ingest_acks | /ingest/acks | 120 |
| privacy | /privacy/shopper-erasure | 60 |
GET /health has no limit, so your uptime monitor can poll it freely. The live chat group, escalation_message, counts each conversation on its own, so every open chat on your storefront has its own 120 a minute, and one key can use up to 25 times that across all its chats.
Plan for your busiest minute
Work out the calls your busiest minute makes, group by group. Say a winter sale brings 180 product page views in a minute, and each page loads one bought together row. That’s 180 calls to /recommendations, inside Starter’s 240. Add a second row to every page and you’d need 360.
Before upgrading your plan, make sure you’re caching where you can. Similar, bought together and best seller rows are the same for all customers viewing a product in the same language, so you can cache these on your server for a few minutes. Recently viewed rows are unique to each customer, so they should not be shared. Product starter questions only change when your team approves a new one. Do not cache your assistant’s answers, as they are dependent on the conversation.
Other limits
Three more limits sit on top of each key’s, to keep one runaway script from spoiling things for everyone else. They’re set well above normal shopping, and we tune them over time, so we don’t publish the numbers. Each answers 429 with its own code.
| Limit | Code | What it protects |
|---|---|---|
| All keys in a workspace together | tenant_rate_limited | Your workspace, if several integrations get busy at once. |
| Each network address | ip_rate_limited | Your storefront’s allowance, from a single address sending far too much. IPv6 addresses are counted per /64 block. |
| Each shopper | shopper_rate_limited | Your other shoppers, from one visitor (or a script posing as one) asking non-stop. |
One allowance per shopper from your server
When your server calls storefront endpoints on shoppers’ behalf, every request comes from the same address, so Ottla sees one very busy shopper. To give each shopper their own allowance, mark the key Used by a store connector or another server in Storefront → API keys, add your servers’ addresses under Allowed IP addresses, and send each shopper’s public IP address in X-Ottla-Client-Ip. Ottla ignores the header on any other key.
POST /api/v1/ask HTTP/1.1
Host: ottla.ai
Authorization: Bearer YOUR_BROWSER_KEY
Origin: https://shop.example
X-Ottla-Client-Ip: 203.0.113.42
Content-Type: application/json
Handling a 429
{
"error": "rate_limited",
"message": "Too many requests. Try again later.",
"retry_after": 12
}
- Wait
retry_afterseconds before you try again. Servers can read the same value fromRetry-After; browser code can’t read that header, so use the body. - From a server, pace yourself with
X-RateLimit-LimitandX-RateLimit-Remainingon each response, and slow down before you reach zero. - Add a random jitter to your retries so your workers don’t all retry at the same time.
- Batch your catalogue updates. Send 500 products in one request instead of 500 requests.
- Debounce your search as a customer types, so a fast typist sends one request rather than ten.
// On your server (Node 18 or later)
export async function callOttla(path, body, { attempts = 4 } = {}) {
for (let attempt = 1; attempt <= attempts; attempt++) {
const res = await fetch(`https://ottla.ai/api/v1/${path}`, {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_BROWSER_KEY',
'Content-Type': 'application/json',
'Origin': 'https://shop.example', // one of the key's allowed origins
},
body: JSON.stringify(body),
});
if (res.status !== 429) return res;
const { retry_after = 1 } = await res.json();
const jitter = Math.random() * 500;
await new Promise((resolve) => setTimeout(resolve, retry_after * 1000 + jitter));
}
throw new Error('Still rate limited after retrying');
}
<?php
use GuzzleHttp\Client;
function callOttla(Client $client, string $path, array $body, int $attempts = 4): array
{
for ($attempt = 1; $attempt <= $attempts; $attempt++) {
$response = $client->post($path, [
'headers' => [
'Authorization' => 'Bearer YOUR_BROWSER_KEY',
'Origin' => 'https://shop.example',
],
'json' => $body,
'http_errors' => false,
]);
if ($response->getStatusCode() !== 429) {
return json_decode((string) $response->getBody(), true) ?? [];
}
$wait = (int) ($response->getHeaderLine('Retry-After') ?: 1);
usleep(($wait * 1000 + random_int(0, 500)) * 1000);
}
throw new RuntimeException('Still rate limited after retrying');
}
$client = new Client(['base_uri' => 'https://ottla.ai/api/v1/']);
$results = callOttla($client, 'product-search', ['query' => 'tent']);
# -i shows the X-RateLimit-Limit and X-RateLimit-Remaining headers
curl -i https://ottla.ai/api/v1/product-search \
-H "Authorization: Bearer YOUR_BROWSER_KEY" \
-H "Origin: https://shop.example" \
-H "Content-Type: application/json" \
-d '{"query": "tent"}'
FAQ
Questions developers ask
Do limits reset each minute?
Yes. A key’s count for a group runs for a minute from its first request, then starts again. retry_after tells you how much of that minute is left.
Does a bigger plan raise every limit?
No, only the 4 groups that increase with your plan: the assistant, starter questions, recommendations and conversations. All other groups of endpoints have the same limits on every plan. See our pricing page for what’s included in each plan.
Can I get higher limits?
Talk to us about your traffic. Larger plans raise the four plan-based groups, and Enterprise is set up account by account.
Why do I get shopper_rate_limited from my server?
Every request comes from your server’s address, so all your shoppers look like one. Send each shopper’s address in X-Ottla-Client-Ip from a key locked to your servers, as described above.
Related
Errors
Every 429 code, and when else to retry.
API keys and allowed origins
Lock a key to your servers’ addresses.
API reference
Request ids, idempotency and response headers.
Custom platform sync
Pacing a full catalogue sync within the ingest limit.