QStash will abort a delivery attempt if the HTTP call to your endpoint does not return within the plan-specific Max HTTP Response Duration.
See the current limits on the QStash pricing page.
See the current limits on the QStash pricing page.
Upstash-Retries
header:
n | delay |
---|---|
1 | 12s |
2 | 2m28s |
3 | 30m8ss |
4 | 6h7m6s |
5 | 24h |
6 | 24h |
Custom Retry Delay
You can customize the delay between retry attempts by using theUpstash-Retry-Delay
header when publishing a message. This allows you to override the default exponential backoff with your own mathematical expressions.
retryDelay
expression can use mathematical functions and the special variable retried
(current retry attempt count starting from 0).
Supported functions:
pow
- Power functionsqrt
- Square rootabs
- Absolute valueexp
- Exponentialfloor
- Floor functionceil
- Ceiling functionround
- Rounding functionmin
- Minimum of valuesmax
- Maximum of values
1000
- Fixed 1 second delay1000 * (1 + retried)
- Linear backoff: 1s, 2s, 3s, 4s…pow(2, retried) * 1000
- Exponential backoff: 1s, 2s, 4s, 8s…max(1000, pow(2, retried) * 100)
- Exponential with minimum 1s delay
Retry-After Headers
Instead of using the default backoff algorithm, you can specify when QStash should retry your message. To do this, include one of the following headers in your response to QStash request.- Retry-After
- X-RateLimit-Reset
- X-RateLimit-Reset-Requests
- X-RateLimit-Reset-Tokens
Upstash-Retried Header
QStash adds theUpstash-Retried
header to requests sent to your API. This
indicates how many times the request has been retried.
Non-Retryable Error
By default, QStash retries requests for any response that does not return a successful 2XX status code. To explicitly disable retries for a given message, respond with a 489 status code and include the headerUpstash-NonRetryable-Error: true
.
When this header is present, QStash will immediately mark the message as failed and skip any further retry attempts. The message will then be forwarded to the Dead Letter Queue (DLQ) for manual review and resolution.
This mechanism is particularly useful in scenarios where retries are generally enabled but should be bypassed for specific known errors—such as invalid payloads or non-recoverable conditions.