Saltar al contenido principal

Rate Limits

La API de Neuroon implementa límites de uso para garantizar la estabilidad del servicio.

Límites por plan

PlanBúsquedas/mesProductosRequests/min
Trial1005010
Basic5,0001,00060
Growth25,00010,000120
Pro100,00050,000300
EnterpriseIlimitadoIlimitadoPersonalizado

Headers de respuesta

Cada respuesta incluye información sobre tus límites:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1640000000
HeaderDescripción
X-RateLimit-LimitLímite máximo por ventana
X-RateLimit-RemainingPeticiones restantes
X-RateLimit-ResetTimestamp 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:

  1. Actualiza tu plan en el Dashboard
  2. Contacta con nosotros para planes Enterprise
  3. Optimiza tu integración (cache, debounce, batch)