Skip to main content

Overview

There is no request per second limit for operational API’s as listed below:
  • trigger, publish, enqueue, notify, wait, batch
  • Other endpoints (like logs,listing flow-controls, queues, schedules etc) have rps limit. This is a short-term limit per second to prevent rapid bursts of requests.
Headers:
  • Burst-RateLimit-Limit: Maximum number of requests allowed in the burst window (1 second)
  • Burst-RateLimit-Remaining: Remaining number of requests in the burst window (1 second)
  • Burst-RateLimit-Reset: Time (in unix timestamp) when the burst limit will reset

Example Rate Limit Error Handling

Handling Daily Rate Limit Error
import { QstashDailyRatelimitError } from "@upstash/qstash";

try {
  // Example of a publish request that could hit the daily rate limit
  const result = await client.publishJSON({
    url: "https://my-api...",
    // or urlGroup: "the name or id of a url group"
    body: {
      hello: "world",
    },
  });
} catch (error) {
  if (error instanceof QstashDailyRatelimitError) {
    console.log("Daily rate limit exceeded. Retry after:", error.reset);
    // Implement retry logic or notify the user
  } else {
    console.error("An unexpected error occurred:", error);
  }
}
Handling Burst Rate Limit Error
import { QstashRatelimitError } from "@upstash/qstash";

try {
  // Example of a request that could hit the burst rate limit
  const result = await client.publishJSON({
    url: "https://my-api...",
    // or urlGroup: "the name or id of a url group"
    body: {
      hello: "world",
    },
  });
} catch (error) {
  if (error instanceof QstashRatelimitError) {
    console.log("Burst rate limit exceeded. Retry after:", error.reset);
    // Implement exponential backoff or delay before retrying
  } else {
    console.error("An unexpected error occurred:", error);
  }
}