Rate Limits
La API de Neuroon implementa límites de uso para garantizar la estabilidad del servicio.
Límites por plan
| Plan | Búsquedas/mes | Productos | Requests/min |
|---|---|---|---|
| Trial | 100 | 50 | 10 |
| Basic | 5,000 | 1,000 | 60 |
| Growth | 25,000 | 10,000 | 120 |
| Pro | 100,000 | 50,000 | 300 |
| Enterprise | Ilimitado | Ilimitado | Personalizado |
Headers de respuesta
Cada respuesta incluye información sobre tus límites:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1640000000
| Header | Descripción |
|---|---|
X-RateLimit-Limit | Límite máximo por ventana |
X-RateLimit-Remaining | Peticiones restantes |
X-RateLimit-Reset | Timestamp Unix del reset |
Error 429
Cuando excedes el límite:
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Has excedido el límite de peticiones",
"retryAfter": 30
}
}
Manejar rate limits
async function searchWithRetry(query, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
const response = await fetch('/api/search', {
method: 'POST',
body: JSON.stringify({ query }),
});
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After') || 30;
await new Promise(r => setTimeout(r, retryAfter * 1000));
continue;
}
return response.json();
}
throw new Error('Rate limit exceeded after retries');
}
Buenas prácticas
Debounce en búsquedas
import { debounce } from 'lodash';
const search = debounce((query) => {
widget.search(query);
}, 300);
input.addEventListener('input', (e) => search(e.target.value));
Cache de resultados
const cache = new Map();
async function searchWithCache(query) {
if (cache.has(query)) {
return cache.get(query);
}
const results = await api.search(query);
cache.set(query, results);
return results;
}
Batch de sincronización
En lugar de sincronizar productos uno a uno:
// ❌ Malo: muchas peticiones
for (const product of products) {
await api.syncProduct(product);
}
// ✅ Bueno: una petición batch
await api.syncProducts(products);
Aumentar límites
Si necesitas más capacidad:
- Actualiza tu plan en el Dashboard
- Contacta con nosotros para planes Enterprise
- Optimiza tu integración (cache, debounce, batch)