@upstash/workflow 1.4.0 → 1.5.1-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/README.md +9 -0
  2. package/astro.d.mts +19 -2
  3. package/astro.d.ts +19 -2
  4. package/astro.js +670 -159
  5. package/astro.mjs +1 -1
  6. package/{chunk-DRHEHWMS.mjs → chunk-J3PXPHSB.mjs} +828 -317
  7. package/cloudflare.d.mts +17 -2
  8. package/cloudflare.d.ts +17 -2
  9. package/cloudflare.js +670 -159
  10. package/cloudflare.mjs +1 -1
  11. package/docs/agents/examples.mdx +8 -0
  12. package/docs/agents/features.mdx +375 -0
  13. package/docs/agents/getting-started.mdx +139 -0
  14. package/docs/agents/overview.mdx +40 -0
  15. package/docs/agents/patterns/evaluator-optimizer.mdx +72 -0
  16. package/docs/agents/patterns/orchestrator-workers.mdx +95 -0
  17. package/docs/agents/patterns/parallelization.mdx +77 -0
  18. package/docs/agents/patterns/prompt-chaining.mdx +84 -0
  19. package/docs/basics/best-practices/at-least-one-step.mdx +57 -0
  20. package/docs/basics/best-practices/business-logic-in-steps.mdx +52 -0
  21. package/docs/basics/best-practices/deterministic-code.mdx +132 -0
  22. package/docs/basics/best-practices/idempotency.mdx +38 -0
  23. package/docs/basics/best-practices/nested-context-methods.mdx +38 -0
  24. package/docs/basics/best-practices/overview.mdx +35 -0
  25. package/docs/basics/best-practices/promise-any.mdx +9 -0
  26. package/docs/basics/best-practices/return-step-results.mdx +80 -0
  27. package/docs/basics/best-practices/workflow-limits.mdx +62 -0
  28. package/docs/basics/client/cancel.mdx +137 -0
  29. package/docs/basics/client/dlq/callback.mdx +21 -0
  30. package/docs/basics/client/dlq/delete.mdx +120 -0
  31. package/docs/basics/client/dlq/list.mdx +96 -0
  32. package/docs/basics/client/dlq/restart.mdx +164 -0
  33. package/docs/basics/client/dlq/resume.mdx +167 -0
  34. package/docs/basics/client/logs.mdx +139 -0
  35. package/docs/basics/client/notify.mdx +79 -0
  36. package/docs/basics/client/trigger.mdx +139 -0
  37. package/docs/basics/client/waiters.mdx +31 -0
  38. package/docs/basics/client.mdx +40 -0
  39. package/docs/basics/how.mdx +65 -0
  40. package/docs/basics/serve/advanced.mdx +435 -0
  41. package/docs/basics/serve.mdx +142 -0
  42. package/docs/changelog.mdx +174 -0
  43. package/docs/examples/allInOne.mdx +377 -0
  44. package/docs/examples/authWebhook.mdx +575 -0
  45. package/docs/examples/customRetry.mdx +309 -0
  46. package/docs/examples/customerOnboarding.mdx +230 -0
  47. package/docs/examples/dynamicWorkflow.mdx +203 -0
  48. package/docs/examples/eCommerceOrderFulfillment.mdx +281 -0
  49. package/docs/examples/imageProcessing.mdx +339 -0
  50. package/docs/examples/paymentRetry.mdx +438 -0
  51. package/docs/examples/waitForEvent.mdx +201 -0
  52. package/docs/features/dlq/callback.mdx +42 -0
  53. package/docs/features/dlq/delete.mdx +29 -0
  54. package/docs/features/dlq/restart.mdx +33 -0
  55. package/docs/features/dlq/resume.mdx +37 -0
  56. package/docs/features/dlq.mdx +39 -0
  57. package/docs/features/failure-callback.mdx +102 -0
  58. package/docs/features/failureFunction/advanced.mdx +36 -0
  59. package/docs/features/failureFunction/reliability.mdx +33 -0
  60. package/docs/features/flow-control/monitor.mdx +22 -0
  61. package/docs/features/flow-control/parallelism.mdx +45 -0
  62. package/docs/features/flow-control/rate-period.mdx +46 -0
  63. package/docs/features/flow-control.mdx +164 -0
  64. package/docs/features/invoke/serveMany.mdx +109 -0
  65. package/docs/features/invoke.mdx +39 -0
  66. package/docs/features/notify.mdx +127 -0
  67. package/docs/features/parallel-steps.mdx +41 -0
  68. package/docs/features/retries/prevent-retries.mdx +140 -0
  69. package/docs/features/retries.mdx +93 -0
  70. package/docs/features/wait-for-event.mdx +104 -0
  71. package/docs/features/wait.mdx +44 -0
  72. package/docs/features/webhooks.mdx +116 -0
  73. package/docs/getstarted.mdx +200 -0
  74. package/docs/howto/cancel.mdx +50 -0
  75. package/docs/howto/changes.mdx +33 -0
  76. package/docs/howto/configure.mdx +42 -0
  77. package/docs/howto/failures.mdx +185 -0
  78. package/docs/howto/get-token.mdx +18 -0
  79. package/docs/howto/local-development/development-server.mdx +130 -0
  80. package/docs/howto/local-development/local-tunnel.mdx +73 -0
  81. package/docs/howto/middlewares.mdx +263 -0
  82. package/docs/howto/migrations.mdx +335 -0
  83. package/docs/howto/multi-region.mdx +107 -0
  84. package/docs/howto/parallel-runs.mdx +52 -0
  85. package/docs/howto/readonly-token.mdx +19 -0
  86. package/docs/howto/realtime/basic.mdx +315 -0
  87. package/docs/howto/realtime/human-in-the-loop.mdx +454 -0
  88. package/docs/howto/redact-fields.mdx +61 -0
  89. package/docs/howto/retry-now.mdx +41 -0
  90. package/docs/howto/schedule.mdx +114 -0
  91. package/docs/howto/security.mdx +143 -0
  92. package/docs/howto/singleton.mdx +137 -0
  93. package/docs/howto/start.mdx +69 -0
  94. package/docs/howto/use-webhooks.mdx +256 -0
  95. package/docs/integrations/aisdk.mdx +316 -0
  96. package/docs/integrations/anthropic.mdx +51 -0
  97. package/docs/integrations/datadog.mdx +69 -0
  98. package/docs/integrations/openai.mdx +87 -0
  99. package/docs/integrations/prometheus.mdx +65 -0
  100. package/docs/integrations/resend.mdx +82 -0
  101. package/docs/llms-txt.mdx +4 -0
  102. package/docs/openapi.yaml +2946 -0
  103. package/docs/pricing.mdx +22 -0
  104. package/docs/quickstarts/astro.mdx +185 -0
  105. package/docs/quickstarts/cloudflare-workers.mdx +190 -0
  106. package/docs/quickstarts/express.mdx +190 -0
  107. package/docs/quickstarts/fastapi.mdx +282 -0
  108. package/docs/quickstarts/flask.mdx +282 -0
  109. package/docs/quickstarts/hono.mdx +221 -0
  110. package/docs/quickstarts/nextjs-fastapi.mdx +147 -0
  111. package/docs/quickstarts/nextjs-flask.mdx +147 -0
  112. package/docs/quickstarts/nuxt.mdx +169 -0
  113. package/docs/quickstarts/platforms.mdx +78 -0
  114. package/docs/quickstarts/solidjs.mdx +161 -0
  115. package/docs/quickstarts/svelte.mdx +170 -0
  116. package/docs/quickstarts/tanstack-start.mdx +205 -0
  117. package/docs/quickstarts/vercel-nextjs.mdx +233 -0
  118. package/docs/roadmap.mdx +8 -0
  119. package/docs/sdk/workflow-js.mdx +4 -0
  120. package/docs/sdk/workflow-py.mdx +4 -0
  121. package/docs/steps/api.mdx +64 -0
  122. package/docs/steps/call.mdx +183 -0
  123. package/docs/steps/cancel.mdx +25 -0
  124. package/docs/steps/createWebhook.mdx +40 -0
  125. package/docs/steps/invoke.mdx +100 -0
  126. package/docs/steps/notify.mdx +105 -0
  127. package/docs/steps/run.mdx +150 -0
  128. package/docs/steps/sleep.mdx +97 -0
  129. package/docs/steps/sleepUntil.mdx +88 -0
  130. package/docs/steps/waitForEvent.mdx +60 -0
  131. package/docs/steps/waitForWebhook.mdx +78 -0
  132. package/docs/steps.mdx +108 -0
  133. package/docs/troubleshooting/general.mdx +331 -0
  134. package/docs/troubleshooting/vercel.mdx +82 -0
  135. package/express.d.mts +19 -2
  136. package/express.d.ts +19 -2
  137. package/express.js +670 -159
  138. package/express.mjs +1 -1
  139. package/h3.d.mts +19 -2
  140. package/h3.d.ts +19 -2
  141. package/h3.js +670 -159
  142. package/h3.mjs +1 -1
  143. package/hono.d.mts +17 -2
  144. package/hono.d.ts +17 -2
  145. package/hono.js +670 -159
  146. package/hono.mjs +1 -1
  147. package/index.d.mts +50 -21
  148. package/index.d.ts +50 -21
  149. package/index.js +686 -171
  150. package/index.mjs +17 -13
  151. package/nextjs.d.mts +40 -2
  152. package/nextjs.d.ts +40 -2
  153. package/nextjs.js +670 -159
  154. package/nextjs.mjs +1 -1
  155. package/package.json +1 -1
  156. package/react-router.d.mts +16 -2
  157. package/react-router.d.ts +16 -2
  158. package/react-router.js +670 -159
  159. package/react-router.mjs +1 -1
  160. package/{serve-many-CG3BFvO3.d.mts → serve-many-BKukvLNl.d.mts} +1 -1
  161. package/{serve-many-iJF1IUXk.d.ts → serve-many-CrLKQpuZ.d.ts} +1 -1
  162. package/solidjs.d.mts +10 -1
  163. package/solidjs.d.ts +10 -1
  164. package/solidjs.js +670 -159
  165. package/solidjs.mjs +1 -1
  166. package/src/platforms/astro.ts +84 -0
  167. package/src/platforms/cloudflare.ts +127 -0
  168. package/src/platforms/express.ts +147 -0
  169. package/src/platforms/h3.ts +105 -0
  170. package/src/platforms/hono.ts +103 -0
  171. package/src/platforms/nextjs.ts +193 -0
  172. package/src/platforms/react-router.ts +92 -0
  173. package/src/platforms/solidjs.ts +59 -0
  174. package/src/platforms/svelte.ts +99 -0
  175. package/src/platforms/tanstack.ts +96 -0
  176. package/src/src/client/dlq.ts +387 -0
  177. package/src/src/client/filter-types.ts +166 -0
  178. package/src/src/client/index.ts +350 -0
  179. package/src/src/client/types.ts +501 -0
  180. package/src/src/client/utils.ts +307 -0
  181. package/src/src/constants.ts +82 -0
  182. package/src/src/context/api/anthropic.ts +58 -0
  183. package/src/src/context/api/base.ts +52 -0
  184. package/src/src/context/api/index.ts +24 -0
  185. package/src/src/context/api/openai.ts +125 -0
  186. package/src/src/context/api/resend.ts +57 -0
  187. package/src/src/context/auto-executor.ts +707 -0
  188. package/src/src/context/context.ts +681 -0
  189. package/src/src/context/index.ts +1 -0
  190. package/src/src/context/provider.ts +37 -0
  191. package/src/src/context/steps.ts +965 -0
  192. package/src/src/error.ts +203 -0
  193. package/src/src/index.ts +13 -0
  194. package/src/src/middleware/default-callbacks.ts +20 -0
  195. package/src/src/middleware/index.ts +2 -0
  196. package/src/src/middleware/logging.ts +39 -0
  197. package/src/src/middleware/manager.ts +148 -0
  198. package/src/src/middleware/middleware.ts +46 -0
  199. package/src/src/middleware/types.ts +72 -0
  200. package/src/src/qstash/headers.ts +397 -0
  201. package/src/src/qstash/step-config.ts +268 -0
  202. package/src/src/qstash/submit-steps.ts +284 -0
  203. package/src/src/serve/authorization.ts +118 -0
  204. package/src/src/serve/index.ts +475 -0
  205. package/src/src/serve/multi-region/handlers.ts +225 -0
  206. package/src/src/serve/multi-region/utils.ts +88 -0
  207. package/src/src/serve/options.ts +241 -0
  208. package/src/src/serve/serve-many.ts +117 -0
  209. package/src/src/serve/utils.ts +11 -0
  210. package/src/src/types.ts +590 -0
  211. package/src/src/utils.ts +141 -0
  212. package/src/src/workflow-parser.ts +472 -0
  213. package/src/src/workflow-requests.ts +575 -0
  214. package/svelte.d.mts +17 -2
  215. package/svelte.d.ts +17 -2
  216. package/svelte.js +670 -159
  217. package/svelte.mjs +1 -1
  218. package/tanstack.d.mts +15 -2
  219. package/tanstack.d.ts +15 -2
  220. package/tanstack.js +670 -159
  221. package/tanstack.mjs +1 -1
  222. package/{types-CekOpKvz.d.ts → types-CrgK5P6p.d.mts} +372 -32
  223. package/{types-CekOpKvz.d.mts → types-CrgK5P6p.d.ts} +372 -32
