Skip to content
WemarkaAPI Docs
Guides

Rate Limiting

The Wemarka API enforces rate limits to ensure fair usage and platform stability.

Limits

| Environment | Rate Limit | |-------------|------------| | Test | 100 requests per minute per key | | Live | 100 requests per minute per key |

Rate Limit Headers

Every API response includes rate limit information:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1713024000

| Header | Description | |--------|-------------| | X-RateLimit-Limit | Maximum requests allowed per window. | | X-RateLimit-Remaining | Requests remaining in the current window. | | X-RateLimit-Reset | Unix timestamp when the window resets. |

Handling 429 Responses

When you exceed the rate limit, the API returns 429 Too Many Requests. Your application should:

  1. Read the X-RateLimit-Reset header.
  2. Wait until the reset timestamp before retrying.
  3. Implement exponential backoff for repeated 429s.
async function fetchWithRetry(url, options, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    const res = await fetch(url, options);
    if (res.status !== 429) return res;

    const resetAt = Number(res.headers.get("X-RateLimit-Reset"));
    const waitMs = Math.max(0, resetAt * 1000 - Date.now()) + 100;
    await new Promise((r) => setTimeout(r, waitMs));
  }
  throw new Error("Rate limit exceeded after retries");
}

Best Practices

  • Cache responses that don't change frequently (e.g., categories, store info).
  • Use pagination to reduce the number of requests for large data sets.
  • Avoid polling — use webhooks for real-time updates.

3 min read

Wemarka — API Documentation