@upstash/workflow 1.4.0 → 1.5.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 +374 -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 +567 -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 +104 -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 +2944 -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,2944 @@
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
+ x-mint: content |
1110
+ You can fetch details about workflow runs, including their state, completed and in-progress steps, and step details.
1111
+
1112
+ The retention duration for completed workflow runs depends on your quota. Please check the [pricing](https://upstash.com/pricing/workflow) page for details.
1113
+ <Note>
1114
+ If you have executed multiple workflow runs with the same workflowRunId, the `workflowRunId` filter will return all of them.
1115
+
1116
+ To uniquely identify a single workflow run, include the `workflowCreatedAt` timestamp in your filter.
1117
+ </Note>
1118
+ parameters:
1119
+ - in: query
1120
+ name: cursor
1121
+ required: false
1122
+ schema:
1123
+ type: string
1124
+ description: Pagination cursor for fetching the next page of results.
1125
+ - in: query
1126
+ name: workflowUrl
1127
+ required: false
1128
+ schema:
1129
+ type: string
1130
+ description: Filter by workflow URL (exact match). Must start with http:// or https://.
1131
+ - in: query
1132
+ name: workflowRunId
1133
+ required: false
1134
+ schema:
1135
+ type: string
1136
+ description: Filter by specific workflow run ID..
1137
+ - in: query
1138
+ name: workflowCreatedAt
1139
+ required: false
1140
+ schema:
1141
+ type: integer
1142
+ format: int64
1143
+ description: Filter by workflow creation timestamp in milliseconds (Unix timestamp).
1144
+ - in: query
1145
+ name: workflowRuns
1146
+ required: false
1147
+ schema:
1148
+ type: string
1149
+ description: |
1150
+ Filter by multiple workflow runs. Provide a comma-separated list of `workflowRunId@workflowCreatedAt` pairs to query specific runs in a single request.
1151
+
1152
+ Example: `workflowRuns=ID1@TS1,ID2@TS2`
1153
+
1154
+ When this parameter is provided, all other filters are ignored.
1155
+ - in: query
1156
+ name: state
1157
+ required: false
1158
+ schema:
1159
+ type: string
1160
+ description: |
1161
+ Filter by workflow or step state. Common states include:
1162
+
1163
+ | Value | Description |
1164
+ | -------------- | -------------------------------------------------------------- |
1165
+ | `RUN_STARTED` | The workflow has started to run and currently in progress. |
1166
+ | `RUN_SUCCESS` | The workflow run has completed succesfully. |
1167
+ | `RUN_FAILED` | Some errors has occured and workflow failed after all retries. |
1168
+ | `RUN_CANCELED` | The workflow run has canceled upon user request. |
1169
+ | `STEP_SUCCESS` | The step succesfully fnished. |
1170
+ | `STEP_RETRY` | The step is being retried. |
1171
+ | `STEP_FAILED` | The step is failed. |
1172
+ | `STEP_PROGRESS` | The step is in progress. |
1173
+ | `STEP_CANCELED` | The step is cancelled manually. |
1174
+ - in: query
1175
+ name: fromDate
1176
+ required: false
1177
+ schema:
1178
+ type: integer
1179
+ format: int64
1180
+ description: Filter events from this date onwards in milliseconds (Unix timestamp). Inclusive.
1181
+ - in: query
1182
+ name: toDate
1183
+ required: false
1184
+ schema:
1185
+ type: integer
1186
+ format: int64
1187
+ description: Filter events up to this date in milliseconds (Unix timestamp). Inclusive.
1188
+ - in: query
1189
+ name: count
1190
+ required: false
1191
+ schema:
1192
+ type: integer
1193
+ default: 1000
1194
+ maximum: 1000
1195
+ description: |
1196
+ Maximum number of results to return per page.
1197
+ - Event mode: Max 1000 (default 1000)
1198
+ - Run mode (groupBy=workflowRunId): Max 10 (default 10)
1199
+ - in: query
1200
+ name: trimBody
1201
+ required: false
1202
+ schema:
1203
+ type: integer
1204
+ default: -1
1205
+ description: |
1206
+ Trim request/response bodies to this many bytes. Use -1 to exclude bodies entirely.
1207
+ Useful for reducing response size when bodies are large.
1208
+ - in: query
1209
+ name: label
1210
+ required: false
1211
+ schema:
1212
+ type: array
1213
+ items:
1214
+ type: string
1215
+ style: form
1216
+ explode: true
1217
+ description: |
1218
+ 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).
1219
+
1220
+ Examples:
1221
+ - `label=my_label`
1222
+ - `label=label_1&label=label_2`
1223
+ - in: query
1224
+ name: flowControlKey
1225
+ required: false
1226
+ schema:
1227
+ type: string
1228
+ description: |
1229
+ Filter workflow run by the flow control key assigned by the user on trigger.
1230
+
1231
+ - in: query
1232
+ name: callerIp
1233
+ required: false
1234
+ schema:
1235
+ type: string
1236
+ description: |
1237
+ Filter workflow run by the callerIp that started to workflow run.
1238
+ responses:
1239
+ "200":
1240
+ description: Workflow logs retrieved successfully
1241
+ content:
1242
+ application/json:
1243
+ schema:
1244
+ type: object
1245
+ properties:
1246
+ cursor:
1247
+ type: string
1248
+ description: Pagination cursor for the next page. Empty if no more results.
1249
+ runs:
1250
+ type: array
1251
+ items:
1252
+ $ref: "#/components/schemas/WorkflowRun"
1253
+ description: Array of complete workflow runs with all steps and metadata.
1254
+ "400":
1255
+ description: Bad Request - Invalid parameters (e.g., invalid cursor, state, or groupBy value)
1256
+ content:
1257
+ application/json:
1258
+ schema:
1259
+ $ref: "#/components/schemas/Error"
1260
+ "401":
1261
+ description: Unauthorized
1262
+ content:
1263
+ application/json:
1264
+ schema:
1265
+ $ref: "#/components/schemas/Error"
1266
+ "429":
1267
+ description: Too Many Requests - Rate limit exceeded
1268
+ content:
1269
+ application/json:
1270
+ schema:
1271
+ $ref: "#/components/schemas/Error"
1272
+ "500":
1273
+ description: Internal Server Error
1274
+ content:
1275
+ application/json:
1276
+ schema:
1277
+ $ref: "#/components/schemas/Error"
1278
+ /v2/workflows/dlq:
1279
+ get:
1280
+ tags:
1281
+ - DLQ
1282
+ summary: List Failed Workflow Runs
1283
+ description: |
1284
+ List and paginate through all failed workflow runs currently in the DLQ.
1285
+
1286
+ Failed workflows end up in the DLQ after exhausting all retry attempts. You can filter,
1287
+ paginate, and inspect these failures to understand what went wrong and decide whether to
1288
+ resume, restart, or delete them.
1289
+ x-mint:
1290
+ content: |
1291
+ <Info>
1292
+ 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.
1293
+
1294
+ 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`).
1295
+ </Info>
1296
+ parameters:
1297
+ - in: query
1298
+ name: cursor
1299
+ required: false
1300
+ schema:
1301
+ type: string
1302
+ description: Pagination cursor. If provided, returns the next page of results.
1303
+ - in: query
1304
+ name: count
1305
+ required: false
1306
+ schema:
1307
+ type: integer
1308
+ default: 100
1309
+ maximum: 100
1310
+ description: The maximum number of failed workflow runs to return per page.
1311
+ - in: query
1312
+ name: fromDate
1313
+ required: false
1314
+ schema:
1315
+ type: integer
1316
+ format: int64
1317
+ description: Filter by starting date in milliseconds (Unix timestamp). This is inclusive.
1318
+ - in: query
1319
+ name: toDate
1320
+ required: false
1321
+ schema:
1322
+ type: integer
1323
+ format: int64
1324
+ description: Filter by ending date in milliseconds (Unix timestamp). This is inclusive.
1325
+ - in: query
1326
+ name: workflowUrl
1327
+ required: false
1328
+ schema:
1329
+ type: array
1330
+ items:
1331
+ type: string
1332
+ description: Filter by workflow URL. Supports multiple values.
1333
+ - in: query
1334
+ name: workflowRunId
1335
+ required: false
1336
+ schema:
1337
+ type: string
1338
+ description: Filter by workflow run ID.
1339
+ - in: query
1340
+ name: workflowCreatedAt
1341
+ required: false
1342
+ schema:
1343
+ type: integer
1344
+ format: int64
1345
+ description: Filter by workflow creation timestamp in milliseconds (Unix timestamp).
1346
+ - in: query
1347
+ name: label
1348
+ required: false
1349
+ schema:
1350
+ type: array
1351
+ items:
1352
+ type: string
1353
+ description: |
1354
+ 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).
1355
+
1356
+ Examples:
1357
+ - `label=my_label`
1358
+ - `label=label_1&label=label_2`
1359
+ - `label=label_1,label_2`
1360
+ - in: query
1361
+ name: failureFunctionState
1362
+ required: false
1363
+ schema:
1364
+ type: array
1365
+ items:
1366
+ type: string
1367
+ description: |
1368
+ Filter by failure function state. Supports multiple values.
1369
+
1370
+ | State | Description |
1371
+ |--------|--------------|
1372
+ | CALLBACK_INPROGRESS | The failure function is in progress. |
1373
+ | CALLBACK_SUCCESS | The failure function run successfully. |
1374
+ | CALLBACK_FAIL | The failure function failed to run. |
1375
+ | CALLBACK_CANCELED | The failure function was manually canceled |
1376
+ - in: query
1377
+ name: callerIp
1378
+ required: false
1379
+ schema:
1380
+ type: array
1381
+ items:
1382
+ type: string
1383
+ description: Filter by IP address of the publisher. Supports multiple values.
1384
+ - in: query
1385
+ name: flowControlKey
1386
+ required: false
1387
+ schema:
1388
+ type: array
1389
+ items:
1390
+ type: string
1391
+ description: Filter by Flow Control Key. Supports multiple values.
1392
+ responses:
1393
+ "200":
1394
+ description: List of failed workflow runs
1395
+ content:
1396
+ application/json:
1397
+ schema:
1398
+ type: object
1399
+ properties:
1400
+ cursor:
1401
+ type: string
1402
+ description: Pagination cursor for the next page. Empty if no more results.
1403
+ messages:
1404
+ type: array
1405
+ items:
1406
+ $ref: "#/components/schemas/WorkflowDLQMessage"
1407
+ description: Array of failed workflow messages.
1408
+ "400":
1409
+ description: Bad Request
1410
+ content:
1411
+ application/json:
1412
+ schema:
1413
+ $ref: "#/components/schemas/Error"
1414
+ "401":
1415
+ description: Unauthorized
1416
+ content:
1417
+ application/json:
1418
+ schema:
1419
+ $ref: "#/components/schemas/Error"
1420
+ "500":
1421
+ description: Internal Server Error
1422
+ content:
1423
+ application/json:
1424
+ schema:
1425
+ $ref: "#/components/schemas/Error"
1426
+ delete:
1427
+ tags:
1428
+ - DLQ
1429
+ summary: Bulk Delete Failed Workflow Runs
1430
+ description: |
1431
+ Delete multiple failed workflow runs from the DLQ.
1432
+
1433
+ 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.
1434
+
1435
+ You can either specify specific DLQ IDs to delete, or use filters to delete matching workflows.
1436
+ When using filters without DLQ IDs, the operation supports pagination via cursor.
1437
+ x-mint:
1438
+ content: |
1439
+ <Info>
1440
+ 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.
1441
+
1442
+ 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`).
1443
+ </Info>
1444
+ parameters:
1445
+ - in: query
1446
+ name: dlqIds
1447
+ required: false
1448
+ schema:
1449
+ type: array
1450
+ items:
1451
+ type: string
1452
+ description: List of specific DLQ IDs to delete. If provided, other filters are ignored.
1453
+ - in: query
1454
+ name: cursor
1455
+ required: false
1456
+ schema:
1457
+ type: string
1458
+ description: Pagination cursor for deleting in batches.
1459
+ - in: query
1460
+ name: count
1461
+ required: false
1462
+ schema:
1463
+ type: integer
1464
+ description: Maximum number of workflows to delete per request.
1465
+ - in: query
1466
+ name: fromDate
1467
+ required: false
1468
+ schema:
1469
+ type: integer
1470
+ format: int64
1471
+ description: Filter by starting date in milliseconds (Unix timestamp). This is inclusive.
1472
+ - in: query
1473
+ name: toDate
1474
+ required: false
1475
+ schema:
1476
+ type: integer
1477
+ format: int64
1478
+ description: Filter by ending date in milliseconds (Unix timestamp). This is inclusive.
1479
+ - in: query
1480
+ name: workflowUrl
1481
+ required: false
1482
+ schema:
1483
+ type: array
1484
+ items:
1485
+ type: string
1486
+ description: Filter by workflow URL. Supports multiple values.
1487
+ - in: query
1488
+ name: workflowRunId
1489
+ required: false
1490
+ schema:
1491
+ type: string
1492
+ description: Filter by workflow run ID.
1493
+ - in: query
1494
+ name: workflowCreatedAt
1495
+ required: false
1496
+ schema:
1497
+ type: integer
1498
+ format: int64
1499
+ description: Filter by workflow creation timestamp in milliseconds (Unix timestamp).
1500
+ - in: query
1501
+ name: label
1502
+ required: false
1503
+ schema:
1504
+ type: array
1505
+ items:
1506
+ type: string
1507
+ description: |
1508
+ 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).
1509
+
1510
+ Examples:
1511
+ - `label=my_label`
1512
+ - `label=label_1&label=label_2`
1513
+ - `label=label_1,label_2`
1514
+ - in: query
1515
+ name: failureFunctionState
1516
+ required: false
1517
+ schema:
1518
+ type: array
1519
+ items:
1520
+ type: string
1521
+ description: |
1522
+ Filter by failure function state. Supports multiple values.
1523
+
1524
+ | State | Description |
1525
+ |--------|--------------|
1526
+ | CALLBACK_INPROGRESS | The failure function is in progress. |
1527
+ | CALLBACK_SUCCESS | The failure function run successfully. |
1528
+ | CALLBACK_FAIL | The failure function failed to run. |
1529
+ | CALLBACK_CANCELED | The failure function was manually canceled |
1530
+ - in: query
1531
+ name: callerIp
1532
+ required: false
1533
+ schema:
1534
+ type: array
1535
+ items:
1536
+ type: string
1537
+ description: Filter by IP address of the publisher. Supports multiple values.
1538
+ - in: query
1539
+ name: flowControlKey
1540
+ required: false
1541
+ schema:
1542
+ type: array
1543
+ items:
1544
+ type: string
1545
+ description: Filter by Flow Control Key. Supports multiple values.
1546
+ responses:
1547
+ "200":
1548
+ description: Workflows deleted successfully
1549
+ content:
1550
+ application/json:
1551
+ schema:
1552
+ type: object
1553
+ properties:
1554
+ deleted:
1555
+ type: integer
1556
+ format: int64
1557
+ description: The number of workflow runs that were deleted.
1558
+ cursor:
1559
+ type: string
1560
+ description: Pagination cursor for the next batch. Only present when using filters without DLQ IDs.
1561
+ "400":
1562
+ description: Bad Request
1563
+ content:
1564
+ application/json:
1565
+ schema:
1566
+ $ref: "#/components/schemas/Error"
1567
+ "401":
1568
+ description: Unauthorized
1569
+ content:
1570
+ application/json:
1571
+ schema:
1572
+ $ref: "#/components/schemas/Error"
1573
+ "500":
1574
+ description: Internal Server Error
1575
+ content:
1576
+ application/json:
1577
+ schema:
1578
+ $ref: "#/components/schemas/Error"
1579
+ /v2/workflows/dlq/{dlqId}:
1580
+ get:
1581
+ tags:
1582
+ - DLQ
1583
+ summary: Get Failed Workflow Run
1584
+ description: |
1585
+ Get details of a specific failed workflow run from the DLQ.
1586
+ parameters:
1587
+ - in: path
1588
+ name: dlqId
1589
+ required: true
1590
+ schema:
1591
+ type: string
1592
+ description: The DLQ ID of the failed workflow run.
1593
+ responses:
1594
+ "200":
1595
+ description: Failed workflow run details
1596
+ content:
1597
+ application/json:
1598
+ schema:
1599
+ $ref: "#/components/schemas/WorkflowDLQMessage"
1600
+ "400":
1601
+ description: Bad Request - Invalid DLQ ID
1602
+ content:
1603
+ application/json:
1604
+ schema:
1605
+ $ref: "#/components/schemas/Error"
1606
+ "401":
1607
+ description: Unauthorized
1608
+ content:
1609
+ application/json:
1610
+ schema:
1611
+ $ref: "#/components/schemas/Error"
1612
+ "404":
1613
+ description: DLQ message not found
1614
+ content:
1615
+ application/json:
1616
+ schema:
1617
+ $ref: "#/components/schemas/Error"
1618
+ "500":
1619
+ description: Internal Server Error
1620
+ content:
1621
+ application/json:
1622
+ schema:
1623
+ $ref: "#/components/schemas/Error"
1624
+ delete:
1625
+ tags:
1626
+ - DLQ
1627
+ summary: Delete Failed Workflow Run
1628
+ description: |
1629
+ Delete a specific failed workflow run from the DLQ.
1630
+
1631
+ Use this endpoint to remove a workflow from the DLQ after you have addressed the issue
1632
+ or determined that the workflow should not be retried.
1633
+ parameters:
1634
+ - in: path
1635
+ name: dlqId
1636
+ required: true
1637
+ schema:
1638
+ type: string
1639
+ description: The DLQ ID of the failed workflow run to delete.
1640
+ responses:
1641
+ "200":
1642
+ description: Workflow deleted successfully
1643
+ "400":
1644
+ description: Bad Request - Invalid DLQ ID
1645
+ content:
1646
+ application/json:
1647
+ schema:
1648
+ $ref: "#/components/schemas/Error"
1649
+ "401":
1650
+ description: Unauthorized
1651
+ content:
1652
+ application/json:
1653
+ schema:
1654
+ $ref: "#/components/schemas/Error"
1655
+ "404":
1656
+ description: DLQ message not found
1657
+ "500":
1658
+ description: Internal Server Error
1659
+ content:
1660
+ application/json:
1661
+ schema:
1662
+ $ref: "#/components/schemas/Error"
1663
+ /v2/workflows/dlq/resume/{dlqId}:
1664
+ post:
1665
+ tags:
1666
+ - DLQ
1667
+ summary: Resume Workflow from DLQ
1668
+ x-mint:
1669
+ content: |
1670
+ When a workflow run fails, it's automatically moved to the DLQ (Dead Letter Queue) where it can be analyzed and resumed.
1671
+ The resume feature allows you to continue a failed workflow run from exactly where it failed, without re-executing successfully completed steps.
1672
+
1673
+ This is particularly useful for long-running workflows where you don't want to lose progress from successful steps when a single step fails.
1674
+
1675
+ When a workflow is resumed, it continues execution from the last failed step. A new workflow run ID is generated,
1676
+ but the workflow maintains the state and results from previously completed steps.
1677
+
1678
+ <Note>
1679
+ You can make changes to the workflow code as long as these changes come after the failed steps.
1680
+ However, making changes before the failed step will break the code and is not allowed.
1681
+
1682
+ For more details, check out [Handle workflow route code changes](/workflow/howto/changes) page.
1683
+ </Note>
1684
+
1685
+ parameters:
1686
+ - in: path
1687
+ name: dlqId
1688
+ required: true
1689
+ schema:
1690
+ type: string
1691
+ description: The DLQ ID of the workflow run to resume.
1692
+ - in: header
1693
+ name: Upstash-Retries
1694
+ required: false
1695
+ schema:
1696
+ type: integer
1697
+ description: Override the number of retries for the remaining workflow steps.
1698
+ - in: header
1699
+ name: Upstash-Delay
1700
+ required: false
1701
+ schema:
1702
+ type: string
1703
+ description: Override the delay before executing the next workflow step. Format is `<value><unit>` (e.g., "10s", "5m").
1704
+ - in: header
1705
+ name: Upstash-Retry-Delay
1706
+ required: false
1707
+ schema:
1708
+ type: string
1709
+ description: Override the retry delay expression for the remaining workflow steps.
1710
+ - in: header
1711
+ name: Upstash-Flow-Control-Key
1712
+ required: false
1713
+ schema:
1714
+ type: string
1715
+ description: Override the flow control key for the remaining workflow steps.
1716
+ - in: header
1717
+ name: Upstash-Flow-Control-Value
1718
+ required: false
1719
+ schema:
1720
+ type: string
1721
+ description: Override the flow control configuration in the format `parallelism=<value>, rate=<value>, period=<value>`.
1722
+ - in: header
1723
+ name: Upstash-Label
1724
+ required: false
1725
+ schema:
1726
+ type: string
1727
+ description: |
1728
+ Override the label(s) for the remaining workflow steps.
1729
+
1730
+ You can assign multiple labels by providing a comma-separated list.
1731
+
1732
+ Example: `label_1,label_2`
1733
+ - in: header
1734
+ name: Upstash-Failure-Callback
1735
+ required: false
1736
+ schema:
1737
+ type: string
1738
+ description: Override the failure callback URL for the remaining workflow steps.
1739
+ responses:
1740
+ "200":
1741
+ description: Workflow resumed successfully
1742
+ content:
1743
+ application/json:
1744
+ schema:
1745
+ type: object
1746
+ properties:
1747
+ workflowRunId:
1748
+ type: string
1749
+ description: The ID of the resumed workflow run (a new ID is generated for the resumed run).
1750
+ workflowCreatedAt:
1751
+ type: integer
1752
+ format: int64
1753
+ description: The timestamp when the resumed workflow run was created (Unix timestamp in milliseconds).
1754
+ "400":
1755
+ description: Bad Request - Invalid DLQ ID, not a workflow message, or workflow doesn't support resume
1756
+ content:
1757
+ application/json:
1758
+ schema:
1759
+ $ref: "#/components/schemas/Error"
1760
+ "401":
1761
+ description: Unauthorized
1762
+ content:
1763
+ application/json:
1764
+ schema:
1765
+ $ref: "#/components/schemas/Error"
1766
+ "404":
1767
+ description: DLQ message not found
1768
+ content:
1769
+ application/json:
1770
+ schema:
1771
+ $ref: "#/components/schemas/Error"
1772
+ "500":
1773
+ description: Internal Server Error
1774
+ content:
1775
+ application/json:
1776
+ schema:
1777
+ $ref: "#/components/schemas/Error"
1778
+ /v2/workflows/dlq/resume:
1779
+ post:
1780
+ tags:
1781
+ - DLQ
1782
+ summary: Bulk Resume Workflows from DLQ
1783
+ description: |
1784
+ When a workflow run fails, it's automatically moved to the DLQ (Dead Letter Queue) where it can be analyzed and resumed.
1785
+ The resume feature allows you to continue a failed workflow run from exactly where it failed, without re-executing successfully completed steps.
1786
+
1787
+ This is particularly useful for long-running workflows where you don't want to lose progress from successful steps when a single step fails.
1788
+
1789
+ When a workflow is resumed, it continues execution from the last failed step. A new workflow run ID is generated,
1790
+ but the workflow maintains the state and results from previously completed steps.
1791
+
1792
+ <Note>
1793
+ You can make changes to the workflow code as long as these changes come after the failed steps.
1794
+ However, making changes before the failed step will break the code and is not allowed.
1795
+
1796
+ For more details, check out [Handle workflow route code changes](/workflow/howto/changes) page.
1797
+ </Note>
1798
+ x-mint:
1799
+ content: |
1800
+ <Info>
1801
+ 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.
1802
+
1803
+ 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`).
1804
+ </Info>
1805
+ parameters:
1806
+ - in: query
1807
+ name: dlqIds
1808
+ required: false
1809
+ schema:
1810
+ type: array
1811
+ items:
1812
+ type: string
1813
+ description: List of specific DLQ IDs to resume. If provided, other filters are ignored.
1814
+ - in: query
1815
+ name: cursor
1816
+ required: false
1817
+ schema:
1818
+ type: string
1819
+ description: Pagination cursor for resuming workflows in batches.
1820
+ - in: query
1821
+ name: count
1822
+ required: false
1823
+ schema:
1824
+ type: integer
1825
+ description: Maximum number of workflows to resume. If not provided, all matching workflows will be resumed.
1826
+ - in: query
1827
+ name: fromDate
1828
+ required: false
1829
+ schema:
1830
+ type: integer
1831
+ format: int64
1832
+ description: Filter workflows by starting date, in milliseconds (Unix timestamp). This is inclusive.
1833
+ - in: query
1834
+ name: toDate
1835
+ required: false
1836
+ schema:
1837
+ type: integer
1838
+ format: int64
1839
+ description: Filter workflows by ending date, in milliseconds (Unix timestamp). This is inclusive.
1840
+ - in: query
1841
+ name: workflowUrl
1842
+ required: false
1843
+ schema:
1844
+ type: array
1845
+ items:
1846
+ type: string
1847
+ description: Filter workflows by workflow URL. Supports multiple values.
1848
+ - in: query
1849
+ name: workflowRunId
1850
+ required: false
1851
+ schema:
1852
+ type: string
1853
+ description: Filter workflows by workflow run ID.
1854
+ - in: query
1855
+ name: workflowCreatedAt
1856
+ required: false
1857
+ schema:
1858
+ type: integer
1859
+ format: int64
1860
+ description: Filter workflows by creation timestamp in milliseconds (Unix timestamp).
1861
+ - in: query
1862
+ name: label
1863
+ required: false
1864
+ schema:
1865
+ type: array
1866
+ items:
1867
+ type: string
1868
+ description: |
1869
+ Filter workflows by label. Supports multiple values. You can pass multiple values to match workflows with any of the given labels (OR logic).
1870
+
1871
+ Examples:
1872
+ - `label=my_label`
1873
+ - `label=label_1&label=label_2`
1874
+ - `label=label_1,label_2`
1875
+ - in: query
1876
+ name: failureFunctionState
1877
+ required: false
1878
+ schema:
1879
+ type: array
1880
+ items:
1881
+ type: string
1882
+ description: |
1883
+ Filter workflows by failure function state. Supports multiple values.
1884
+
1885
+ | State | Description |
1886
+ |--------|--------------|
1887
+ | CALLBACK_INPROGRESS | The failure function is in progress. |
1888
+ | CALLBACK_SUCCESS | The failure function run successfully. |
1889
+ | CALLBACK_FAIL | The failure function failed to run. |
1890
+ | CALLBACK_CANCELED | The failure function was manually canceled |
1891
+ - in: query
1892
+ name: callerIp
1893
+ required: false
1894
+ schema:
1895
+ type: array
1896
+ items:
1897
+ type: string
1898
+ description: Filter workflows by IP address of the publisher. Supports multiple values.
1899
+ - in: query
1900
+ name: flowControlKey
1901
+ required: false
1902
+ schema:
1903
+ type: array
1904
+ items:
1905
+ type: string
1906
+ description: Filter workflows by Flow Control Key. Supports multiple values.
1907
+ - in: header
1908
+ name: Upstash-Retries
1909
+ required: false
1910
+ schema:
1911
+ type: integer
1912
+ description: Override the number of retries for the remaining workflow steps.
1913
+ - in: header
1914
+ name: Upstash-Delay
1915
+ required: false
1916
+ schema:
1917
+ type: string
1918
+ description: Override the delay before executing the next workflow step. Format is `<value><unit>` (e.g., "10s", "5m").
1919
+ - in: header
1920
+ name: Upstash-Retry-Delay
1921
+ required: false
1922
+ schema:
1923
+ type: string
1924
+ description: Override the retry delay expression for the remaining workflow steps.
1925
+ - in: header
1926
+ name: Upstash-Flow-Control-Key
1927
+ required: false
1928
+ schema:
1929
+ type: string
1930
+ description: Override the flow control key for the remaining workflow steps.
1931
+ - in: header
1932
+ name: Upstash-Flow-Control-Value
1933
+ required: false
1934
+ schema:
1935
+ type: string
1936
+ description: Override the flow control configuration in the format `parallelism=<value>, rate=<value>, period=<value>`.
1937
+ - in: header
1938
+ name: Upstash-Label
1939
+ required: false
1940
+ schema:
1941
+ type: string
1942
+ description: |
1943
+ Override the label(s) for the remaining workflow steps.
1944
+
1945
+ You can assign multiple labels by providing a comma-separated list.
1946
+
1947
+ Example: `label_1,label_2`
1948
+ - in: header
1949
+ name: Upstash-Failure-Callback
1950
+ required: false
1951
+ schema:
1952
+ type: string
1953
+ description: Override the failure callback URL for the remaining workflow steps.
1954
+ responses:
1955
+ "200":
1956
+ description: Workflows resumed successfully
1957
+ content:
1958
+ application/json:
1959
+ schema:
1960
+ type: object
1961
+ properties:
1962
+ workflowRuns:
1963
+ type: array
1964
+ items:
1965
+ type: object
1966
+ properties:
1967
+ workflowRunId:
1968
+ type: string
1969
+ description: The ID of the resumed workflow run (a new ID is generated for each resumed run).
1970
+ workflowCreatedAt:
1971
+ type: integer
1972
+ format: int64
1973
+ description: The timestamp when the resumed workflow run was created (Unix timestamp in milliseconds).
1974
+ description: Array of resumed workflow runs.
1975
+ cursor:
1976
+ type: string
1977
+ description: Pagination cursor to use in subsequent requests. If empty, all matching workflows have been processed.
1978
+ "400":
1979
+ description: Bad Request
1980
+ content:
1981
+ application/json:
1982
+ schema:
1983
+ $ref: "#/components/schemas/Error"
1984
+ "401":
1985
+ description: Unauthorized
1986
+ content:
1987
+ application/json:
1988
+ schema:
1989
+ $ref: "#/components/schemas/Error"
1990
+ "404":
1991
+ description: Some DLQ messages were not found
1992
+ content:
1993
+ application/json:
1994
+ schema:
1995
+ $ref: "#/components/schemas/Error"
1996
+ "500":
1997
+ description: Internal Server Error
1998
+ content:
1999
+ application/json:
2000
+ schema:
2001
+ $ref: "#/components/schemas/Error"
2002
+ /v2/workflows/dlq/restart/{dlqId}:
2003
+ post:
2004
+ tags:
2005
+ - DLQ
2006
+ summary: Restart Workflow from DLQ
2007
+ description: |
2008
+ Restart a failed workflow run from the DLQ. The workflow will start from the beginning.
2009
+
2010
+ Unlike resume, which continues from where the workflow failed, restart executes the entire workflow
2011
+ from the first step. A new workflow run ID is generated and all steps will be executed again.
2012
+ parameters:
2013
+ - in: path
2014
+ name: dlqId
2015
+ required: true
2016
+ schema:
2017
+ type: string
2018
+ description: The DLQ ID of the workflow run to restart.
2019
+ - in: header
2020
+ name: Upstash-Retries
2021
+ required: false
2022
+ schema:
2023
+ type: integer
2024
+ description: Override the number of retries for the workflow steps.
2025
+ - in: header
2026
+ name: Upstash-Delay
2027
+ required: false
2028
+ schema:
2029
+ type: string
2030
+ description: Override the delay before executing the workflow. Format is `<value><unit>` (e.g., "10s", "5m").
2031
+ - in: header
2032
+ name: Upstash-Retry-Delay
2033
+ required: false
2034
+ schema:
2035
+ type: string
2036
+ description: Override the retry delay expression for the workflow steps.
2037
+ - in: header
2038
+ name: Upstash-Flow-Control-Key
2039
+ required: false
2040
+ schema:
2041
+ type: string
2042
+ description: Override the flow control key for the workflow.
2043
+ - in: header
2044
+ name: Upstash-Flow-Control-Value
2045
+ required: false
2046
+ schema:
2047
+ type: string
2048
+ description: Override the flow control configuration in the format `parallelism=<value>, rate=<value>, period=<value>`.
2049
+ - in: header
2050
+ name: Upstash-Label
2051
+ required: false
2052
+ schema:
2053
+ type: string
2054
+ description: |
2055
+ Override the label(s) for the workflow.
2056
+
2057
+ You can assign multiple labels by providing a comma-separated list.
2058
+
2059
+ Example: `label_1,label_2`
2060
+ - in: header
2061
+ name: Upstash-Failure-Callback
2062
+ required: false
2063
+ schema:
2064
+ type: string
2065
+ description: Override the failure callback URL for the workflow.
2066
+ responses:
2067
+ "200":
2068
+ description: Workflow restarted successfully
2069
+ content:
2070
+ application/json:
2071
+ schema:
2072
+ type: object
2073
+ properties:
2074
+ workflowRunId:
2075
+ type: string
2076
+ description: The ID of the restarted workflow run (a new ID is generated for the restarted run).
2077
+ workflowCreatedAt:
2078
+ type: integer
2079
+ format: int64
2080
+ description: The timestamp when the restarted workflow run was created (Unix timestamp in milliseconds).
2081
+ "400":
2082
+ description: Bad Request - Invalid DLQ ID, not a workflow message, or workflow doesn't support restart
2083
+ content:
2084
+ application/json:
2085
+ schema:
2086
+ $ref: "#/components/schemas/Error"
2087
+ "401":
2088
+ description: Unauthorized
2089
+ content:
2090
+ application/json:
2091
+ schema:
2092
+ $ref: "#/components/schemas/Error"
2093
+ "404":
2094
+ description: DLQ message not found
2095
+ content:
2096
+ application/json:
2097
+ schema:
2098
+ $ref: "#/components/schemas/Error"
2099
+ "500":
2100
+ description: Internal Server Error
2101
+ content:
2102
+ application/json:
2103
+ schema:
2104
+ $ref: "#/components/schemas/Error"
2105
+ /v2/workflows/dlq/restart:
2106
+ post:
2107
+ tags:
2108
+ - DLQ
2109
+ summary: Bulk Restart Workflows from DLQ
2110
+ description: |
2111
+ Restart multiple failed workflow runs from the DLQ. Each workflow will start from the beginning.
2112
+
2113
+ Unlike resume, which continues from where workflows failed, restart executes the entire workflows
2114
+ from the first step. New workflow run IDs are generated and all steps will be executed again.
2115
+
2116
+ 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.
2117
+ Each restarted workflow run is assigned a new random Run ID.
2118
+ x-mint:
2119
+ content: |
2120
+ <Info>
2121
+ 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.
2122
+
2123
+ 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`).
2124
+ </Info>
2125
+ parameters:
2126
+ - in: query
2127
+ name: dlqIds
2128
+ required: false
2129
+ schema:
2130
+ type: array
2131
+ items:
2132
+ type: string
2133
+ description: List of specific DLQ IDs to restart. If provided, other filters are ignored.
2134
+ - in: query
2135
+ name: cursor
2136
+ required: false
2137
+ schema:
2138
+ type: string
2139
+ description: Pagination cursor for restarting workflows in batches.
2140
+ - in: query
2141
+ name: count
2142
+ required: false
2143
+ schema:
2144
+ type: integer
2145
+ description: Maximum number of workflows to restart. If not provided, all matching workflows will be restarted.
2146
+ - in: query
2147
+ name: fromDate
2148
+ required: false
2149
+ schema:
2150
+ type: integer
2151
+ format: int64
2152
+ description: Filter workflows by starting date, in milliseconds (Unix timestamp). This is inclusive.
2153
+ - in: query
2154
+ name: toDate
2155
+ required: false
2156
+ schema:
2157
+ type: integer
2158
+ format: int64
2159
+ description: Filter workflows by ending date, in milliseconds (Unix timestamp). This is inclusive.
2160
+ - in: query
2161
+ name: workflowUrl
2162
+ required: false
2163
+ schema:
2164
+ type: array
2165
+ items:
2166
+ type: string
2167
+ description: Filter workflows by workflow URL. Supports multiple values.
2168
+ - in: query
2169
+ name: workflowRunId
2170
+ required: false
2171
+ schema:
2172
+ type: string
2173
+ description: Filter workflows by workflow run ID.
2174
+ - in: query
2175
+ name: workflowCreatedAt
2176
+ required: false
2177
+ schema:
2178
+ type: integer
2179
+ format: int64
2180
+ description: Filter workflows by creation timestamp in milliseconds (Unix timestamp).
2181
+ - in: query
2182
+ name: label
2183
+ required: false
2184
+ schema:
2185
+ type: array
2186
+ items:
2187
+ type: string
2188
+ description: |
2189
+ Filter workflows by label. Supports multiple values. You can pass multiple values to match workflows with any of the given labels (OR logic).
2190
+
2191
+ Examples:
2192
+ - `label=my_label`
2193
+ - `label=label_1&label=label_2`
2194
+ - `label=label_1,label_2`
2195
+ - in: query
2196
+ name: failureFunctionState
2197
+ required: false
2198
+ schema:
2199
+ type: array
2200
+ items:
2201
+ type: string
2202
+ description: |
2203
+ Filter workflows by failure function state. Supports multiple values.
2204
+
2205
+ | State | Description |
2206
+ |--------|--------------|
2207
+ | CALLBACK_INPROGRESS | The failure function is in progress. |
2208
+ | CALLBACK_SUCCESS | The failure function run successfully. |
2209
+ | CALLBACK_FAIL | The failure function failed to run. |
2210
+ | CALLBACK_CANCELED | The failure function was manually canceled |
2211
+ - in: query
2212
+ name: callerIp
2213
+ required: false
2214
+ schema:
2215
+ type: array
2216
+ items:
2217
+ type: string
2218
+ description: Filter workflows by IP address of the publisher. Supports multiple values.
2219
+ - in: query
2220
+ name: flowControlKey
2221
+ required: false
2222
+ schema:
2223
+ type: array
2224
+ items:
2225
+ type: string
2226
+ description: Filter workflows by Flow Control Key. Supports multiple values.
2227
+ - in: header
2228
+ name: Upstash-Retries
2229
+ required: false
2230
+ schema:
2231
+ type: integer
2232
+ description: Override the number of retries for the workflow steps.
2233
+ - in: header
2234
+ name: Upstash-Delay
2235
+ required: false
2236
+ schema:
2237
+ type: string
2238
+ description: Override the delay before executing the workflows. Format is `<value><unit>` (e.g., "10s", "5m").
2239
+ - in: header
2240
+ name: Upstash-Retry-Delay
2241
+ required: false
2242
+ schema:
2243
+ type: string
2244
+ description: Override the retry delay expression for the workflow steps.
2245
+ - in: header
2246
+ name: Upstash-Flow-Control-Key
2247
+ required: false
2248
+ schema:
2249
+ type: string
2250
+ description: Override the flow control key for the workflows.
2251
+ - in: header
2252
+ name: Upstash-Flow-Control-Value
2253
+ required: false
2254
+ schema:
2255
+ type: string
2256
+ description: Override the flow control configuration in the format `parallelism=<value>, rate=<value>, period=<value>`.
2257
+ - in: header
2258
+ name: Upstash-Label
2259
+ required: false
2260
+ schema:
2261
+ type: string
2262
+ description: |
2263
+ Override the label(s) for the workflows.
2264
+
2265
+ You can assign multiple labels by providing a comma-separated list.
2266
+
2267
+ Example: `label_1,label_2`
2268
+ - in: header
2269
+ name: Upstash-Failure-Callback
2270
+ required: false
2271
+ schema:
2272
+ type: string
2273
+ description: Override the failure callback URL for the workflows.
2274
+ responses:
2275
+ "200":
2276
+ description: Workflows restarted successfully
2277
+ content:
2278
+ application/json:
2279
+ schema:
2280
+ type: object
2281
+ properties:
2282
+ workflowRuns:
2283
+ type: array
2284
+ items:
2285
+ type: object
2286
+ properties:
2287
+ workflowRunId:
2288
+ type: string
2289
+ description: The ID of the restarted workflow run (a new ID is generated for each restarted run).
2290
+ workflowCreatedAt:
2291
+ type: integer
2292
+ format: int64
2293
+ description: The timestamp when the restarted workflow run was created (Unix timestamp in milliseconds).
2294
+ description: Array of restarted workflow runs.
2295
+ cursor:
2296
+ type: string
2297
+ description: Pagination cursor to use in subsequent requests. If empty, all matching workflows have been processed.
2298
+ "400":
2299
+ description: Bad Request
2300
+ content:
2301
+ application/json:
2302
+ schema:
2303
+ $ref: "#/components/schemas/Error"
2304
+ "401":
2305
+ description: Unauthorized
2306
+ content:
2307
+ application/json:
2308
+ schema:
2309
+ $ref: "#/components/schemas/Error"
2310
+ "404":
2311
+ description: Some DLQ messages were not found
2312
+ content:
2313
+ application/json:
2314
+ schema:
2315
+ $ref: "#/components/schemas/Error"
2316
+ "500":
2317
+ description: Internal Server Error
2318
+ content:
2319
+ application/json:
2320
+ schema:
2321
+ $ref: "#/components/schemas/Error"
2322
+ /v2/workflows/dlq/callback/{dlqId}:
2323
+ post:
2324
+ tags:
2325
+ - DLQ
2326
+ summary: Retry Failure Callback
2327
+ description: |
2328
+ If the failure callback for a workflow run has failed, you can use this endpoint to manually trigger the failure callback again.
2329
+ This is useful for ensuring that your system is notified of workflow failures even if the original callback attempt did not succeed.
2330
+
2331
+ The state of the failure callback for each workflow run is included in the DLQ message response as failureCallbackInfo.state.
2332
+ 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.
2333
+ parameters:
2334
+ - in: path
2335
+ name: dlqId
2336
+ required: true
2337
+ schema:
2338
+ type: string
2339
+ description: The DLQ ID of the failed workflow run whose failure callback should be retried.
2340
+ responses:
2341
+ "200":
2342
+ description: Failure callback retried successfully
2343
+ content:
2344
+ application/json:
2345
+ schema:
2346
+ type: object
2347
+ properties:
2348
+ workflowRunId:
2349
+ type: string
2350
+ description: The ID of the workflow run.
2351
+ workflowCreatedAt:
2352
+ type: integer
2353
+ format: int64
2354
+ description: The timestamp when the workflow run was created (Unix timestamp in milliseconds).
2355
+ "400":
2356
+ description: Bad Request. Workflow doesn't have a failed callback, callback is already in-progress, succeeded, or was canceled
2357
+ content:
2358
+ application/json:
2359
+ schema:
2360
+ $ref: "#/components/schemas/Error"
2361
+ "401":
2362
+ description: Unauthorized
2363
+ content:
2364
+ application/json:
2365
+ schema:
2366
+ $ref: "#/components/schemas/Error"
2367
+ "404":
2368
+ description: DLQ message not found
2369
+ content:
2370
+ application/json:
2371
+ schema:
2372
+ $ref: "#/components/schemas/Error"
2373
+ "500":
2374
+ description: Internal Server Error
2375
+ content:
2376
+ application/json:
2377
+ schema:
2378
+ $ref: "#/components/schemas/Error"
2379
+ delete:
2380
+ tags:
2381
+ - DLQ
2382
+ summary: Cancel In-Progress Failure Callback
2383
+ description: |
2384
+ Cancel an in-progress failure callback for a failed workflow.
2385
+
2386
+ When you retry a failed failure callback using the POST endpoint, it enters an in-progress state.
2387
+ This endpoint allows you to cancel that in-progress callback before it completes.
2388
+
2389
+ The callback must be in an in-progress state. If there's no in-progress callback,
2390
+ the request will fail with a 400 error.
2391
+ parameters:
2392
+ - in: path
2393
+ name: dlqId
2394
+ required: true
2395
+ schema:
2396
+ type: string
2397
+ description: The DLQ ID of the workflow run whose in-progress failure callback should be canceled.
2398
+ responses:
2399
+ "302":
2400
+ description: Failure callback canceled successfully
2401
+ "400":
2402
+ description: Bad Request - No in-progress failure callback to cancel, or callback information is invalid
2403
+ content:
2404
+ application/json:
2405
+ schema:
2406
+ $ref: "#/components/schemas/Error"
2407
+ "401":
2408
+ description: Unauthorized
2409
+ content:
2410
+ application/json:
2411
+ schema:
2412
+ $ref: "#/components/schemas/Error"
2413
+ "404":
2414
+ description: Failure callback not found or message not found
2415
+ content:
2416
+ application/json:
2417
+ schema:
2418
+ $ref: "#/components/schemas/Error"
2419
+ "500":
2420
+ description: Internal Server Error
2421
+ content:
2422
+ application/json:
2423
+ schema:
2424
+ $ref: "#/components/schemas/Error"
2425
+ /v2/flowControl:
2426
+ get:
2427
+ summary: List Flow Control Keys
2428
+ description: List all Flow Control keys
2429
+ tags:
2430
+ - Flow Control
2431
+ responses:
2432
+ '200':
2433
+ description: Flow control keys retrieved successfully
2434
+ content:
2435
+ application/json:
2436
+ schema:
2437
+ type: array
2438
+ items:
2439
+ $ref: '#/components/schemas/FlowControlKey'
2440
+ /v2/flowControl/{flowControlKey}:
2441
+ get:
2442
+ summary: Get Flow Control Key
2443
+ description: Get details of a specific Flow Control key
2444
+ tags:
2445
+ - Flow Control
2446
+ parameters:
2447
+ - name: flowControlKey
2448
+ in: path
2449
+ required: true
2450
+ schema:
2451
+ type: string
2452
+ description: The Flow Control key to retrieve
2453
+ responses:
2454
+ '200':
2455
+ description: Flow control key details
2456
+ content:
2457
+ application/json:
2458
+ schema:
2459
+ $ref: '#/components/schemas/FlowControlKey'
2460
+ '404':
2461
+ description: Flow Control key not found
2462
+ content:
2463
+ application/json:
2464
+ schema:
2465
+ $ref: '#/components/schemas/Error'
2466
+ /v2/flowControl/{flowControlKey}/pause:
2467
+ post:
2468
+ summary: Pause Flow Control Key
2469
+ description: Pauses the delivery of messages associated with a specific flow-control key.
2470
+ x-mint:
2471
+ content: |
2472
+ When a flow-control key is paused, messages associated with that key will not be delivered until the key is resumed.
2473
+
2474
+ Messages that are already in the waitlist will remain there. New incoming messages will be added directly to the waitlist.
2475
+
2476
+ While the key is paused, the current rate period continues to elapse and the existing rate count is preserved for that period.
2477
+ tags:
2478
+ - Flow Control
2479
+ parameters:
2480
+ - name: flowControlKey
2481
+ in: path
2482
+ required: true
2483
+ schema:
2484
+ type: string
2485
+ description: The flow-control key to pause.
2486
+ responses:
2487
+ '200':
2488
+ description: The flow-control key has been paused.
2489
+ '400':
2490
+ description: Bad request. Returned when the flow-control key is not provided.
2491
+ content:
2492
+ application/json:
2493
+ schema:
2494
+ $ref: '#/components/schemas/Error'
2495
+ /v2/flowControl/{flowControlKey}/resume:
2496
+ post:
2497
+ summary: Resume Flow Control Key
2498
+ description: Resumes the delivery of messages associated with a specific flow-control key.
2499
+ x-mint:
2500
+ content: |
2501
+ When a flow-control key is resumed, messages associated with that key will begin to be delivered again.
2502
+ tags:
2503
+ - Flow Control
2504
+ parameters:
2505
+ - name: flowControlKey
2506
+ in: path
2507
+ required: true
2508
+ schema:
2509
+ type: string
2510
+ description: The flow-control key to resume.
2511
+ responses:
2512
+ '200':
2513
+ description: The flow-control key has been resumed.
2514
+ '400':
2515
+ description: Bad request. Returned when the flow-control key is not provided.
2516
+ content:
2517
+ application/json:
2518
+ schema:
2519
+ $ref: '#/components/schemas/Error'
2520
+ /v2/flowControl/{flowControlKey}/pin:
2521
+ post:
2522
+ summary: Pin Configuration for Flow Control Key
2523
+ description: Pins a processing configuration for a specific flow-control key.
2524
+ x-mint:
2525
+ content: |
2526
+ Normally, each message sent to QStash includes a flow-control configuration for the corresponding flow-control key.
2527
+ The processing configuration is updated based on configurations provided by incoming messages.
2528
+
2529
+ 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.
2530
+
2531
+ By pinning a configuration, you can enforce a fixed configuration for a flow-control key.
2532
+ While pinned, the system ignores configurations provided by incoming messages and continues using the pinned configuration until it is explicitly unpinned.
2533
+
2534
+ This allows you to increase or decrease processing throughput without requiring code changes or waiting for new messages with updated configurations.
2535
+ 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.
2536
+
2537
+ <Warning>Pinning a configuration resets the current state (rate count and period) of the flow-control key.</Warning>
2538
+ tags:
2539
+ - Flow Control
2540
+ parameters:
2541
+ - name: flowControlKey
2542
+ in: path
2543
+ required: true
2544
+ schema:
2545
+ type: string
2546
+ description: The flow-control key for which the configuration will be pinned.
2547
+ - name: parallelism
2548
+ in: query
2549
+ schema:
2550
+ type: integer
2551
+ description: The parallelism value to apply to the flow-control key.
2552
+ - name: rate
2553
+ in: query
2554
+ schema:
2555
+ type: integer
2556
+ description: The rate value to apply to the flow-control key.
2557
+ - name: period
2558
+ in: query
2559
+ schema:
2560
+ type: integer
2561
+ description: The period value to apply to the flow-control key, in seconds.
2562
+ responses:
2563
+ '200':
2564
+ description: The flow-control key configuration has been pinned.
2565
+ '400':
2566
+ description: Bad request. Returned when the flow-control key is not provided, or when the parallelism, rate or period values are invalid.
2567
+ content:
2568
+ application/json:
2569
+ schema:
2570
+ $ref: '#/components/schemas/Error'
2571
+ /v2/flowControl/{flowControlKey}/unpin:
2572
+ post:
2573
+ summary: Unpin Configuration for Flow Control Key
2574
+ description: Removes the pinned configuration for a specific flow-control key.
2575
+ x-mint:
2576
+ content: |
2577
+ 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.
2578
+
2579
+ When a configuration is pinned, the system ignores configurations provided by incoming messages and continues using the pinned configuration.
2580
+
2581
+ 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.
2582
+
2583
+ 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.
2584
+
2585
+ Use this API when you want to return to the default flow-control behavior after temporarily pinning a configuration.
2586
+ tags:
2587
+ - Flow Control
2588
+ parameters:
2589
+ - name: flowControlKey
2590
+ in: path
2591
+ required: true
2592
+ schema:
2593
+ type: string
2594
+ description: The flow-control key for which the configuration will be unpinned.
2595
+ - name: parallelism
2596
+ in: query
2597
+ schema:
2598
+ type: boolean
2599
+ default: false
2600
+ description: The flag to indicate whether to unpin the parallelism configuration.
2601
+ - name: rate
2602
+ in: query
2603
+ schema:
2604
+ type: boolean
2605
+ default: false
2606
+ description: The flag to indicate whether to unpin the rate configuration.
2607
+ responses:
2608
+ '200':
2609
+ description: The flow-control key configuration is pinned
2610
+ '400':
2611
+ description: Bad request. Returned when the flow-control key is not provided.
2612
+ content:
2613
+ application/json:
2614
+ schema:
2615
+ $ref: '#/components/schemas/Error'
2616
+ /v2/flowControl/{flowControlKey}/resetRate:
2617
+ post:
2618
+ summary: Reset Rate for Flow Control Key
2619
+ description: Resets the rate configuration state for a specific flow-control key.
2620
+ x-mint:
2621
+ content: |
2622
+ Rate configuration limits the number of messages delivered within a given time period for messages sharing the same flow-control key.
2623
+
2624
+ 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.
2625
+
2626
+ 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.
2627
+
2628
+ After the reset, the current timestamp becomes the start of the new rate period.
2629
+ tags:
2630
+ - Flow Control
2631
+ parameters:
2632
+ - name: flowControlKey
2633
+ in: path
2634
+ required: true
2635
+ schema:
2636
+ type: string
2637
+ description: The flow-control key for which the rate state will be reset.
2638
+ responses:
2639
+ '200':
2640
+ description: The rate state for the flow-control key has been reset.
2641
+ '400':
2642
+ description: Bad request. Returned when the flow-control key is not provided.
2643
+ content:
2644
+ application/json:
2645
+ schema:
2646
+ $ref: '#/components/schemas/Error'
2647
+ '500':
2648
+ description: Internal server error. Returned when an unexpected error occurs.
2649
+ content:
2650
+ application/json:
2651
+ schema:
2652
+ $ref: '#/components/schemas/Error'
2653
+ /v2/globalParallelism:
2654
+ get:
2655
+ summary: Get Global Parallelism
2656
+ description: Returns the current global parallelism usage across all flow control keys
2657
+ tags:
2658
+ - Flow Control
2659
+ responses:
2660
+ '200':
2661
+ description: Global parallelism info retrieved successfully
2662
+ content:
2663
+ application/json:
2664
+ schema:
2665
+ type: object
2666
+ properties:
2667
+ parallelismMax:
2668
+ type: integer
2669
+ description: The configured maximum global parallelism
2670
+ parallelismCount:
2671
+ type: integer
2672
+ description: The current number of messages running globally in parallel
2673
+ /v2/keys:
2674
+ get:
2675
+ summary: Get Signing Keys
2676
+ description: Retrieve your current and next signing keys
2677
+ tags:
2678
+ - Signing Keys
2679
+ responses:
2680
+ '200':
2681
+ description: Signing keys retrieved successfully
2682
+ content:
2683
+ application/json:
2684
+ schema:
2685
+ $ref: '#/components/schemas/SigningKeys'
2686
+ /v2/keys/rotate:
2687
+ post:
2688
+ summary: Rotate Signing Keys
2689
+ description: Rotate your signing keys
2690
+ x-mint:
2691
+ content: |
2692
+ Rotating signing keys lets you switch the keys used to sign messages without causing downtime.
2693
+ This ensures that signatures remain valid and that the application can continue verifying new messages seamlessly.
2694
+
2695
+ During a rotation, the next key becomes the new current key, and a fresh next key is generated.
2696
+
2697
+ Make sure to update your application to use the new current and next keys after rotation.
2698
+ tags:
2699
+ - Signing Keys
2700
+ responses:
2701
+ '200':
2702
+ description: Keys rotated successfully
2703
+ content:
2704
+ application/json:
2705
+ schema:
2706
+ $ref: '#/components/schemas/SigningKeys'
2707
+
2708
+ get:
2709
+ tags:
2710
+ - Flow Control
2711
+ summary: Get Flow Control Key
2712
+ description: |
2713
+ Get details of a specific Flow Control key.
2714
+
2715
+ Flow Control keys are used to manage concurrency and rate limiting for workflow steps.
2716
+ This endpoint returns the current waitlist size for the specified flow control key,
2717
+ which indicates how many workflow steps are currently waiting due to flow control constraints.
2718
+ parameters:
2719
+ - in: path
2720
+ name: flowControlKey
2721
+ required: true
2722
+ schema:
2723
+ type: string
2724
+ description: The Flow Control key to retrieve.
2725
+ responses:
2726
+ "200":
2727
+ description: Flow control key details
2728
+ content:
2729
+ application/json:
2730
+ schema:
2731
+ $ref: "#/components/schemas/FlowControlKey"
2732
+ "400":
2733
+ description: Bad Request
2734
+ content:
2735
+ application/json:
2736
+ schema:
2737
+ $ref: "#/components/schemas/Error"
2738
+ "401":
2739
+ description: Unauthorized
2740
+ content:
2741
+ application/json:
2742
+ schema:
2743
+ $ref: "#/components/schemas/Error"
2744
+ "404":
2745
+ description: Flow Control key not found
2746
+ content:
2747
+ application/json:
2748
+ schema:
2749
+ $ref: "#/components/schemas/Error"
2750
+ "500":
2751
+ description: Internal Server Error
2752
+ content:
2753
+ application/json:
2754
+ schema:
2755
+ $ref: "#/components/schemas/Error"
2756
+ /v2/notify/{eventId}:
2757
+ post:
2758
+ tags:
2759
+ - Notify
2760
+ summary: Notify Event
2761
+ description: |
2762
+ Notify an event to all waiters listening for that event ID.
2763
+
2764
+ This endpoint broadcasts an event to all active waiters that are waiting for the specified event.
2765
+ Each waiting workflow step receives the event data and continues execution.
2766
+
2767
+ **Important:** This is an "unsafe notify" operation - if there are no active waiters when the
2768
+ notification is sent, the event is lost and will not be delivered later. For guaranteed delivery
2769
+ within a specific workflow run, use the `/v2/notify/{workflowRunId}/{eventId}` endpoint instead.
2770
+
2771
+ parameters:
2772
+ - in: path
2773
+ name: eventId
2774
+ required: true
2775
+ schema:
2776
+ type: string
2777
+ description: The event ID that waiters are listening for.
2778
+ requestBody:
2779
+ description: The event data to send to all waiters. This will be the request payload for waiting workflow steps.
2780
+ required: false
2781
+ content:
2782
+ application/json:
2783
+ schema:
2784
+ type: object
2785
+ text/plain:
2786
+ schema:
2787
+ type: string
2788
+ application/octet-stream:
2789
+ schema:
2790
+ type: string
2791
+ format: binary
2792
+ responses:
2793
+ "201":
2794
+ description: Event notification sent successfully
2795
+ content:
2796
+ application/json:
2797
+ schema:
2798
+ type: array
2799
+ items:
2800
+ $ref: "#/components/schemas/NotifyResponse"
2801
+ description: Array of notification results, one for each notified waiter.
2802
+ "400":
2803
+ description: Bad Request - Invalid event ID
2804
+ content:
2805
+ application/json:
2806
+ schema:
2807
+ $ref: "#/components/schemas/Error"
2808
+ "401":
2809
+ description: Unauthorized
2810
+ content:
2811
+ application/json:
2812
+ schema:
2813
+ $ref: "#/components/schemas/Error"
2814
+ "429":
2815
+ description: Rate Limit Exceeded
2816
+ content:
2817
+ application/json:
2818
+ schema:
2819
+ $ref: "#/components/schemas/Error"
2820
+ "500":
2821
+ description: Internal Server Error
2822
+ content:
2823
+ application/json:
2824
+ schema:
2825
+ $ref: "#/components/schemas/Error"
2826
+ /v2/notify/{workflowRunId}/{eventId}:
2827
+ post:
2828
+ tags:
2829
+ - Notify
2830
+ summary: Notify Workflow Run Event
2831
+ description: |
2832
+ Notify an event to a specific workflow run's waiters.
2833
+
2834
+ This endpoint sends an event notification to waiters within a specific workflow run.
2835
+ Unlike the general notify endpoint, this uses a "safe notify" mechanism that guarantees
2836
+ delivery even if no waiter is currently active.
2837
+
2838
+ **Safe Notify Behavior:**
2839
+ - If a waiter is currently active, it receives the notification immediately
2840
+ - If no waiter is active, the notification is saved in the database
2841
+ - When a waiter becomes active later, it will consume the saved notification
2842
+ - This ensures events are never lost due to timing issues
2843
+ parameters:
2844
+ - in: path
2845
+ name: workflowRunId
2846
+ required: true
2847
+ schema:
2848
+ type: string
2849
+ description: The workflow run ID to notify.
2850
+ - in: path
2851
+ name: eventId
2852
+ required: true
2853
+ schema:
2854
+ type: string
2855
+ description: The event ID that waiters are listening for.
2856
+ requestBody:
2857
+ description: The event data to send to the waiter. This will be the request payload for the waiting workflow step.
2858
+ required: false
2859
+ content:
2860
+ application/json:
2861
+ schema:
2862
+ type: object
2863
+ text/plain:
2864
+ schema:
2865
+ type: string
2866
+ application/octet-stream:
2867
+ schema:
2868
+ type: string
2869
+ format: binary
2870
+ responses:
2871
+ "201":
2872
+ description: Event notification sent or saved successfully
2873
+ content:
2874
+ application/json:
2875
+ schema:
2876
+ $ref: "#/components/schemas/NotifyResponse"
2877
+ "400":
2878
+ description: Bad Request - Invalid workflow run ID or event ID
2879
+ content:
2880
+ application/json:
2881
+ schema:
2882
+ $ref: "#/components/schemas/Error"
2883
+ "401":
2884
+ description: Unauthorized
2885
+ content:
2886
+ application/json:
2887
+ schema:
2888
+ $ref: "#/components/schemas/Error"
2889
+ "429":
2890
+ description: Rate Limit Exceeded
2891
+ content:
2892
+ application/json:
2893
+ schema:
2894
+ $ref: "#/components/schemas/Error"
2895
+ "500":
2896
+ description: Internal Server Error
2897
+ content:
2898
+ application/json:
2899
+ schema:
2900
+ $ref: "#/components/schemas/Error"
2901
+ /v2/waiters/{eventId}:
2902
+ get:
2903
+ tags:
2904
+ - Notify
2905
+ summary: List Waiters
2906
+ description: |
2907
+ List all active waiters for a specific event ID.
2908
+
2909
+ Returns information about all workflow runs that are currently waiting for the specified event.
2910
+ parameters:
2911
+ - in: path
2912
+ name: eventId
2913
+ required: true
2914
+ schema:
2915
+ type: string
2916
+ description: The event ID to list waiters for.
2917
+ responses:
2918
+ "200":
2919
+ description: List of active waiters
2920
+ content:
2921
+ application/json:
2922
+ schema:
2923
+ type: array
2924
+ items:
2925
+ $ref: "#/components/schemas/Waiter"
2926
+ description: Array of waiters currently listening for this event.
2927
+ "400":
2928
+ description: Bad Request - Invalid event ID
2929
+ content:
2930
+ application/json:
2931
+ schema:
2932
+ $ref: "#/components/schemas/Error"
2933
+ "401":
2934
+ description: Unauthorized
2935
+ content:
2936
+ application/json:
2937
+ schema:
2938
+ $ref: "#/components/schemas/Error"
2939
+ "500":
2940
+ description: Internal Server Error
2941
+ content:
2942
+ application/json:
2943
+ schema:
2944
+ $ref: "#/components/schemas/Error"