@@ -0,0 +1,2946 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: Upstash Workflow REST API
4
+ description: |
5
+ Upstash Workflow is a serverless workflow orchestration service built on top of Upstash QStash and Upstash Redis.
6
+ version: 2.0.0
7
+ contact:
8
+ name: Upstash
9
+ url: https://upstash.com
10
+ servers:
11
+ - url: https://qstash-{region}.upstash.io
12
+ description: Regional
13
+ variables:
14
+ region:
15
+ default: eu-central-1
16
+ enum: [us-east-1, eu-central-1]
17
+ security:
18
+ - bearerAuth: []
19
+ - bearerAuthQuery: []
20
+
21
+ components:
22
+ securitySchemes:
23
+ bearerAuth:
24
+ type: http
25
+ scheme: bearer
26
+ bearerFormat: JWT
27
+ description: QStash authentication token
28
+ bearerAuthQuery:
29
+ type: apiKey
30
+ in: query
31
+ name: qstash_token
32
+ description: QStash authentication token passed as a query parameter
33
+
34
+ schemas:
35
+ Error:
36
+ type: object
37
+ required:
38
+ - error
39
+ properties:
40
+ error:
41
+ type: string
42
+ description: Error message
43
+
44
+ FlowControlKey:
45
+ type: object
46
+ properties:
47
+ flowControlKey:
48
+ type: string
49
+ description: The flow control key name
50
+ waitlistSize:
51
+ type: integer
52
+ description: The number of messages waiting due to flow control configuration.
53
+
54
+ SigningKeys:
55
+ type: object
56
+ properties:
57
+ current:
58
+ type: string
59
+ description: The current signing key.
60
+ next:
61
+ type: string
62
+ description: The next signing key.
63
+
64
+ WorkflowDLQMessage:
65
+ type: object
66
+ properties:
67
+ dlqId:
68
+ type: string
69
+ description: The DLQ ID of the failed workflow message.
70
+ workflowUrl:
71
+ type: string
72
+ description: The URL of the workflow.
73
+ workflowRunId:
74
+ type: string
75
+ description: The ID of the workflow run.
76
+ workflowCreatedAt:
77
+ type: integer
78
+ format: int64
79
+ description: The timestamp when the workflow run was created (Unix timestamp in milliseconds).
80
+ url:
81
+ type: string
82
+ description: The URL of the failed workflow step.
83
+ method:
84
+ type: string
85
+ description: The HTTP method used for the workflow step.
86
+ header:
87
+ type: object
88
+ additionalProperties:
89
+ type: array
90
+ items:
91
+ type: string
92
+ description: The HTTP headers sent to the workflow step.
93
+ body:
94
+ type: string
95
+ description: The body of the message if it is composed of utf8 chars only, empty otherwise.
96
+ bodyBase64:
97
+ type: string
98
+ description: The base64 encoded body if the body contains a non-utf8 char only, empty otherwise.
99
+ maxRetries:
100
+ type: integer
101
+ description: The number of retries that should be attempted in case of delivery failure.
102
+ createdAt:
103
+ type: integer
104
+ format: int64
105
+ description: The unix timestamp in milliseconds when the message was created.
106
+ failureCallback:
107
+ type: string
108
+ description: The url where we send a callback to after the workflow fails.
109
+ callerIP:
110
+ type: string
111
+ description: IP address of the publisher of this workflow.
112
+ label:
113
+ type: string
114
+ deprecated: true
115
+ description: The label assigned to the workflow run. Deprecated in favor of `labels`.
116
+ labels:
117
+ type: array
118
+ items:
119
+ type: string
120
+ description: The list of labels assigned to the workflow run.
121
+ flowControlKey:
122
+ type: string
123
+ description: The flow control key used for rate limiting.
124
+ failureFunctionState:
125
+ type: string
126
+ description: The state of the failure function if applicable.
127
+ responseStatus:
128
+ type: integer
129
+ description: The HTTP status code received from the destination API.
130
+ responseHeader:
131
+ type: object
132
+ additionalProperties:
133
+ type: array
134
+ items:
135
+ type: string
136
+ description: The HTTP response headers received from the destination API.
137
+ responseBody:
138
+ type: string
139
+ description: The body of the response if it is composed of utf8 chars only, empty otherwise.
140
+ responseBodyBase64:
141
+ type: string
142
+ description: The base64 encoded body of the response if the body contains a non-utf8 char only, empty otherwise.
143
+
144
+ Waiter:
145
+ type: object
146
+ properties:
147
+ url:
148
+ type: string
149
+ description: The URL that is waiting for the event notification.
150
+ headers:
151
+ type: object
152
+ additionalProperties:
153
+ type: array
154
+ items:
155
+ type: string
156
+ description: The HTTP headers to send with the notification.
157
+ deadline:
158
+ type: integer
159
+ format: int64
160
+ description: The Unix timestamp in seconds when the wait operation times out.
161
+ timeoutBody:
162
+ type: string
163
+ format: byte
164
+ description: The body to send if the wait times out.
165
+ timeoutUrl:
166
+ type: string
167
+ description: The URL to call if the wait times out.
168
+ timeoutHeaders:
169
+ type: object
170
+ additionalProperties:
171
+ type: array
172
+ items:
173
+ type: string
174
+ description: The HTTP headers to send with the timeout callback.
175
+
176
+ NotifyResponse:
177
+ type: object
178
+ properties:
179
+ waiter:
180
+ $ref: "#/components/schemas/Waiter"
181
+ description: The waiter that was notified.
182
+ messageId:
183
+ type: string
184
+ description: The ID of the notification message that was published.
185
+ deduplicated:
186
+ type: boolean
187
+ description: Whether this notification was deduplicated.
188
+ error:
189
+ type: string
190
+ description: Error message if the notification failed.
191
+ workflowRunId:
192
+ type: string
193
+ description: The workflow run ID if the notification was sent within a workflow.
194
+ workflowCreatedAt:
195
+ type: integer
196
+ format: int64
197
+ description: The timestamp when the workflow run was created (Unix timestamp in milliseconds).
198
+
199
+ WorkflowEvent:
200
+ type: object
201
+ properties:
202
+ time:
203
+ type: integer
204
+ format: int64
205
+ description: The timestamp of the event (Unix timestamp in milliseconds).
206
+ state:
207
+ type: string
208
+ description: The state of the workflow or step (e.g., RUN_STARTED, STEP_SUCCESS, RUN_FAILED).
209
+ workflowRunId:
210
+ type: string
211
+ description: The ID of the workflow run.
212
+ workflowUrl:
213
+ type: string
214
+ description: The URL of the workflow.
215
+ workflowCreatedAt:
216
+ type: integer
217
+ format: int64
218
+ description: The timestamp when the workflow run was created (Unix timestamp in milliseconds).
219
+ stepInfo:
220
+ $ref: "#/components/schemas/StepInfo"
221
+ nextDeliveryTime:
222
+ type: integer
223
+ format: int64
224
+ description: The next scheduled delivery time for a retrying step (Unix timestamp in milliseconds).
225
+ error:
226
+ type: string
227
+ description: Error message if the state is error.
228
+ responseStatus:
229
+ type: integer
230
+ description: HTTP status code of the response for error states.
231
+ responseBody:
232
+ type: string
233
+ description: Response body for error states.
234
+ responseHeaders:
235
+ type: object
236
+ additionalProperties:
237
+ type: array
238
+ items:
239
+ type: string
240
+ description: Response headers for error states.
241
+ headers:
242
+ type: object
243
+ additionalProperties:
244
+ type: array
245
+ items:
246
+ type: string
247
+ description: The headers of the message.
248
+ invokerWorkflowRunId:
249
+ type: string
250
+ description: The run ID of the workflow that started this workflow (only in RUN_STARTED).
251
+ invokerWorkflowUrl:
252
+ type: string
253
+ description: The URL of the workflow that started this workflow (only in RUN_STARTED).
254
+ invokerWorkflowCreatedAt:
255
+ type: integer
256
+ format: int64
257
+ description: The creation timestamp of the invoker workflow (only in RUN_STARTED).
258
+ workflowRunResponse:
259
+ type: string
260
+ description: The response returned by the workflow run (only in RUN_SUCCESS).
261
+ dlqId:
262
+ type: string
263
+ description: The DLQ ID if the workflow run failed (only in RUN_FAILED).
264
+ label:
265
+ type: string
266
+ deprecated: true
267
+ description: Label of the workflow run. Deprecated in favor of `labels`.
268
+ labels:
269
+ type: array
270
+ items:
271
+ type: string
272
+ description: List of labels assigned to the workflow run.
273
+ callerIp:
274
+ type: string
275
+ description: IP address of the client who submitted the workflow.
276
+
277
+ StepInfo:
278
+ type: object
279
+ properties:
280
+ stepId:
281
+ type: integer
282
+ format: int64
283
+ description: The unique identifier for this step.
284
+ stepName:
285
+ type: string
286
+ description: The name of the step.
287
+ stepType:
288
+ type: string
289
+ description: The type of step (e.g., call, wait, sleep, invoke).
290
+ callType:
291
+ type: string
292
+ description: The call type (e.g., step, parallelPlan, parallelResult).
293
+ messageId:
294
+ type: string
295
+ description: The message ID for this step.
296
+ state:
297
+ type: string
298
+ description: The state of the step (STEP_SUCCESS, STEP_RETRY, STEP_FAILED, STEP_PROGRESS, STEP_CANCELED).
299
+ createdAt:
300
+ type: integer
301
+ format: int64
302
+ description: When the step was created (Unix timestamp in milliseconds).
303
+ out:
304
+ type: string
305
+ description: The output/result of the step.
306
+ callUrl:
307
+ type: string
308
+ description: The URL called in this step.
309
+ callMethod:
310
+ type: string
311
+ description: The HTTP method used.
312
+ callBody:
313
+ type: string
314
+ description: The request body sent.
315
+ callHeaders:
316
+ type: object
317
+ additionalProperties:
318
+ type: array
319
+ items:
320
+ type: string
321
+ description: The request headers sent.
322
+ callResponseStatus:
323
+ type: integer
324
+ format: int64
325
+ description: The HTTP status code received.
326
+ callResponseBody:
327
+ type: string
328
+ description: The response body received.
329
+ callResponseHeaders:
330
+ type: object
331
+ additionalProperties:
332
+ type: array
333
+ items:
334
+ type: string
335
+ description: The response headers received.
336
+ waitEventId:
337
+ type: string
338
+ description: The event ID being waited for (wait steps only).
339
+ waitTimeout:
340
+ type: boolean
341
+ description: Whether the wait timed out.
342
+ invokedWorkflowRunId:
343
+ type: string
344
+ description: The run ID of the invoked workflow (invoke steps only).
345
+ invokedWorkflowUrl:
346
+ type: string
347
+ description: The URL of the invoked workflow.
348
+ retries:
349
+ type: integer
350
+ description: Maximum number of retries configured.
351
+ nextDeliveryTime:
352
+ type: integer
353
+ format: int64
354
+ description: Next scheduled retry time (Unix timestamp in milliseconds).
355
+
356
+ GroupedSteps:
357
+ type: object
358
+ properties:
359
+ steps:
360
+ type: array
361
+ items:
362
+ $ref: "#/components/schemas/StepInfo"
363
+ description: Array of steps in this group.
364
+ type:
365
+ type: string
366
+ enum: [parallel, sequential, next]
367
+ description: The type of grouping (parallel, sequential, or next).
368
+
369
+ InvokerContext:
370
+ type: object
371
+ properties:
372
+ workflowRunId:
373
+ type: string
374
+ description: The workflow run ID of the invoker.
375
+ workflowUrl:
376
+ type: string
377
+ description: The workflow URL of the invoker.
378
+ workflowRunCreatedAt:
379
+ type: integer
380
+ format: int64
381
+ description: The creation timestamp of the invoker workflow run.
382
+
383
+ FailureFunction:
384
+ type: object
385
+ properties:
386
+ messageId:
387
+ type: string
388
+ description: The message ID of the failure callback.
389
+ url:
390
+ type: string
391
+ description: The URL of the failure callback.
392
+ state:
393
+ type: string
394
+ description: The state of the failure callback.
395
+ dlqId:
396
+ type: string
397
+ description: The DLQ ID of the failure callback if it failed.
398
+ failHeaders:
399
+ type: object
400
+ additionalProperties:
401
+ type: array
402
+ items:
403
+ type: string
404
+ description: The headers from the failed workflow step.
405
+ failStatus:
406
+ type: integer
407
+ description: The status code from the failed workflow step.
408
+ failResponse:
409
+ type: string
410
+ description: The response body from the failed workflow step.
411
+ responseBody:
412
+ type: string
413
+ description: The response body from the failure callback attempt.
414
+ responseHeaders:
415
+ type: object
416
+ additionalProperties:
417
+ type: array
418
+ items:
419
+ type: string
420
+ description: The response headers from the failure callback attempt.
421
+ responseStatus:
422
+ type: integer
423
+ description: The response status from the failure callback attempt.
424
+ maxRetries:
425
+ type: integer
426
+ description: Maximum number of retries configured for the failure callback.
427
+
428
+ WorkflowRun:
429
+ type: object
430
+ properties:
431
+ workflowRunId:
432
+ type: string
433
+ description: The unique identifier for this workflow run.
434
+ workflowUrl:
435
+ type: string
436
+ description: The URL of the workflow.
437
+ workflowState:
438
+ type: string
439
+ description: |
440
+ The current state of the workflow run
441
+
442
+ | Value | Description |
443
+ | -------------- | -------------------------------------------------------------- |
444
+ | `RUN_STARTED` | The workflow has started to run and currently in progress. |
445
+ | `RUN_SUCCESS` | The workflow run has completed succesfully. |
446
+ | `RUN_FAILED` | Some errors has occured and workflow failed after all retries. |
447
+ | `RUN_CANCELED` | The workflow run has canceled upon user request. |
448
+ workflowRunCreatedAt:
449
+ type: integer
450
+ format: int64
451
+ description: When the workflow run was created (Unix timestamp in milliseconds).
452
+ workflowRunCompletedAt:
453
+ type: integer
454
+ format: int64
455
+ description: When the workflow run completed (Unix timestamp in milliseconds).
456
+ workflowRunCallerIp:
457
+ type: string
458
+ description: IP address of the client who triggered the workflow.
459
+ steps:
460
+ type: array
461
+ items:
462
+ $ref: "#/components/schemas/GroupedSteps"
463
+ description: The workflow steps grouped by execution pattern.
464
+ workflowRunResponse:
465
+ type: string
466
+ description: The response returned by the workflow run.
467
+ invoker:
468
+ $ref: "#/components/schemas/InvokerContext"
469
+ description: Information about the workflow that invoked this one.
470
+ failureFunction:
471
+ $ref: "#/components/schemas/FailureFunction"
472
+ description: Information about the failure callback if configured.
473
+ dlqId:
474
+ type: string
475
+ description: The DLQ ID if the workflow run failed.
476
+ label:
477
+ type: string
478
+ deprecated: true
479
+ description: Label assigned to the workflow run. Deprecated in favor of `labels`.
480
+ labels:
481
+ type: array
482
+ items:
483
+ type: string
484
+ description: List of labels assigned to the workflow run.
485
+ flowControlKey:
486
+ type: string
487
+ description: Flow Control Key assigned to the workflow run.
488
+
489
+ BulkAction:
490
+ type: object
491
+ properties:
492
+ actionId:
493
+ type: string
494
+ description: The ID of the bulk action.
495
+ kind:
496
+ type: string
497
+ enum: [cancel]
498
+ description: The kind of the bulk action.
499
+ state:
500
+ type: string
501
+ enum: [IN_PROGRESS, FINISHED]
502
+ description: |
503
+ The state of the bulk action.
504
+
505
+ |Value |Description|
506
+ |-------|------------|
507
+ | IN_PROGRESS |The bulk action is running in the background.|
508
+ | FINISHED |The bulk action has finished.|
509
+ total:
510
+ type: integer
511
+ format: int64
512
+ description: The number of in-progress workflow runs that matched the filter when the bulk action was created.
513
+ processed:
514
+ type: integer
515
+ format: int64
516
+ description: The number of workflow runs processed by the bulk action so far.
517
+ createdAt:
518
+ type: integer
519
+ format: int64
520
+ description: The creation time of the bulk action, in milliseconds (Unix timestamp).
521
+ completedAt:
522
+ type: integer
523
+ format: int64
524
+ description: The completion time of the bulk action, in milliseconds (Unix timestamp). Only present once the bulk action has finished.
525
+ filter:
526
+ type: object
527
+ additionalProperties:
528
+ type: array
529
+ items:
530
+ type: string
531
+ description: |
532
+ The filter the bulk action was created with. Keys are the filter parameter names of the bulk cancel request, such as `workflowUrl`, `label` or `fromDate`, and values are the given values.
533
+ example:
534
+ workflowUrl: [https://example.com/api/workflow]
535
+ label: [label_1, label_2]
536
+
537
+ paths:
538
+ /v2/trigger/{workflowUrl}:
539
+ post:
540
+ tags:
541
+ - Runs
542
+ summary: Trigger Workflow Run
543
+ description: Start a new workflow run.
544
+ parameters:
545
+ - in: path
546
+ name: workflowUrl
547
+ required: true
548
+ schema:
549
+ type: string
550
+ description: The URL of the workflow to trigger.
551
+ - in: header
552
+ name: Upstash-Workflow-RunId
553
+ required: false
554
+ schema:
555
+ type: string
556
+ description: Optional custom run ID for the workflow run. A random ID will be generated if not provided.
557
+ - name: Upstash-Forward-*
558
+ in: header
559
+ schema:
560
+ type: string
561
+ description: |
562
+ You can send custom headers to your workflow.
563
+
564
+ To send a custom header, prefix the header name with `Upstash-Forward-`. We will strip prefix and send them to the destination.
565
+
566
+ | Header | Forwarded To Destination As |
567
+ |--------|--------------|
568
+ | Upstash-Forward-My-Header: my-value | My-Header: my-value |
569
+ | Upstash-Forward-Authorization: Bearer <token> | Authorization: Bearer <token> |
570
+ - in: header
571
+ name: Upstash-Retries
572
+ required: false
573
+ schema:
574
+ type: integer
575
+ default: 3
576
+ description: Number of retries for the workflow steps in case of failure.
577
+ - name: Upstash-Delay
578
+ in: header
579
+ schema:
580
+ type: string
581
+ examples:
582
+ - "50s"
583
+ - "1d10h30m"
584
+ - "10h"
585
+ - "1d"
586
+ description: |
587
+ Delay the message delivery.
588
+
589
+ The format of this header is `<value><unit>` where value is a number and unit is one of:
590
+ - `s` for seconds
591
+ - `m` for minutes
592
+ - `h` for hours.
593
+ - `d` for days.
594
+ - name: Upstash-Not-Before
595
+ in: header
596
+ schema:
597
+ type: integer
598
+ description: |
599
+ Delay the message delivery until a certain timestamp in the future.
600
+
601
+ The format is a unix timestamp in seconds, based on the UTC timezone.
602
+
603
+ When both `Upstash-Not-Before` and `Upstash-Delay` headers are provided, `Upstash-Not-Before` will take precedence.
604
+ - in: header
605
+ name: Upstash-Label
606
+ required: false
607
+ schema:
608
+ type: string
609
+ description: |
610
+ Optional label(s) to attach to the workflow run for easier identification in logs and DLQ.
611
+
612
+ You can assign multiple labels by providing a comma-separated list.
613
+
614
+ Example: `label_1,label_2`
615
+ - in: header
616
+ name: Upstash-Flow-Control-Key
617
+ required: false
618
+ schema:
619
+ type: string
620
+ description:
621
+ Flow control key to manage concurrency for the workflow run. Steps with the same key will respect the same concurrency limit.
622
+
623
+ Make sure you pass `Upstash-Flow-Control-Value` header as well to define the limits for the key.
624
+ - in: header
625
+ name: Upstash-Flow-Control-Value
626
+ required: false
627
+ schema:
628
+ type: string
629
+ description: |
630
+ Parallelism and rate limit configuration for the flow control key in the format:
631
+ `parallelism=<value>, rate=<value>, period=<value>`.
632
+ See [flow control](/workflow/features/flow-control) for details.
633
+ - in: header
634
+ name: Upstash-Failure-Callback
635
+ required: false
636
+ schema:
637
+ type: string
638
+ description: |
639
+ Failure callback URL to be called if the workflow run fails after all retries. That is when all the defined retries are exhausted. To call the failure function defined on server, this options should be left empty. A url should be given with this header only to call a different endpoint on failure. See [failureUrl](https://upstash.com/docs/workflow/features/failureFunction/advanced).
640
+
641
+ - Failure callback URL must be prefixed with a valid protocol (http:// or https://)
642
+ - Failure callbacks are charged as a regular message.
643
+ - Failure callbacks will use the retry setting from the original request.
644
+ - name: Upstash-Failure-Callback-Forward-*
645
+ in: header
646
+ schema:
647
+ type: string
648
+ description: |
649
+ You can send custom headers along with your failure callback message.
650
+ To send a custom header, prefix the header name with `Upstash-Failure-Callback-Forward-`. We will strip prefix and them to the failure callback URL.
651
+
652
+ | Header | Forwarded To Callback Destination As |
653
+ |--------|--------------|
654
+ | Upstash-Failure-Callback-Forward-My-Header: my-value | My-Header: my-value |
655
+ | Upstash-Failure-Callback-Forward-Authorization: Bearer <token> | Authorization: Bearer <token> |
656
+ - name: Upstash-Retry-Delay
657
+ in: header
658
+ schema:
659
+ type: string
660
+ description: |
661
+ Customize the delay between retry attempts when step delivery fails.
662
+
663
+ By default, Upstash Workflow uses [exponential backoff](/qstash/features/retry). You can override this by providing a mathematical expressions to compute next delay. This expression is computed after each failed attempt.
664
+
665
+ You can use the special variable `retried`, which is how many times the message has been retried. The `retried` is 0 for the first retry.
666
+
667
+ Supported functions:
668
+ | Function | Description |
669
+ |-------------|--------------------------------------|
670
+ | `pow(x, y)`| Returns x raised to the power of y|
671
+ | `exp(x)`| Returns e raised to the power of x|
672
+ | `sqrt(x)`| Takes the square root of x|
673
+ | `abs(x)`| Returns the absolute value of x|
674
+ | `floor(x)`| Returns the largest integer less than or equal to x|
675
+ | `ceil(x)`| Returns the smallest integer greater than or equal to x|
676
+ | `round(x)`| Rounds x to the nearest integer|
677
+ | `min(x, y)`| Returns the smaller of x and y|
678
+ | `max(x, y)`| Returns the larger of x and y|
679
+
680
+ Examples:
681
+ - `1000`: Fixed 1 second delay
682
+ - `1000 * (1 + retried)`: Linear backoff
683
+ - `pow(2, retried) * 1000`: Exponential backoff
684
+ - `max(1000, pow(2, retried) * 100)`: Exponential with minimum 1s delay
685
+
686
+ requestBody:
687
+ description: The raw request payload passed to the workflow endpoints as is. You can access it via requestPayload parameter on the context object.
688
+ content:
689
+ text/plain:
690
+ schema:
691
+ type: string
692
+ application/json:
693
+ schema:
694
+ type: object
695
+ application/octet-stream:
696
+ schema:
697
+ type: string
698
+ format: binary
699
+ responses:
700
+ "200":
701
+ description: Workflow triggered successfully
702
+ content:
703
+ application/json:
704
+ schema:
705
+ type: object
706
+ properties:
707
+ workflowRunId:
708
+ type: string
709
+ description: The ID of the triggered workflow run.
710
+ workflowCreatedAt:
711
+ type: number
712
+ format: date-time
713
+ description: The timestamp when the workflow run was created.
714
+ "400":
715
+ description: Bad Request
716
+ content:
717
+ application/json:
718
+ schema:
719
+ $ref: "#/components/schemas/Error"
720
+ "401":
721
+ description: Unauthorized
722
+ content:
723
+ application/json:
724
+ schema:
725
+ $ref: "#/components/schemas/Error"
726
+ "500":
727
+ description: Internal Server Error
728
+ content:
729
+ application/json:
730
+ schema:
731
+ $ref: "#/components/schemas/Error"
732
+ /v2/batch/trigger:
733
+ post:
734
+ tags:
735
+ - Runs
736
+ summary: Batch Trigger Workflow Runs
737
+ description: Start multiple workflow runs in a single request.
738
+ requestBody:
739
+ required: true
740
+ content:
741
+ application/json:
742
+ schema:
743
+ type: array
744
+ items:
745
+ type: object
746
+ required:
747
+ - destination
748
+ properties:
749
+ destination:
750
+ type: string
751
+ description: The URL of the workflow to trigger.
752
+ body:
753
+ type: string
754
+ description: The raw request payload passed to the workflow endpoint as is. You can access it via request payload parameter on the context object.
755
+ headers:
756
+ type: object
757
+ additionalProperties:
758
+ type: string
759
+ description: HTTP headers to forward to the workflow. You can pass any headers supported in the single trigger API.
760
+ responses:
761
+ "201":
762
+ description: Workflow runs triggered successfully
763
+ content:
764
+ application/json:
765
+ schema:
766
+ type: array
767
+ items:
768
+ type: object
769
+ properties:
770
+ workflowRunId:
771
+ type: string
772
+ description: The ID of the triggered workflow run.
773
+ workflowCreatedAt:
774
+ type: integer
775
+ format: int64
776
+ description: The unix timestamp in milliseconds when the workflow run was created.
777
+ deduplicated:
778
+ type: boolean
779
+ description: Whether the workflow run was deduplicated (i.e. a run with the same ID already existed and a new one was not created).
780
+ "400":
781
+ description: Bad Request
782
+ content:
783
+ application/json:
784
+ schema:
785
+ $ref: "#/components/schemas/Error"
786
+ "401":
787
+ description: Unauthorized
788
+ content:
789
+ application/json:
790
+ schema:
791
+ $ref: "#/components/schemas/Error"
792
+ "500":
793
+ description: Internal Server Error
794
+ content:
795
+ application/json:
796
+ schema:
797
+ $ref: "#/components/schemas/Error"
798
+ /v2/workflows/runs/{workflowRunId}:
799
+ delete:
800
+ tags:
801
+ - Runs
802
+ summary: Cancel Workflow Run
803
+ description: Cancel an ongoing workflow run.
804
+ parameters:
805
+ - in: path
806
+ name: workflowRunId
807
+ required: true
808
+ schema:
809
+ type: string
810
+ description: The ID of the workflow run to cancel.
811
+ responses:
812
+ "200":
813
+ description: Workflow run cancelled successfully
814
+ "404":
815
+ description: A workflow run is not found with the given id.
816
+ "500":
817
+ description: An unexpected error occured.
818
+ /v2/workflows/runs:
819
+ delete:
820
+ summary: Bulk Cancel Workflow Runs
821
+ description: Cancel all matching workflow runs.
822
+ tags:
823
+ - Runs
824
+ x-mint:
825
+ content: |
826
+ <Warning>If you provide a list of workflow run IDs, only those specific workflow runs will be canceled. If you include filter parameters, only the workflow runs matching the filters will be canceled. If no filter or workflow run IDs are sent, all workflow runs will be canceled.</Warning>
827
+
828
+ Cancelling by `workflowRunIds` is synchronous, and `cancelled` is the exact number of workflow runs cancelled.
829
+
830
+ A filter-based cancel (including cancelling all workflow runs) is tracked as a [bulk action](/workflow/api-reference/bulk-actions/list-bulk-actions) and runs in the background:
831
+
832
+ - By default, the request waits up to one minute for the bulk action to finish. If it does not finish in time, a `429` is returned, and the bulk action keeps running in the background.
833
+ - With `async=true`, the request returns right after the bulk action is created, together with its `actionId`. You can follow its progress with [Get a Bulk Action](/workflow/api-reference/bulk-actions/get-a-bulk-action).
834
+ - `cancelled` is the number of in-progress workflow runs that matched the filters when the request was accepted, not the number of workflow runs actually cancelled.
835
+ - Sending the same filters again while an identical bulk action is still in progress does not start a new one. The in-progress bulk action is returned instead.
836
+ - Up to 1000 bulk actions can be in progress at the same time. Beyond that, a `412` is returned.
837
+
838
+ For multi-value filters, a workflow run matches if its value equals any of the given values (OR logic), and multiple filters are combined with AND logic. Multiple values can be passed either by repeating the query parameter (`label=label_1&label=label_2`) or as a single comma-separated value (`label=label_1,label_2`).
839
+ parameters:
840
+ - in: query
841
+ name: workflowRunIds
842
+ required: false
843
+ schema:
844
+ type: array
845
+ items:
846
+ type: string
847
+ description: Optional list of specific workflow run IDs to cancel. If provided, the other filters are ignored.
848
+ - in: query
849
+ name: workflowUrl
850
+ required: false
851
+ schema:
852
+ type: array
853
+ items:
854
+ type: string
855
+ description: The URL of the workflow whose runs to cancel. Supports multiple values.
856
+ - in: query
857
+ name: workflowUrlExactMatch
858
+ required: false
859
+ schema:
860
+ type: boolean
861
+ default: false
862
+ description: workflow url is searched as a prefix by default. To make it exact match, `workflowUrlExactMatch` can be set to true.
863
+ - in: query
864
+ name: fromDate
865
+ required: false
866
+ schema:
867
+ type: number
868
+ format: date-time
869
+ description: Optional start date to filter workflow runs to cancel. Unix timestamp in milliseconds.
870
+ - in: query
871
+ name: toDate
872
+ required: false
873
+ schema:
874
+ type: number
875
+ format: date-time
876
+ description: Optional end date to filter workflow runs to cancel. Unix timestamp in milliseconds.
877
+ - in: query
878
+ name: callerIp
879
+ required: false
880
+ schema:
881
+ type: array
882
+ items:
883
+ type: string
884
+ description: Optional caller IP address to filter workflow runs to cancel. Supports multiple values.
885
+ - in: query
886
+ name: flowControlKey
887
+ required: false
888
+ schema:
889
+ type: array
890
+ items:
891
+ type: string
892
+ description: Optional flow control key to filter workflow runs to cancel. Supports multiple values.
893
+ - in: query
894
+ name: label
895
+ required: false
896
+ schema:
897
+ type: array
898
+ items:
899
+ type: string
900
+ description: |
901
+ Optional label to filter workflow runs to cancel. Supports multiple values. You can pass multiple values to match workflow runs with any of the given labels (OR logic).
902
+
903
+ Examples:
904
+ - `label=my_label`
905
+ - `label=label_1&label=label_2`
906
+ - `label=label_1,label_2`
907
+ - in: query
908
+ name: host
909
+ required: false
910
+ schema:
911
+ type: array
912
+ items:
913
+ type: string
914
+ description: Optional host of the workflow URL to filter workflow runs to cancel. Supports multiple values.
915
+ - in: query
916
+ name: path
917
+ required: false
918
+ schema:
919
+ type: array
920
+ items:
921
+ type: string
922
+ description: Optional path of the workflow URL to filter workflow runs to cancel. Supports multiple values.
923
+ - in: query
924
+ name: async
925
+ required: false
926
+ schema:
927
+ type: boolean
928
+ default: false
929
+ description: |
930
+ Only applies to filter-based cancels. If `true`, the request returns as soon as the bulk action is created, without waiting for it to finish. The response includes the `actionId` of the bulk action.
931
+ - in: query
932
+ name: count
933
+ required: false
934
+ deprecated: true
935
+ schema:
936
+ type: integer
937
+ description: Deprecated. This parameter is ignored, and all workflow runs matching the filters are cancelled.
938
+
939
+ responses:
940
+ "200":
941
+ description: Workflow runs cancelled, or the bulk action is created when `async=true`.
942
+ content:
943
+ application/json:
944
+ schema:
945
+ type: object
946
+ properties:
947
+ cancelled:
948
+ type: integer
949
+ description: |
950
+ When cancelling by `workflowRunIds`, the number of workflow runs cancelled.
951
+
952
+ For filter-based cancels, the number of in-progress workflow runs that matched the filters when the request was accepted.
953
+ actionId:
954
+ type: string
955
+ description: The ID of the bulk action. Only returned for filter-based cancels with `async=true`.
956
+ "400":
957
+ description: Bad Request
958
+ content:
959
+ application/json:
960
+ schema:
961
+ $ref: "#/components/schemas/Error"
962
+ "412":
963
+ description: Too many bulk actions are in progress. Up to 1000 bulk actions can be in progress at the same time.
964
+ content:
965
+ application/json:
966
+ schema:
967
+ $ref: "#/components/schemas/Error"
968
+ "429":
969
+ description: The bulk action did not finish within one minute. It keeps running in the background and can be tracked via `GET /v2/workflows/bulkActions`.
970
+ content:
971
+ application/json:
972
+ schema:
973
+ $ref: "#/components/schemas/Error"
974
+ /v2/messages/{messageId}/retry:
975
+ post:
976
+ tags:
977
+ - Runs
978
+ summary: Retry a Step Now
979
+ description: Execute a workflow step that is waiting for its next retry immediately
980
+ x-mint:
981
+ content: |
982
+ When a step fails, Upstash Workflow schedules the next attempt according to the configured retry delay. This endpoint skips the remaining wait and executes the step right away, so the workflow run can continue without waiting.
983
+
984
+ Retrying now does not add an extra attempt. It moves the already scheduled retry forward, so the retry count and the remaining retries stay the same.
985
+
986
+ The `messageId` of a retrying step is available in the step details returned by the [logs](/workflow/api-reference/logs/list-workflow-run-logs) endpoint. Steps waiting for a retry have a `nextDeliveryTime`. If multiple parallel steps are waiting for a retry, call this endpoint once for each step.
987
+
988
+ See [Retry a Step Now](/workflow/howto/retry-now) for more details.
989
+ parameters:
990
+ - in: path
991
+ name: messageId
992
+ required: true
993
+ schema:
994
+ type: string
995
+ description: The message ID of the retrying step.
996
+ responses:
997
+ "200":
998
+ description: The step is scheduled for immediate execution.
999
+ "400":
1000
+ description: The message id is invalid.
1001
+ content:
1002
+ application/json:
1003
+ schema:
1004
+ $ref: "#/components/schemas/Error"
1005
+ "404":
1006
+ description: Step not found, or the step is not waiting for a retry.
1007
+ content:
1008
+ application/json:
1009
+ schema:
1010
+ $ref: "#/components/schemas/Error"
1011
+ "500":
1012
+ description: Internal Server Error
1013
+ content:
1014
+ application/json:
1015
+ schema:
1016
+ $ref: "#/components/schemas/Error"
1017
+ /v2/workflows/bulkActions:
1018
+ get:
1019
+ summary: List Bulk Actions
1020
+ description: List the bulk actions created by filter-based workflow run cancels
1021
+ tags:
1022
+ - Bulk Actions
1023
+ x-mint:
1024
+ content: |
1025
+ A bulk action is created for every filter-based [bulk cancel](/workflow/api-reference/runs/bulk-cancel-workflow-runs) request, and tracks the progress of the cancellation running in the background.
1026
+
1027
+ Bulk actions are kept for 7 days after they are created.
1028
+
1029
+ <Note>
1030
+ The `state` filter is applied to each page separately. A page may contain fewer than `count` bulk actions, or none at all, even when there are more to list. Keep paginating until no `cursor` is returned.
1031
+ </Note>
1032
+ parameters:
1033
+ - in: query
1034
+ name: cursor
1035
+ required: false
1036
+ schema:
1037
+ type: string
1038
+ description: By providing a cursor you can paginate through all of the bulk actions.
1039
+ - in: query
1040
+ name: count
1041
+ required: false
1042
+ schema:
1043
+ type: integer
1044
+ minimum: 1
1045
+ default: 100
1046
+ maximum: 1000
1047
+ description: The number of bulk actions to scan per page. Values above 1000 are treated as 1000.
1048
+ - in: query
1049
+ name: state
1050
+ required: false
1051
+ schema:
1052
+ type: string
1053
+ enum: [IN_PROGRESS, FINISHED]
1054
+ description: Filter bulk actions by state.
1055
+ responses:
1056
+ "200":
1057
+ description: List of bulk actions
1058
+ content:
1059
+ application/json:
1060
+ schema:
1061
+ type: object
1062
+ properties:
1063
+ bulkActions:
1064
+ type: array
1065
+ items:
1066
+ $ref: "#/components/schemas/BulkAction"
1067
+ cursor:
1068
+ type: string
1069
+ description: |
1070
+ A cursor which you can use in subsequent requests to paginate through all bulk actions.
1071
+ If no cursor is returned, you have reached the end of the bulk actions.
1072
+ "400":
1073
+ description: Invalid `count`, `cursor` or `state`
1074
+ content:
1075
+ application/json:
1076
+ schema:
1077
+ $ref: "#/components/schemas/Error"
1078
+ /v2/workflows/bulkActions/{actionId}:
1079
+ get:
1080
+ summary: Get a Bulk Action
1081
+ description: Retrieve the details and progress of a bulk action
1082
+ tags:
1083
+ - Bulk Actions
1084
+ parameters:
1085
+ - in: path
1086
+ name: actionId
1087
+ required: true
1088
+ schema:
1089
+ type: string
1090
+ description: The ID of the bulk action, as returned by a filter-based bulk cancel with `async=true`.
1091
+ responses:
1092
+ "200":
1093
+ description: Bulk action details
1094
+ content:
1095
+ application/json:
1096
+ schema:
1097
+ $ref: "#/components/schemas/BulkAction"
1098
+ "404":
1099
+ description: Bulk action not found
1100
+ content:
1101
+ application/json:
1102
+ schema:
1103
+ $ref: "#/components/schemas/Error"
1104
+ /v2/workflows/logs:
1105
+ get:
1106
+ tags:
1107
+ - Logs
1108
+ summary: List Workflow Run Logs
1109
+ description: List and filter workflow runs with their state, completed and in-progress steps, and step details.
1110
+ x-mint: content |
1111
+ You can fetch details about workflow runs, including their state, completed and in-progress steps, and step details.
1112
+
1113
+ The retention duration for completed workflow runs depends on your quota. Please check the [pricing](https://upstash.com/pricing/workflow) page for details.
1114
+ <Note>
1115
+ If you have executed multiple workflow runs with the same workflowRunId, the `workflowRunId` filter will return all of them.
1116
+
1117
+ To uniquely identify a single workflow run, include the `workflowCreatedAt` timestamp in your filter.
1118
+ </Note>
1119
+ parameters:
1120
+ - in: query
1121
+ name: cursor
1122
+ required: false
1123
+ schema:
1124
+ type: string
1125
+ description: Pagination cursor for fetching the next page of results.
1126
+ - in: query
1127
+ name: workflowUrl
1128
+ required: false
1129
+ schema:
1130
+ type: string
1131
+ description: Filter by workflow URL (exact match). Must start with http:// or https://.
1132
+ - in: query
1133
+ name: workflowRunId
1134
+ required: false
1135
+ schema:
1136
+ type: string
1137
+ description: Filter by specific workflow run ID..
1138
+ - in: query
1139
+ name: workflowCreatedAt
1140
+ required: false
1141
+ schema:
1142
+ type: integer
1143
+ format: int64
1144
+ description: Filter by workflow creation timestamp in milliseconds (Unix timestamp).
1145
+ - in: query
1146
+ name: workflowRuns
1147
+ required: false
1148
+ schema:
1149
+ type: string
1150
+ description: |
1151
+ Filter by multiple workflow runs. Provide a comma-separated list of `workflowRunId@workflowCreatedAt` pairs to query specific runs in a single request.
1152
+
1153
+ Example: `workflowRuns=ID1@TS1,ID2@TS2`
1154
+
1155
+ When this parameter is provided, all other filters are ignored.
1156
+ - in: query
1157
+ name: state
1158
+ required: false
1159
+ schema:
1160
+ type: string
1161
+ description: |
1162
+ Filter by workflow or step state. Common states include:
1163
+
1164
+ | Value | Description |
1165
+ | -------------- | -------------------------------------------------------------- |
1166
+ | `RUN_STARTED` | The workflow has started to run and currently in progress. |
1167
+ | `RUN_SUCCESS` | The workflow run has completed succesfully. |
1168
+ | `RUN_FAILED` | Some errors has occured and workflow failed after all retries. |
1169
+ | `RUN_CANCELED` | The workflow run has canceled upon user request. |
1170
+ | `STEP_SUCCESS` | The step succesfully fnished. |
1171
+ | `STEP_RETRY` | The step is being retried. |
1172
+ | `STEP_FAILED` | The step is failed. |
1173
+ | `STEP_PROGRESS` | The step is in progress. |
1174
+ | `STEP_CANCELED` | The step is cancelled manually. |
1175
+ - in: query
1176
+ name: fromDate
1177
+ required: false
1178
+ schema:
1179
+ type: integer
1180
+ format: int64
1181
+ description: Filter events from this date onwards in milliseconds (Unix timestamp). Inclusive.
1182
+ - in: query
1183
+ name: toDate
1184
+ required: false
1185
+ schema:
1186
+ type: integer
1187
+ format: int64
1188
+ description: Filter events up to this date in milliseconds (Unix timestamp). Inclusive.
1189
+ - in: query
1190
+ name: count
1191
+ required: false
1192
+ schema:
1193
+ type: integer
1194
+ default: 1000
1195
+ maximum: 1000
1196
+ description: |
1197
+ Maximum number of results to return per page.
1198
+ - Event mode: Max 1000 (default 1000)
1199
+ - Run mode (groupBy=workflowRunId): Max 10 (default 10)
1200
+ - in: query
1201
+ name: trimBody
1202
+ required: false
1203
+ schema:
1204
+ type: integer
1205
+ default: -1
1206
+ description: |
1207
+ Trim request/response bodies to this many bytes. Use -1 to exclude bodies entirely.
1208
+ Useful for reducing response size when bodies are large.
1209
+ - in: query
1210
+ name: label
1211
+ required: false
1212
+ schema:
1213
+ type: array
1214
+ items:
1215
+ type: string
1216
+ style: form
1217
+ explode: true
1218
+ description: |
1219
+ Filter workflow run by label. Supports multi-value filtering. You can pass multiple values to match workflow runs with any of the given labels (OR logic).
1220
+
1221
+ Examples:
1222
+ - `label=my_label`
1223
+ - `label=label_1&label=label_2`
1224
+ - in: query
1225
+ name: flowControlKey
1226
+ required: false
1227
+ schema:
1228
+ type: string
1229
+ description: |
1230
+ Filter workflow run by the flow control key assigned by the user on trigger.
1231
+
1232
+ - in: query
1233
+ name: callerIp
1234
+ required: false
1235
+ schema:
1236
+ type: string
1237
+ description: |
1238
+ Filter workflow run by the callerIp that started to workflow run.
1239
+ responses:
1240
+ "200":
1241
+ description: Workflow logs retrieved successfully
1242
+ content:
1243
+ application/json:
1244
+ schema:
1245
+ type: object
1246
+ properties:
1247
+ cursor:
1248
+ type: string
1249
+ description: Pagination cursor for the next page. Empty if no more results.
1250
+ runs:
1251
+ type: array
1252
+ items:
1253
+ $ref: "#/components/schemas/WorkflowRun"
1254
+ description: Array of complete workflow runs with all steps and metadata.
1255
+ "400":
1256
+ description: Bad Request - Invalid parameters (e.g., invalid cursor, state, or groupBy value)
1257
+ content:
1258
+ application/json:
1259
+ schema:
1260
+ $ref: "#/components/schemas/Error"
1261
+ "401":
1262
+ description: Unauthorized
1263
+ content:
1264
+ application/json:
1265
+ schema:
1266
+ $ref: "#/components/schemas/Error"
1267
+ "429":
1268
+ description: Too Many Requests - Rate limit exceeded
1269
+ content:
1270
+ application/json:
1271
+ schema:
1272
+ $ref: "#/components/schemas/Error"
1273
+ "500":
1274
+ description: Internal Server Error
1275
+ content:
1276
+ application/json:
1277
+ schema:
1278
+ $ref: "#/components/schemas/Error"
1279
+ /v2/workflows/dlq:
1280
+ get:
1281
+ tags:
1282
+ - DLQ
1283
+ summary: List Failed Workflow Runs
1284
+ description: |
1285
+ List and paginate through all failed workflow runs currently in the DLQ.
1286
+
1287
+ Failed workflows end up in the DLQ after exhausting all retry attempts. You can filter,
1288
+ paginate, and inspect these failures to understand what went wrong and decide whether to
1289
+ resume, restart, or delete them.
1290
+ x-mint:
1291
+ content: |
1292
+ <Info>
1293
+ For multi-value filters, a workflow run matches if its value equals any of the given values (OR logic), and multiple filters are combined with AND logic.
1294
+
1295
+ Multiple values can be passed either by repeating the query parameter (`label=label_1&label=label_2`) or as a single comma-separated value (`label=label_1,label_2`).
1296
+ </Info>
1297
+ parameters:
1298
+ - in: query
1299
+ name: cursor
1300
+ required: false
1301
+ schema:
1302
+ type: string
1303
+ description: Pagination cursor. If provided, returns the next page of results.
1304
+ - in: query
1305
+ name: count
1306
+ required: false
1307
+ schema:
1308
+ type: integer
1309
+ default: 100
1310
+ maximum: 100
1311
+ description: The maximum number of failed workflow runs to return per page.
1312
+ - in: query
1313
+ name: fromDate
1314
+ required: false
1315
+ schema:
1316
+ type: integer
1317
+ format: int64
1318
+ description: Filter by starting date in milliseconds (Unix timestamp). This is inclusive.
1319
+ - in: query
1320
+ name: toDate
1321
+ required: false
1322
+ schema:
1323
+ type: integer
1324
+ format: int64
1325
+ description: Filter by ending date in milliseconds (Unix timestamp). This is inclusive.
1326
+ - in: query
1327
+ name: workflowUrl
1328
+ required: false
1329
+ schema:
1330
+ type: array
1331
+ items:
1332
+ type: string
1333
+ description: Filter by workflow URL. Supports multiple values.
1334
+ - in: query
1335
+ name: workflowRunId
1336
+ required: false
1337
+ schema:
1338
+ type: string
1339
+ description: Filter by workflow run ID.
1340
+ - in: query
1341
+ name: workflowCreatedAt
1342
+ required: false
1343
+ schema:
1344
+ type: integer
1345
+ format: int64
1346
+ description: Filter by workflow creation timestamp in milliseconds (Unix timestamp).
1347
+ - in: query
1348
+ name: label
1349
+ required: false
1350
+ schema:
1351
+ type: array
1352
+ items:
1353
+ type: string
1354
+ description: |
1355
+ Filter by label assigned to the workflow run. Supports multiple values. You can pass multiple values to match workflow runs with any of the given labels (OR logic).
1356
+
1357
+ Examples:
1358
+ - `label=my_label`
1359
+ - `label=label_1&label=label_2`
1360
+ - `label=label_1,label_2`
1361
+ - in: query
1362
+ name: failureFunctionState
1363
+ required: false
1364
+ schema:
1365
+ type: array
1366
+ items:
1367
+ type: string
1368
+ description: |
1369
+ Filter by failure function state. Supports multiple values.
1370
+
1371
+ | State | Description |
1372
+ |--------|--------------|
1373
+ | CALLBACK_INPROGRESS | The failure function is in progress. |
1374
+ | CALLBACK_SUCCESS | The failure function run successfully. |
1375
+ | CALLBACK_FAIL | The failure function failed to run. |
1376
+ | CALLBACK_CANCELED | The failure function was manually canceled |
1377
+ - in: query
1378
+ name: callerIp
1379
+ required: false
1380
+ schema:
1381
+ type: array
1382
+ items:
1383
+ type: string
1384
+ description: Filter by IP address of the publisher. Supports multiple values.
1385
+ - in: query
1386
+ name: flowControlKey
1387
+ required: false
1388
+ schema:
1389
+ type: array
1390
+ items:
1391
+ type: string
1392
+ description: Filter by Flow Control Key. Supports multiple values.
1393
+ responses:
1394
+ "200":
1395
+ description: List of failed workflow runs
1396
+ content:
1397
+ application/json:
1398
+ schema:
1399
+ type: object
1400
+ properties:
1401
+ cursor:
1402
+ type: string
1403
+ description: Pagination cursor for the next page. Empty if no more results.
1404
+ messages:
1405
+ type: array
1406
+ items:
1407
+ $ref: "#/components/schemas/WorkflowDLQMessage"
1408
+ description: Array of failed workflow messages.
1409
+ "400":
1410
+ description: Bad Request
1411
+ content:
1412
+ application/json:
1413
+ schema:
1414
+ $ref: "#/components/schemas/Error"
1415
+ "401":
1416
+ description: Unauthorized
1417
+ content:
1418
+ application/json:
1419
+ schema:
1420
+ $ref: "#/components/schemas/Error"
1421
+ "500":
1422
+ description: Internal Server Error
1423
+ content:
1424
+ application/json:
1425
+ schema:
1426
+ $ref: "#/components/schemas/Error"
1427
+ delete:
1428
+ tags:
1429
+ - DLQ
1430
+ summary: Bulk Delete Failed Workflow Runs
1431
+ description: |
1432
+ Delete multiple failed workflow runs from the DLQ.
1433
+
1434
+ When a workflow run fails, it is moved to the DLQ. You can manually remove a failed workflow run from the DLQ using this endpoint. This is useful for cleaning up failed runs that you no longer wish to retry or analyze.
1435
+
1436
+ You can either specify specific DLQ IDs to delete, or use filters to delete matching workflows.
1437
+ When using filters without DLQ IDs, the operation supports pagination via cursor.
1438
+ x-mint:
1439
+ content: |
1440
+ <Info>
1441
+ For multi-value filters, a workflow run matches if its value equals any of the given values (OR logic), and multiple filters are combined with AND logic.
1442
+
1443
+ Multiple values can be passed either by repeating the query parameter (`label=label_1&label=label_2`) or as a single comma-separated value (`label=label_1,label_2`).
1444
+ </Info>
1445
+ parameters:
1446
+ - in: query
1447
+ name: dlqIds
1448
+ required: false
1449
+ schema:
1450
+ type: array
1451
+ items:
1452
+ type: string
1453
+ description: List of specific DLQ IDs to delete. If provided, other filters are ignored.
1454
+ - in: query
1455
+ name: cursor
1456
+ required: false
1457
+ schema:
1458
+ type: string
1459
+ description: Pagination cursor for deleting in batches.
1460
+ - in: query
1461
+ name: count
1462
+ required: false
1463
+ schema:
1464
+ type: integer
1465
+ description: Maximum number of workflows to delete per request.
1466
+ - in: query
1467
+ name: fromDate
1468
+ required: false
1469
+ schema:
1470
+ type: integer
1471
+ format: int64
1472
+ description: Filter by starting date in milliseconds (Unix timestamp). This is inclusive.
1473
+ - in: query
1474
+ name: toDate
1475
+ required: false
1476
+ schema:
1477
+ type: integer
1478
+ format: int64
1479
+ description: Filter by ending date in milliseconds (Unix timestamp). This is inclusive.
1480
+ - in: query
1481
+ name: workflowUrl
1482
+ required: false
1483
+ schema:
1484
+ type: array
1485
+ items:
1486
+ type: string
1487
+ description: Filter by workflow URL. Supports multiple values.
1488
+ - in: query
1489
+ name: workflowRunId
1490
+ required: false
1491
+ schema:
1492
+ type: string
1493
+ description: Filter by workflow run ID.
1494
+ - in: query
1495
+ name: workflowCreatedAt
1496
+ required: false
1497
+ schema:
1498
+ type: integer
1499
+ format: int64
1500
+ description: Filter by workflow creation timestamp in milliseconds (Unix timestamp).
1501
+ - in: query
1502
+ name: label
1503
+ required: false
1504
+ schema:
1505
+ type: array
1506
+ items:
1507
+ type: string
1508
+ description: |
1509
+ Filter by label assigned to the workflow run. Supports multiple values. You can pass multiple values to match workflow runs with any of the given labels (OR logic).
1510
+
1511
+ Examples:
1512
+ - `label=my_label`
1513
+ - `label=label_1&label=label_2`
1514
+ - `label=label_1,label_2`
1515
+ - in: query
1516
+ name: failureFunctionState
1517
+ required: false
1518
+ schema:
1519
+ type: array
1520
+ items:
1521
+ type: string
1522
+ description: |
1523
+ Filter by failure function state. Supports multiple values.
1524
+
1525
+ | State | Description |
1526
+ |--------|--------------|
1527
+ | CALLBACK_INPROGRESS | The failure function is in progress. |
1528
+ | CALLBACK_SUCCESS | The failure function run successfully. |
1529
+ | CALLBACK_FAIL | The failure function failed to run. |
1530
+ | CALLBACK_CANCELED | The failure function was manually canceled |
1531
+ - in: query
1532
+ name: callerIp
1533
+ required: false
1534
+ schema:
1535
+ type: array
1536
+ items:
1537
+ type: string
1538
+ description: Filter by IP address of the publisher. Supports multiple values.
1539
+ - in: query
1540
+ name: flowControlKey
1541
+ required: false
1542
+ schema:
1543
+ type: array
1544
+ items:
1545
+ type: string
1546
+ description: Filter by Flow Control Key. Supports multiple values.
1547
+ responses:
1548
+ "200":
1549
+ description: Workflows deleted successfully
1550
+ content:
1551
+ application/json:
1552
+ schema:
1553
+ type: object
1554
+ properties:
1555
+ deleted:
1556
+ type: integer
1557
+ format: int64
1558
+ description: The number of workflow runs that were deleted.
1559
+ cursor:
1560
+ type: string
1561
+ description: Pagination cursor for the next batch. Only present when using filters without DLQ IDs.
1562
+ "400":
1563
+ description: Bad Request
1564
+ content:
1565
+ application/json:
1566
+ schema:
1567
+ $ref: "#/components/schemas/Error"
1568
+ "401":
1569
+ description: Unauthorized
1570
+ content:
1571
+ application/json:
1572
+ schema:
1573
+ $ref: "#/components/schemas/Error"
1574
+ "500":
1575
+ description: Internal Server Error
1576
+ content:
1577
+ application/json:
1578
+ schema:
1579
+ $ref: "#/components/schemas/Error"
1580
+ /v2/workflows/dlq/{dlqId}:
1581
+ get:
1582
+ tags:
1583
+ - DLQ
1584
+ summary: Get Failed Workflow Run
1585
+ description: |
1586
+ Get details of a specific failed workflow run from the DLQ.
1587
+ parameters:
1588
+ - in: path
1589
+ name: dlqId
1590
+ required: true
1591
+ schema:
1592
+ type: string
1593
+ description: The DLQ ID of the failed workflow run.
1594
+ responses:
1595
+ "200":
1596
+ description: Failed workflow run details
1597
+ content:
1598
+ application/json:
1599
+ schema:
1600
+ $ref: "#/components/schemas/WorkflowDLQMessage"
1601
+ "400":
1602
+ description: Bad Request - Invalid DLQ ID
1603
+ content:
1604
+ application/json:
1605
+ schema:
1606
+ $ref: "#/components/schemas/Error"
1607
+ "401":
1608
+ description: Unauthorized
1609
+ content:
1610
+ application/json:
1611
+ schema:
1612
+ $ref: "#/components/schemas/Error"
1613
+ "404":
1614
+ description: DLQ message not found
1615
+ content:
1616
+ application/json:
1617
+ schema:
1618
+ $ref: "#/components/schemas/Error"
1619
+ "500":
1620
+ description: Internal Server Error
1621
+ content:
1622
+ application/json:
1623
+ schema:
1624
+ $ref: "#/components/schemas/Error"
1625
+ delete:
1626
+ tags:
1627
+ - DLQ
1628
+ summary: Delete Failed Workflow Run
1629
+ description: |
1630
+ Delete a specific failed workflow run from the DLQ.
1631
+
1632
+ Use this endpoint to remove a workflow from the DLQ after you have addressed the issue
1633
+ or determined that the workflow should not be retried.
1634
+ parameters:
1635
+ - in: path
1636
+ name: dlqId
1637
+ required: true
1638
+ schema:
1639
+ type: string
1640
+ description: The DLQ ID of the failed workflow run to delete.
1641
+ responses:
1642
+ "200":
1643
+ description: Workflow deleted successfully
1644
+ "400":
1645
+ description: Bad Request - Invalid DLQ ID
1646
+ content:
1647
+ application/json:
1648
+ schema:
1649
+ $ref: "#/components/schemas/Error"
1650
+ "401":
1651
+ description: Unauthorized
1652
+ content:
1653
+ application/json:
1654
+ schema:
1655
+ $ref: "#/components/schemas/Error"
1656
+ "404":
1657
+ description: DLQ message not found
1658
+ "500":
1659
+ description: Internal Server Error
1660
+ content:
1661
+ application/json:
1662
+ schema:
1663
+ $ref: "#/components/schemas/Error"
1664
+ /v2/workflows/dlq/resume/{dlqId}:
1665
+ post:
1666
+ tags:
1667
+ - DLQ
1668
+ summary: Resume Workflow from DLQ
1669
+ description: Resume a failed workflow run from the DLQ at the step where it failed, without re-running completed steps.
1670
+ x-mint:
1671
+ content: |
1672
+ When a workflow run fails, it's automatically moved to the DLQ (Dead Letter Queue) where it can be analyzed and resumed.
1673
+ The resume feature allows you to continue a failed workflow run from exactly where it failed, without re-executing successfully completed steps.
1674
+
1675
+ This is particularly useful for long-running workflows where you don't want to lose progress from successful steps when a single step fails.
1676
+
1677
+ When a workflow is resumed, it continues execution from the last failed step. A new workflow run ID is generated,
1678
+ but the workflow maintains the state and results from previously completed steps.
1679
+
1680
+ <Note>
1681
+ You can make changes to the workflow code as long as these changes come after the failed steps.
1682
+ However, making changes before the failed step will break the code and is not allowed.
1683
+
1684
+ For more details, check out [Handle workflow route code changes](/workflow/howto/changes) page.
1685
+ </Note>
1686
+
1687
+ parameters:
1688
+ - in: path
1689
+ name: dlqId
1690
+ required: true
1691
+ schema:
1692
+ type: string
1693
+ description: The DLQ ID of the workflow run to resume.
1694
+ - in: header
1695
+ name: Upstash-Retries
1696
+ required: false
1697
+ schema:
1698
+ type: integer
1699
+ description: Override the number of retries for the remaining workflow steps.
1700
+ - in: header
1701
+ name: Upstash-Delay
1702
+ required: false
1703
+ schema:
1704
+ type: string
1705
+ description: Override the delay before executing the next workflow step. Format is `<value><unit>` (e.g., "10s", "5m").
1706
+ - in: header
1707
+ name: Upstash-Retry-Delay
1708
+ required: false
1709
+ schema:
1710
+ type: string
1711
+ description: Override the retry delay expression for the remaining workflow steps.
1712
+ - in: header
1713
+ name: Upstash-Flow-Control-Key
1714
+ required: false
1715
+ schema:
1716
+ type: string
1717
+ description: Override the flow control key for the remaining workflow steps.
1718
+ - in: header
1719
+ name: Upstash-Flow-Control-Value
1720
+ required: false
1721
+ schema:
1722
+ type: string
1723
+ description: Override the flow control configuration in the format `parallelism=<value>, rate=<value>, period=<value>`.
1724
+ - in: header
1725
+ name: Upstash-Label
1726
+ required: false
1727
+ schema:
1728
+ type: string
1729
+ description: |
1730
+ Override the label(s) for the remaining workflow steps.
1731
+
1732
+ You can assign multiple labels by providing a comma-separated list.
1733
+
1734
+ Example: `label_1,label_2`
1735
+ - in: header
1736
+ name: Upstash-Failure-Callback
1737
+ required: false
1738
+ schema:
1739
+ type: string
1740
+ description: Override the failure callback URL for the remaining workflow steps.
1741
+ responses:
1742
+ "200":
1743
+ description: Workflow resumed successfully
1744
+ content:
1745
+ application/json:
1746
+ schema:
1747
+ type: object
1748
+ properties:
1749
+ workflowRunId:
1750
+ type: string
1751
+ description: The ID of the resumed workflow run (a new ID is generated for the resumed run).
1752
+ workflowCreatedAt:
1753
+ type: integer
1754
+ format: int64
1755
+ description: The timestamp when the resumed workflow run was created (Unix timestamp in milliseconds).
1756
+ "400":
1757
+ description: Bad Request - Invalid DLQ ID, not a workflow message, or workflow doesn't support resume
1758
+ content:
1759
+ application/json:
1760
+ schema:
1761
+ $ref: "#/components/schemas/Error"
1762
+ "401":
1763
+ description: Unauthorized
1764
+ content:
1765
+ application/json:
1766
+ schema:
1767
+ $ref: "#/components/schemas/Error"
1768
+ "404":
1769
+ description: DLQ message not found
1770
+ content:
1771
+ application/json:
1772
+ schema:
1773
+ $ref: "#/components/schemas/Error"
1774
+ "500":
1775
+ description: Internal Server Error
1776
+ content:
1777
+ application/json:
1778
+ schema:
1779
+ $ref: "#/components/schemas/Error"
1780
+ /v2/workflows/dlq/resume:
1781
+ post:
1782
+ tags:
1783
+ - DLQ
1784
+ summary: Bulk Resume Workflows from DLQ
1785
+ description: |
1786
+ When a workflow run fails, it's automatically moved to the DLQ (Dead Letter Queue) where it can be analyzed and resumed.
1787
+ The resume feature allows you to continue a failed workflow run from exactly where it failed, without re-executing successfully completed steps.
1788
+
1789
+ This is particularly useful for long-running workflows where you don't want to lose progress from successful steps when a single step fails.
1790
+
1791
+ When a workflow is resumed, it continues execution from the last failed step. A new workflow run ID is generated,
1792
+ but the workflow maintains the state and results from previously completed steps.
1793
+
1794
+ <Note>
1795
+ You can make changes to the workflow code as long as these changes come after the failed steps.
1796
+ However, making changes before the failed step will break the code and is not allowed.
1797
+
1798
+ For more details, check out [Handle workflow route code changes](/workflow/howto/changes) page.
1799
+ </Note>
1800
+ x-mint:
1801
+ content: |
1802
+ <Info>
1803
+ For multi-value filters, a workflow run matches if its value equals any of the given values (OR logic), and multiple filters are combined with AND logic.
1804
+
1805
+ Multiple values can be passed either by repeating the query parameter (`label=label_1&label=label_2`) or as a single comma-separated value (`label=label_1,label_2`).
1806
+ </Info>
1807
+ parameters:
1808
+ - in: query
1809
+ name: dlqIds
1810
+ required: false
1811
+ schema:
1812
+ type: array
1813
+ items:
1814
+ type: string
1815
+ description: List of specific DLQ IDs to resume. If provided, other filters are ignored.
1816
+ - in: query
1817
+ name: cursor
1818
+ required: false
1819
+ schema:
1820
+ type: string
1821
+ description: Pagination cursor for resuming workflows in batches.
1822
+ - in: query
1823
+ name: count
1824
+ required: false
1825
+ schema:
1826
+ type: integer
1827
+ description: Maximum number of workflows to resume. If not provided, all matching workflows will be resumed.
1828
+ - in: query
1829
+ name: fromDate
1830
+ required: false
1831
+ schema:
1832
+ type: integer
1833
+ format: int64
1834
+ description: Filter workflows by starting date, in milliseconds (Unix timestamp). This is inclusive.
1835
+ - in: query
1836
+ name: toDate
1837
+ required: false
1838
+ schema:
1839
+ type: integer
1840
+ format: int64
1841
+ description: Filter workflows by ending date, in milliseconds (Unix timestamp). This is inclusive.
1842
+ - in: query
1843
+ name: workflowUrl
1844
+ required: false
1845
+ schema:
1846
+ type: array
1847
+ items:
1848
+ type: string
1849
+ description: Filter workflows by workflow URL. Supports multiple values.
1850
+ - in: query
1851
+ name: workflowRunId
1852
+ required: false
1853
+ schema:
1854
+ type: string
1855
+ description: Filter workflows by workflow run ID.
1856
+ - in: query
1857
+ name: workflowCreatedAt
1858
+ required: false
1859
+ schema:
1860
+ type: integer
1861
+ format: int64
1862
+ description: Filter workflows by creation timestamp in milliseconds (Unix timestamp).
1863
+ - in: query
1864
+ name: label
1865
+ required: false
1866
+ schema:
1867
+ type: array
1868
+ items:
1869
+ type: string
1870
+ description: |
1871
+ Filter workflows by label. Supports multiple values. You can pass multiple values to match workflows with any of the given labels (OR logic).
1872
+
1873
+ Examples:
1874
+ - `label=my_label`
1875
+ - `label=label_1&label=label_2`
1876
+ - `label=label_1,label_2`
1877
+ - in: query
1878
+ name: failureFunctionState
1879
+ required: false
1880
+ schema:
1881
+ type: array
1882
+ items:
1883
+ type: string
1884
+ description: |
1885
+ Filter workflows by failure function state. Supports multiple values.
1886
+
1887
+ | State | Description |
1888
+ |--------|--------------|
1889
+ | CALLBACK_INPROGRESS | The failure function is in progress. |
1890
+ | CALLBACK_SUCCESS | The failure function run successfully. |
1891
+ | CALLBACK_FAIL | The failure function failed to run. |
1892
+ | CALLBACK_CANCELED | The failure function was manually canceled |
1893
+ - in: query
1894
+ name: callerIp
1895
+ required: false
1896
+ schema:
1897
+ type: array
1898
+ items:
1899
+ type: string
1900
+ description: Filter workflows by IP address of the publisher. Supports multiple values.
1901
+ - in: query
1902
+ name: flowControlKey
1903
+ required: false
1904
+ schema:
1905
+ type: array
1906
+ items:
1907
+ type: string
1908
+ description: Filter workflows by Flow Control Key. Supports multiple values.
1909
+ - in: header
1910
+ name: Upstash-Retries
1911
+ required: false
1912
+ schema:
1913
+ type: integer
1914
+ description: Override the number of retries for the remaining workflow steps.
1915
+ - in: header
1916
+ name: Upstash-Delay
1917
+ required: false
1918
+ schema:
1919
+ type: string
1920
+ description: Override the delay before executing the next workflow step. Format is `<value><unit>` (e.g., "10s", "5m").
1921
+ - in: header
1922
+ name: Upstash-Retry-Delay
1923
+ required: false
1924
+ schema:
1925
+ type: string
1926
+ description: Override the retry delay expression for the remaining workflow steps.
1927
+ - in: header
1928
+ name: Upstash-Flow-Control-Key
1929
+ required: false
1930
+ schema:
1931
+ type: string
1932
+ description: Override the flow control key for the remaining workflow steps.
1933
+ - in: header
1934
+ name: Upstash-Flow-Control-Value
1935
+ required: false
1936
+ schema:
1937
+ type: string
1938
+ description: Override the flow control configuration in the format `parallelism=<value>, rate=<value>, period=<value>`.
1939
+ - in: header
1940
+ name: Upstash-Label
1941
+ required: false
1942
+ schema:
1943
+ type: string
1944
+ description: |
1945
+ Override the label(s) for the remaining workflow steps.
1946
+
1947
+ You can assign multiple labels by providing a comma-separated list.
1948
+
1949
+ Example: `label_1,label_2`
1950
+ - in: header
1951
+ name: Upstash-Failure-Callback
1952
+ required: false
1953
+ schema:
1954
+ type: string
1955
+ description: Override the failure callback URL for the remaining workflow steps.
1956
+ responses:
1957
+ "200":
1958
+ description: Workflows resumed successfully
1959
+ content:
1960
+ application/json:
1961
+ schema:
1962
+ type: object
1963
+ properties:
1964
+ workflowRuns:
1965
+ type: array
1966
+ items:
1967
+ type: object
1968
+ properties:
1969
+ workflowRunId:
1970
+ type: string
1971
+ description: The ID of the resumed workflow run (a new ID is generated for each resumed run).
1972
+ workflowCreatedAt:
1973
+ type: integer
1974
+ format: int64
1975
+ description: The timestamp when the resumed workflow run was created (Unix timestamp in milliseconds).
1976
+ description: Array of resumed workflow runs.
1977
+ cursor:
1978
+ type: string
1979
+ description: Pagination cursor to use in subsequent requests. If empty, all matching workflows have been processed.
1980
+ "400":
1981
+ description: Bad Request
1982
+ content:
1983
+ application/json:
1984
+ schema:
1985
+ $ref: "#/components/schemas/Error"
1986
+ "401":
1987
+ description: Unauthorized
1988
+ content:
1989
+ application/json:
1990
+ schema:
1991
+ $ref: "#/components/schemas/Error"
1992
+ "404":
1993
+ description: Some DLQ messages were not found
1994
+ content:
1995
+ application/json:
1996
+ schema:
1997
+ $ref: "#/components/schemas/Error"
1998
+ "500":
1999
+ description: Internal Server Error
2000
+ content:
2001
+ application/json:
2002
+ schema:
2003
+ $ref: "#/components/schemas/Error"
2004
+ /v2/workflows/dlq/restart/{dlqId}:
2005
+ post:
2006
+ tags:
2007
+ - DLQ
2008
+ summary: Restart Workflow from DLQ
2009
+ description: |
2010
+ Restart a failed workflow run from the DLQ. The workflow will start from the beginning.
2011
+
2012
+ Unlike resume, which continues from where the workflow failed, restart executes the entire workflow
2013
+ from the first step. A new workflow run ID is generated and all steps will be executed again.
2014
+ parameters:
2015
+ - in: path
2016
+ name: dlqId
2017
+ required: true
2018
+ schema:
2019
+ type: string
2020
+ description: The DLQ ID of the workflow run to restart.
2021
+ - in: header
2022
+ name: Upstash-Retries
2023
+ required: false
2024
+ schema:
2025
+ type: integer
2026
+ description: Override the number of retries for the workflow steps.
2027
+ - in: header
2028
+ name: Upstash-Delay
2029
+ required: false
2030
+ schema:
2031
+ type: string
2032
+ description: Override the delay before executing the workflow. Format is `<value><unit>` (e.g., "10s", "5m").
2033
+ - in: header
2034
+ name: Upstash-Retry-Delay
2035
+ required: false
2036
+ schema:
2037
+ type: string
2038
+ description: Override the retry delay expression for the workflow steps.
2039
+ - in: header
2040
+ name: Upstash-Flow-Control-Key
2041
+ required: false
2042
+ schema:
2043
+ type: string
2044
+ description: Override the flow control key for the workflow.
2045
+ - in: header
2046
+ name: Upstash-Flow-Control-Value
2047
+ required: false
2048
+ schema:
2049
+ type: string
2050
+ description: Override the flow control configuration in the format `parallelism=<value>, rate=<value>, period=<value>`.
2051
+ - in: header
2052
+ name: Upstash-Label
2053
+ required: false
2054
+ schema:
2055
+ type: string
2056
+ description: |
2057
+ Override the label(s) for the workflow.
2058
+
2059
+ You can assign multiple labels by providing a comma-separated list.
2060
+
2061
+ Example: `label_1,label_2`
2062
+ - in: header
2063
+ name: Upstash-Failure-Callback
2064
+ required: false
2065
+ schema:
2066
+ type: string
2067
+ description: Override the failure callback URL for the workflow.
2068
+ responses:
2069
+ "200":
2070
+ description: Workflow restarted successfully
2071
+ content:
2072
+ application/json:
2073
+ schema:
2074
+ type: object
2075
+ properties:
2076
+ workflowRunId:
2077
+ type: string
2078
+ description: The ID of the restarted workflow run (a new ID is generated for the restarted run).
2079
+ workflowCreatedAt:
2080
+ type: integer
2081
+ format: int64
2082
+ description: The timestamp when the restarted workflow run was created (Unix timestamp in milliseconds).
2083
+ "400":
2084
+ description: Bad Request - Invalid DLQ ID, not a workflow message, or workflow doesn't support restart
2085
+ content:
2086
+ application/json:
2087
+ schema:
2088
+ $ref: "#/components/schemas/Error"
2089
+ "401":
2090
+ description: Unauthorized
2091
+ content:
2092
+ application/json:
2093
+ schema:
2094
+ $ref: "#/components/schemas/Error"
2095
+ "404":
2096
+ description: DLQ message not found
2097
+ content:
2098
+ application/json:
2099
+ schema:
2100
+ $ref: "#/components/schemas/Error"
2101
+ "500":
2102
+ description: Internal Server Error
2103
+ content:
2104
+ application/json:
2105
+ schema:
2106
+ $ref: "#/components/schemas/Error"
2107
+ /v2/workflows/dlq/restart:
2108
+ post:
2109
+ tags:
2110
+ - DLQ
2111
+ summary: Bulk Restart Workflows from DLQ
2112
+ description: |
2113
+ Restart multiple failed workflow runs from the DLQ. Each workflow will start from the beginning.
2114
+
2115
+ Unlike resume, which continues from where workflows failed, restart executes the entire workflows
2116
+ from the first step. New workflow run IDs are generated and all steps will be executed again.
2117
+
2118
+ A maximum of 50 workflow runs can be restarted per request. If more runs are available, a cursor is returned, which can be used in subsequent requests to continue the operation. When no cursor is returned, all entries have been processed.
2119
+ Each restarted workflow run is assigned a new random Run ID.
2120
+ x-mint:
2121
+ content: |
2122
+ <Info>
2123
+ For multi-value filters, a workflow run matches if its value equals any of the given values (OR logic), and multiple filters are combined with AND logic.
2124
+
2125
+ Multiple values can be passed either by repeating the query parameter (`label=label_1&label=label_2`) or as a single comma-separated value (`label=label_1,label_2`).
2126
+ </Info>
2127
+ parameters:
2128
+ - in: query
2129
+ name: dlqIds
2130
+ required: false
2131
+ schema:
2132
+ type: array
2133
+ items:
2134
+ type: string
2135
+ description: List of specific DLQ IDs to restart. If provided, other filters are ignored.
2136
+ - in: query
2137
+ name: cursor
2138
+ required: false
2139
+ schema:
2140
+ type: string
2141
+ description: Pagination cursor for restarting workflows in batches.
2142
+ - in: query
2143
+ name: count
2144
+ required: false
2145
+ schema:
2146
+ type: integer
2147
+ description: Maximum number of workflows to restart. If not provided, all matching workflows will be restarted.
2148
+ - in: query
2149
+ name: fromDate
2150
+ required: false
2151
+ schema:
2152
+ type: integer
2153
+ format: int64
2154
+ description: Filter workflows by starting date, in milliseconds (Unix timestamp). This is inclusive.
2155
+ - in: query
2156
+ name: toDate
2157
+ required: false
2158
+ schema:
2159
+ type: integer
2160
+ format: int64
2161
+ description: Filter workflows by ending date, in milliseconds (Unix timestamp). This is inclusive.
2162
+ - in: query
2163
+ name: workflowUrl
2164
+ required: false
2165
+ schema:
2166
+ type: array
2167
+ items:
2168
+ type: string
2169
+ description: Filter workflows by workflow URL. Supports multiple values.
2170
+ - in: query
2171
+ name: workflowRunId
2172
+ required: false
2173
+ schema:
2174
+ type: string
2175
+ description: Filter workflows by workflow run ID.
2176
+ - in: query
2177
+ name: workflowCreatedAt
2178
+ required: false
2179
+ schema:
2180
+ type: integer
2181
+ format: int64
2182
+ description: Filter workflows by creation timestamp in milliseconds (Unix timestamp).
2183
+ - in: query
2184
+ name: label
2185
+ required: false
2186
+ schema:
2187
+ type: array
2188
+ items:
2189
+ type: string
2190
+ description: |
2191
+ Filter workflows by label. Supports multiple values. You can pass multiple values to match workflows with any of the given labels (OR logic).
2192
+
2193
+ Examples:
2194
+ - `label=my_label`
2195
+ - `label=label_1&label=label_2`
2196
+ - `label=label_1,label_2`
2197
+ - in: query
2198
+ name: failureFunctionState
2199
+ required: false
2200
+ schema:
2201
+ type: array
2202
+ items:
2203
+ type: string
2204
+ description: |
2205
+ Filter workflows by failure function state. Supports multiple values.
2206
+
2207
+ | State | Description |
2208
+ |--------|--------------|
2209
+ | CALLBACK_INPROGRESS | The failure function is in progress. |
2210
+ | CALLBACK_SUCCESS | The failure function run successfully. |
2211
+ | CALLBACK_FAIL | The failure function failed to run. |
2212
+ | CALLBACK_CANCELED | The failure function was manually canceled |
2213
+ - in: query
2214
+ name: callerIp
2215
+ required: false
2216
+ schema:
2217
+ type: array
2218
+ items:
2219
+ type: string
2220
+ description: Filter workflows by IP address of the publisher. Supports multiple values.
2221
+ - in: query
2222
+ name: flowControlKey
2223
+ required: false
2224
+ schema:
2225
+ type: array
2226
+ items:
2227
+ type: string
2228
+ description: Filter workflows by Flow Control Key. Supports multiple values.
2229
+ - in: header
2230
+ name: Upstash-Retries
2231
+ required: false
2232
+ schema:
2233
+ type: integer
2234
+ description: Override the number of retries for the workflow steps.
2235
+ - in: header
2236
+ name: Upstash-Delay
2237
+ required: false
2238
+ schema:
2239
+ type: string
2240
+ description: Override the delay before executing the workflows. Format is `<value><unit>` (e.g., "10s", "5m").
2241
+ - in: header
2242
+ name: Upstash-Retry-Delay
2243
+ required: false
2244
+ schema:
2245
+ type: string
2246
+ description: Override the retry delay expression for the workflow steps.
2247
+ - in: header
2248
+ name: Upstash-Flow-Control-Key
2249
+ required: false
2250
+ schema:
2251
+ type: string
2252
+ description: Override the flow control key for the workflows.
2253
+ - in: header
2254
+ name: Upstash-Flow-Control-Value
2255
+ required: false
2256
+ schema:
2257
+ type: string
2258
+ description: Override the flow control configuration in the format `parallelism=<value>, rate=<value>, period=<value>`.
2259
+ - in: header
2260
+ name: Upstash-Label
2261
+ required: false
2262
+ schema:
2263
+ type: string
2264
+ description: |
2265
+ Override the label(s) for the workflows.
2266
+
2267
+ You can assign multiple labels by providing a comma-separated list.
2268
+
2269
+ Example: `label_1,label_2`
2270
+ - in: header
2271
+ name: Upstash-Failure-Callback
2272
+ required: false
2273
+ schema:
2274
+ type: string
2275
+ description: Override the failure callback URL for the workflows.
2276
+ responses:
2277
+ "200":
2278
+ description: Workflows restarted successfully
2279
+ content:
2280
+ application/json:
2281
+ schema:
2282
+ type: object
2283
+ properties:
2284
+ workflowRuns:
2285
+ type: array
2286
+ items:
2287
+ type: object
2288
+ properties:
2289
+ workflowRunId:
2290
+ type: string
2291
+ description: The ID of the restarted workflow run (a new ID is generated for each restarted run).
2292
+ workflowCreatedAt:
2293
+ type: integer
2294
+ format: int64
2295
+ description: The timestamp when the restarted workflow run was created (Unix timestamp in milliseconds).
2296
+ description: Array of restarted workflow runs.
2297
+ cursor:
2298
+ type: string
2299
+ description: Pagination cursor to use in subsequent requests. If empty, all matching workflows have been processed.
2300
+ "400":
2301
+ description: Bad Request
2302
+ content:
2303
+ application/json:
2304
+ schema:
2305
+ $ref: "#/components/schemas/Error"
2306
+ "401":
2307
+ description: Unauthorized
2308
+ content:
2309
+ application/json:
2310
+ schema:
2311
+ $ref: "#/components/schemas/Error"
2312
+ "404":
2313
+ description: Some DLQ messages were not found
2314
+ content:
2315
+ application/json:
2316
+ schema:
2317
+ $ref: "#/components/schemas/Error"
2318
+ "500":
2319
+ description: Internal Server Error
2320
+ content:
2321
+ application/json:
2322
+ schema:
2323
+ $ref: "#/components/schemas/Error"
2324
+ /v2/workflows/dlq/callback/{dlqId}:
2325
+ post:
2326
+ tags:
2327
+ - DLQ
2328
+ summary: Retry Failure Callback
2329
+ description: |
2330
+ If the failure callback for a workflow run has failed, you can use this endpoint to manually trigger the failure callback again.
2331
+ This is useful for ensuring that your system is notified of workflow failures even if the original callback attempt did not succeed.
2332
+
2333
+ The state of the failure callback for each workflow run is included in the DLQ message response as failureCallbackInfo.state.
2334
+ You can filter for all workflow runs with a failed failure callback by using the failureCallbackState filter when listing workflow runs in the DLQ with the `/v2/workflows/dlq` endpoint.
2335
+ parameters:
2336
+ - in: path
2337
+ name: dlqId
2338
+ required: true
2339
+ schema:
2340
+ type: string
2341
+ description: The DLQ ID of the failed workflow run whose failure callback should be retried.
2342
+ responses:
2343
+ "200":
2344
+ description: Failure callback retried successfully
2345
+ content:
2346
+ application/json:
2347
+ schema:
2348
+ type: object
2349
+ properties:
2350
+ workflowRunId:
2351
+ type: string
2352
+ description: The ID of the workflow run.
2353
+ workflowCreatedAt:
2354
+ type: integer
2355
+ format: int64
2356
+ description: The timestamp when the workflow run was created (Unix timestamp in milliseconds).
2357
+ "400":
2358
+ description: Bad Request. Workflow doesn't have a failed callback, callback is already in-progress, succeeded, or was canceled
2359
+ content:
2360
+ application/json:
2361
+ schema:
2362
+ $ref: "#/components/schemas/Error"
2363
+ "401":
2364
+ description: Unauthorized
2365
+ content:
2366
+ application/json:
2367
+ schema:
2368
+ $ref: "#/components/schemas/Error"
2369
+ "404":
2370
+ description: DLQ message not found
2371
+ content:
2372
+ application/json:
2373
+ schema:
2374
+ $ref: "#/components/schemas/Error"
2375
+ "500":
2376
+ description: Internal Server Error
2377
+ content:
2378
+ application/json:
2379
+ schema:
2380
+ $ref: "#/components/schemas/Error"
2381
+ delete:
2382
+ tags:
2383
+ - DLQ
2384
+ summary: Cancel In-Progress Failure Callback
2385
+ description: |
2386
+ Cancel an in-progress failure callback for a failed workflow.
2387
+
2388
+ When you retry a failed failure callback using the POST endpoint, it enters an in-progress state.
2389
+ This endpoint allows you to cancel that in-progress callback before it completes.
2390
+
2391
+ The callback must be in an in-progress state. If there's no in-progress callback,
2392
+ the request will fail with a 400 error.
2393
+ parameters:
2394
+ - in: path
2395
+ name: dlqId
2396
+ required: true
2397
+ schema:
2398
+ type: string
2399
+ description: The DLQ ID of the workflow run whose in-progress failure callback should be canceled.
2400
+ responses:
2401
+ "302":
2402
+ description: Failure callback canceled successfully
2403
+ "400":
2404
+ description: Bad Request - No in-progress failure callback to cancel, or callback information is invalid
2405
+ content:
2406
+ application/json:
2407
+ schema:
2408
+ $ref: "#/components/schemas/Error"
2409
+ "401":
2410
+ description: Unauthorized
2411
+ content:
2412
+ application/json:
2413
+ schema:
2414
+ $ref: "#/components/schemas/Error"
2415
+ "404":
2416
+ description: Failure callback not found or message not found
2417
+ content:
2418
+ application/json:
2419
+ schema:
2420
+ $ref: "#/components/schemas/Error"
2421
+ "500":
2422
+ description: Internal Server Error
2423
+ content:
2424
+ application/json:
2425
+ schema:
2426
+ $ref: "#/components/schemas/Error"
2427
+ /v2/flowControl:
2428
+ get:
2429
+ summary: List Flow Control Keys
2430
+ description: List all Flow Control keys
2431
+ tags:
2432
+ - Flow Control
2433
+ responses:
2434
+ '200':
2435
+ description: Flow control keys retrieved successfully
2436
+ content:
2437
+ application/json:
2438
+ schema:
2439
+ type: array
2440
+ items:
2441
+ $ref: '#/components/schemas/FlowControlKey'
2442
+ /v2/flowControl/{flowControlKey}:
2443
+ get:
2444
+ summary: Get Flow Control Key
2445
+ description: Get details of a specific Flow Control key
2446
+ tags:
2447
+ - Flow Control
2448
+ parameters:
2449
+ - name: flowControlKey
2450
+ in: path
2451
+ required: true
2452
+ schema:
2453
+ type: string
2454
+ description: The Flow Control key to retrieve
2455
+ responses:
2456
+ '200':
2457
+ description: Flow control key details
2458
+ content:
2459
+ application/json:
2460
+ schema:
2461
+ $ref: '#/components/schemas/FlowControlKey'
2462
+ '404':
2463
+ description: Flow Control key not found
2464
+ content:
2465
+ application/json:
2466
+ schema:
2467
+ $ref: '#/components/schemas/Error'
2468
+ /v2/flowControl/{flowControlKey}/pause:
2469
+ post:
2470
+ summary: Pause Flow Control Key
2471
+ description: Pauses the delivery of messages associated with a specific flow-control key.
2472
+ x-mint:
2473
+ content: |
2474
+ When a flow-control key is paused, messages associated with that key will not be delivered until the key is resumed.
2475
+
2476
+ Messages that are already in the waitlist will remain there. New incoming messages will be added directly to the waitlist.
2477
+
2478
+ While the key is paused, the current rate period continues to elapse and the existing rate count is preserved for that period.
2479
+ tags:
2480
+ - Flow Control
2481
+ parameters:
2482
+ - name: flowControlKey
2483
+ in: path
2484
+ required: true
2485
+ schema:
2486
+ type: string
2487
+ description: The flow-control key to pause.
2488
+ responses:
2489
+ '200':
2490
+ description: The flow-control key has been paused.
2491
+ '400':
2492
+ description: Bad request. Returned when the flow-control key is not provided.
2493
+ content:
2494
+ application/json:
2495
+ schema:
2496
+ $ref: '#/components/schemas/Error'
2497
+ /v2/flowControl/{flowControlKey}/resume:
2498
+ post:
2499
+ summary: Resume Flow Control Key
2500
+ description: Resumes the delivery of messages associated with a specific flow-control key.
2501
+ x-mint:
2502
+ content: |
2503
+ When a flow-control key is resumed, messages associated with that key will begin to be delivered again.
2504
+ tags:
2505
+ - Flow Control
2506
+ parameters:
2507
+ - name: flowControlKey
2508
+ in: path
2509
+ required: true
2510
+ schema:
2511
+ type: string
2512
+ description: The flow-control key to resume.
2513
+ responses:
2514
+ '200':
2515
+ description: The flow-control key has been resumed.
2516
+ '400':
2517
+ description: Bad request. Returned when the flow-control key is not provided.
2518
+ content:
2519
+ application/json:
2520
+ schema:
2521
+ $ref: '#/components/schemas/Error'
2522
+ /v2/flowControl/{flowControlKey}/pin:
2523
+ post:
2524
+ summary: Pin Configuration for Flow Control Key
2525
+ description: Pins a processing configuration for a specific flow-control key.
2526
+ x-mint:
2527
+ content: |
2528
+ Normally, each message sent to QStash includes a flow-control configuration for the corresponding flow-control key.
2529
+ The processing configuration is updated based on configurations provided by incoming messages.
2530
+
2531
+ This means that if you want to change the configuration, you typically need to update it in your code and wait until a new message with the updated configuration is sent.
2532
+
2533
+ By pinning a configuration, you can enforce a fixed configuration for a flow-control key.
2534
+ While pinned, the system ignores configurations provided by incoming messages and continues using the pinned configuration until it is explicitly unpinned.
2535
+
2536
+ This allows you to increase or decrease processing throughput without requiring code changes or waiting for new messages with updated configurations.
2537
+ For example, you can temporarily increase the processing speed to clear a backlog of pending messages, or decrease it when a downstream dependency is experiencing issues.
2538
+
2539
+ <Warning>Pinning a configuration resets the current state (rate count and period) of the flow-control key.</Warning>
2540
+ tags:
2541
+ - Flow Control
2542
+ parameters:
2543
+ - name: flowControlKey
2544
+ in: path
2545
+ required: true
2546
+ schema:
2547
+ type: string
2548
+ description: The flow-control key for which the configuration will be pinned.
2549
+ - name: parallelism
2550
+ in: query
2551
+ schema:
2552
+ type: integer
2553
+ description: The parallelism value to apply to the flow-control key.
2554
+ - name: rate
2555
+ in: query
2556
+ schema:
2557
+ type: integer
2558
+ description: The rate value to apply to the flow-control key.
2559
+ - name: period
2560
+ in: query
2561
+ schema:
2562
+ type: integer
2563
+ description: The period value to apply to the flow-control key, in seconds.
2564
+ responses:
2565
+ '200':
2566
+ description: The flow-control key configuration has been pinned.
2567
+ '400':
2568
+ description: Bad request. Returned when the flow-control key is not provided, or when the parallelism, rate or period values are invalid.
2569
+ content:
2570
+ application/json:
2571
+ schema:
2572
+ $ref: '#/components/schemas/Error'
2573
+ /v2/flowControl/{flowControlKey}/unpin:
2574
+ post:
2575
+ summary: Unpin Configuration for Flow Control Key
2576
+ description: Removes the pinned configuration for a specific flow-control key.
2577
+ x-mint:
2578
+ content: |
2579
+ Normally, each message sent to QStash includes a flow-control configuration for the corresponding flow-control key, and the processing configuration is updated according to incoming messages.
2580
+
2581
+ When a configuration is pinned, the system ignores configurations provided by incoming messages and continues using the pinned configuration.
2582
+
2583
+ Calling this endpoint removes the pinned configuration. After unpinning, the system resumes the default behavior and updates the configuration based on configurations provided by incoming messages.
2584
+
2585
+ Message delivery will initially continue using the last pinned configuration. Once a new message with a different configuration is received, the system updates the configuration accordingly.
2586
+
2587
+ Use this API when you want to return to the default flow-control behavior after temporarily pinning a configuration.
2588
+ tags:
2589
+ - Flow Control
2590
+ parameters:
2591
+ - name: flowControlKey
2592
+ in: path
2593
+ required: true
2594
+ schema:
2595
+ type: string
2596
+ description: The flow-control key for which the configuration will be unpinned.
2597
+ - name: parallelism
2598
+ in: query
2599
+ schema:
2600
+ type: boolean
2601
+ default: false
2602
+ description: The flag to indicate whether to unpin the parallelism configuration.
2603
+ - name: rate
2604
+ in: query
2605
+ schema:
2606
+ type: boolean
2607
+ default: false
2608
+ description: The flag to indicate whether to unpin the rate configuration.
2609
+ responses:
2610
+ '200':
2611
+ description: The flow-control key configuration is pinned
2612
+ '400':
2613
+ description: Bad request. Returned when the flow-control key is not provided.
2614
+ content:
2615
+ application/json:
2616
+ schema:
2617
+ $ref: '#/components/schemas/Error'
2618
+ /v2/flowControl/{flowControlKey}/resetRate:
2619
+ post:
2620
+ summary: Reset Rate for Flow Control Key
2621
+ description: Resets the rate configuration state for a specific flow-control key.
2622
+ x-mint:
2623
+ content: |
2624
+ Rate configuration limits the number of messages delivered within a given time period for messages sharing the same flow-control key.
2625
+
2626
+ When the rate limit is reached, subsequent messages with the same flow-control key are placed in the waitlist and are not delivered until the next time period begins.
2627
+
2628
+ In some situations, you may want to immediately resume message delivery without waiting for the current period to expire. Resetting the rate configuration clears the current rate count and immediately ends the current period.
2629
+
2630
+ After the reset, the current timestamp becomes the start of the new rate period.
2631
+ tags:
2632
+ - Flow Control
2633
+ parameters:
2634
+ - name: flowControlKey
2635
+ in: path
2636
+ required: true
2637
+ schema:
2638
+ type: string
2639
+ description: The flow-control key for which the rate state will be reset.
2640
+ responses:
2641
+ '200':
2642
+ description: The rate state for the flow-control key has been reset.
2643
+ '400':
2644
+ description: Bad request. Returned when the flow-control key is not provided.
2645
+ content:
2646
+ application/json:
2647
+ schema:
2648
+ $ref: '#/components/schemas/Error'
2649
+ '500':
2650
+ description: Internal server error. Returned when an unexpected error occurs.
2651
+ content:
2652
+ application/json:
2653
+ schema:
2654
+ $ref: '#/components/schemas/Error'
2655
+ /v2/globalParallelism:
2656
+ get:
2657
+ summary: Get Global Parallelism
2658
+ description: Returns the current global parallelism usage across all flow control keys
2659
+ tags:
2660
+ - Flow Control
2661
+ responses:
2662
+ '200':
2663
+ description: Global parallelism info retrieved successfully
2664
+ content:
2665
+ application/json:
2666
+ schema:
2667
+ type: object
2668
+ properties:
2669
+ parallelismMax:
2670
+ type: integer
2671
+ description: The configured maximum global parallelism
2672
+ parallelismCount:
2673
+ type: integer
2674
+ description: The current number of messages running globally in parallel
2675
+ /v2/keys:
2676
+ get:
2677
+ summary: Get Signing Keys
2678
+ description: Retrieve your current and next signing keys
2679
+ tags:
2680
+ - Signing Keys
2681
+ responses:
2682
+ '200':
2683
+ description: Signing keys retrieved successfully
2684
+ content:
2685
+ application/json:
2686
+ schema:
2687
+ $ref: '#/components/schemas/SigningKeys'
2688
+ /v2/keys/rotate:
2689
+ post:
2690
+ summary: Rotate Signing Keys
2691
+ description: Rotate your signing keys
2692
+ x-mint:
2693
+ content: |
2694
+ Rotating signing keys lets you switch the keys used to sign messages without causing downtime.
2695
+ This ensures that signatures remain valid and that the application can continue verifying new messages seamlessly.
2696
+
2697
+ During a rotation, the next key becomes the new current key, and a fresh next key is generated.
2698
+
2699
+ Make sure to update your application to use the new current and next keys after rotation.
2700
+ tags:
2701
+ - Signing Keys
2702
+ responses:
2703
+ '200':
2704
+ description: Keys rotated successfully
2705
+ content:
2706
+ application/json:
2707
+ schema:
2708
+ $ref: '#/components/schemas/SigningKeys'
2709
+
2710
+ get:
2711
+ tags:
2712
+ - Flow Control
2713
+ summary: Get Flow Control Key
2714
+ description: |
2715
+ Get details of a specific Flow Control key.
2716
+
2717
+ Flow Control keys are used to manage concurrency and rate limiting for workflow steps.
2718
+ This endpoint returns the current waitlist size for the specified flow control key,
2719
+ which indicates how many workflow steps are currently waiting due to flow control constraints.
2720
+ parameters:
2721
+ - in: path
2722
+ name: flowControlKey
2723
+ required: true
2724
+ schema:
2725
+ type: string
2726
+ description: The Flow Control key to retrieve.
2727
+ responses:
2728
+ "200":
2729
+ description: Flow control key details
2730
+ content:
2731
+ application/json:
2732
+ schema:
2733
+ $ref: "#/components/schemas/FlowControlKey"
2734
+ "400":
2735
+ description: Bad Request
2736
+ content:
2737
+ application/json:
2738
+ schema:
2739
+ $ref: "#/components/schemas/Error"
2740
+ "401":
2741
+ description: Unauthorized
2742
+ content:
2743
+ application/json:
2744
+ schema:
2745
+ $ref: "#/components/schemas/Error"
2746
+ "404":
2747
+ description: Flow Control key not found
2748
+ content:
2749
+ application/json:
2750
+ schema:
2751
+ $ref: "#/components/schemas/Error"
2752
+ "500":
2753
+ description: Internal Server Error
2754
+ content:
2755
+ application/json:
2756
+ schema:
2757
+ $ref: "#/components/schemas/Error"
2758
+ /v2/notify/{eventId}:
2759
+ post:
2760
+ tags:
2761
+ - Notify
2762
+ summary: Notify Event
2763
+ description: |
2764
+ Notify an event to all waiters listening for that event ID.
2765
+
2766
+ This endpoint broadcasts an event to all active waiters that are waiting for the specified event.
2767
+ Each waiting workflow step receives the event data and continues execution.
2768
+
2769
+ **Important:** This is an "unsafe notify" operation - if there are no active waiters when the
2770
+ notification is sent, the event is lost and will not be delivered later. For guaranteed delivery
2771
+ within a specific workflow run, use the `/v2/notify/{workflowRunId}/{eventId}` endpoint instead.
2772
+
2773
+ parameters:
2774
+ - in: path
2775
+ name: eventId
2776
+ required: true
2777
+ schema:
2778
+ type: string
2779
+ description: The event ID that waiters are listening for.
2780
+ requestBody:
2781
+ description: The event data to send to all waiters. This will be the request payload for waiting workflow steps.
2782
+ required: false
2783
+ content:
2784
+ application/json:
2785
+ schema:
2786
+ type: object
2787
+ text/plain:
2788
+ schema:
2789
+ type: string
2790
+ application/octet-stream:
2791
+ schema:
2792
+ type: string
2793
+ format: binary
2794
+ responses:
2795
+ "201":
2796
+ description: Event notification sent successfully
2797
+ content:
2798
+ application/json:
2799
+ schema:
2800
+ type: array
2801
+ items:
2802
+ $ref: "#/components/schemas/NotifyResponse"
2803
+ description: Array of notification results, one for each notified waiter.
2804
+ "400":
2805
+ description: Bad Request - Invalid event ID
2806
+ content:
2807
+ application/json:
2808
+ schema:
2809
+ $ref: "#/components/schemas/Error"
2810
+ "401":
2811
+ description: Unauthorized
2812
+ content:
2813
+ application/json:
2814
+ schema:
2815
+ $ref: "#/components/schemas/Error"
2816
+ "429":
2817
+ description: Rate Limit Exceeded
2818
+ content:
2819
+ application/json:
2820
+ schema:
2821
+ $ref: "#/components/schemas/Error"
2822
+ "500":
2823
+ description: Internal Server Error
2824
+ content:
2825
+ application/json:
2826
+ schema:
2827
+ $ref: "#/components/schemas/Error"
2828
+ /v2/notify/{workflowRunId}/{eventId}:
2829
+ post:
2830
+ tags:
2831
+ - Notify
2832
+ summary: Notify Workflow Run Event
2833
+ description: |
2834
+ Notify an event to a specific workflow run's waiters.
2835
+
2836
+ This endpoint sends an event notification to waiters within a specific workflow run.
2837
+ Unlike the general notify endpoint, this uses a "safe notify" mechanism that guarantees
2838
+ delivery even if no waiter is currently active.
2839
+
2840
+ **Safe Notify Behavior:**
2841
+ - If a waiter is currently active, it receives the notification immediately
2842
+ - If no waiter is active, the notification is saved in the database
2843
+ - When a waiter becomes active later, it will consume the saved notification
2844
+ - This ensures events are never lost due to timing issues
2845
+ parameters:
2846
+ - in: path
2847
+ name: workflowRunId
2848
+ required: true
2849
+ schema:
2850
+ type: string
2851
+ description: The workflow run ID to notify.
2852
+ - in: path
2853
+ name: eventId
2854
+ required: true
2855
+ schema:
2856
+ type: string
2857
+ description: The event ID that waiters are listening for.
2858
+ requestBody:
2859
+ description: The event data to send to the waiter. This will be the request payload for the waiting workflow step.
2860
+ required: false
2861
+ content:
2862
+ application/json:
2863
+ schema:
2864
+ type: object
2865
+ text/plain:
2866
+ schema:
2867
+ type: string
2868
+ application/octet-stream:
2869
+ schema:
2870
+ type: string
2871
+ format: binary
2872
+ responses:
2873
+ "201":
2874
+ description: Event notification sent or saved successfully
2875
+ content:
2876
+ application/json:
2877
+ schema:
2878
+ $ref: "#/components/schemas/NotifyResponse"
2879
+ "400":
2880
+ description: Bad Request - Invalid workflow run ID or event ID
2881
+ content:
2882
+ application/json:
2883
+ schema:
2884
+ $ref: "#/components/schemas/Error"
2885
+ "401":
2886
+ description: Unauthorized
2887
+ content:
2888
+ application/json:
2889
+ schema:
2890
+ $ref: "#/components/schemas/Error"
2891
+ "429":
2892
+ description: Rate Limit Exceeded
2893
+ content:
2894
+ application/json:
2895
+ schema:
2896
+ $ref: "#/components/schemas/Error"
2897
+ "500":
2898
+ description: Internal Server Error
2899
+ content:
2900
+ application/json:
2901
+ schema:
2902
+ $ref: "#/components/schemas/Error"
2903
+ /v2/waiters/{eventId}:
2904
+ get:
2905
+ tags:
2906
+ - Notify
2907
+ summary: List Waiters
2908
+ description: |
2909
+ List all active waiters for a specific event ID.
2910
+
2911
+ Returns information about all workflow runs that are currently waiting for the specified event.
2912
+ parameters:
2913
+ - in: path
2914
+ name: eventId
2915
+ required: true
2916
+ schema:
2917
+ type: string
2918
+ description: The event ID to list waiters for.
2919
+ responses:
2920
+ "200":
2921
+ description: List of active waiters
2922
+ content:
2923
+ application/json:
2924
+ schema:
2925
+ type: array
2926
+ items:
2927
+ $ref: "#/components/schemas/Waiter"
2928
+ description: Array of waiters currently listening for this event.
2929
+ "400":
2930
+ description: Bad Request - Invalid event ID
2931
+ content:
2932
+ application/json:
2933
+ schema:
2934
+ $ref: "#/components/schemas/Error"
2935
+ "401":
2936
+ description: Unauthorized
2937
+ content:
2938
+ application/json:
2939
+ schema:
2940
+ $ref: "#/components/schemas/Error"
2941
+ "500":
2942
+ description: Internal Server Error
2943
+ content:
2944
+ application/json:
2945
+ schema:
2946
+ $ref: "#/components/schemas/Error"