Skip to content
Chatwise
Skip to Content
Developer docs

Rate limits

How many requests a key can make, and what to do when it makes too many.

View as Markdown

By default each API key can make 120 requests a minute, across all routes. The count starts again with every minute of the clock.

A request over the limit isn't carried out. It answers 429 with a Retry-After header, in seconds:

HTTP/1.1 429 Too Many Requests
Retry-After: 60

{"message":"API key rate limit exceeded"}

Wait that long, then repeat the request:

async function chatwise(path, options = {}) {
  for (;;) {
    const response = await fetch(`https://api.chatwise.so${path}`, {
      ...options,
      headers: { ...options.headers, Authorization: `Bearer ${process.env.CHATWISE_API_KEY}` },
    });
    if (response.status !== 429) return response;
    const seconds = Number(response.headers.get("retry-after") ?? 60);
    await new Promise((resolve) => setTimeout(resolve, seconds * 1000));
  }
}

Stay under it

  • Read lists with limit=100.
  • Use webhooks instead of asking again and again for new messages.
  • Give each integration its own key: each key has its own limit.

A request refused because its key is invalid or lacks the route's scope doesn't count. Meta has limits of its own for sending and creating templates.

On this page