@@ -1297,19 +1297,17 @@ paths:
1297
1297
response = requests.post(url, headers=headers, json=data)
1298
1298
print(response.json())
1299
1299
1300
- " /api/v1/tasks/{taskIdentifier}/batch " :
1301
- parameters :
1302
- - $ref : " #/components/parameters/taskIdentifier"
1300
+ " /api/v1/tasks/batch " :
1303
1301
post :
1304
1302
operationId : batch_trigger_task_v1
1305
- summary : Batch trigger a task
1306
- description : Batch trigger a task with up to 100 payloads.
1303
+ summary : Batch trigger tasks
1304
+ description : Batch trigger tasks with up to 500 payloads.
1307
1305
requestBody :
1308
1306
required : true
1309
1307
content :
1310
1308
application/json :
1311
1309
schema :
1312
- " $ref " : " #/components/schemas/BatchTriggerRequestBody "
1310
+ " $ref " : " #/components/schemas/BatchTriggerV2RequestBody "
1313
1311
responses :
1314
1312
" 200 " :
1315
1313
description : Task batch triggered successfully
@@ -1352,29 +1350,28 @@ paths:
1352
1350
});
1353
1351
1354
1352
// Somewhere else in your code
1355
- await myTask.batchTrigger({
1356
- items: [
1357
- {
1358
- payload: { message: "Hello, world!" },
1359
- options: {
1360
- idempotencyKey: "unique-key-123",
1361
- concurrencyKey: "user-123-task",
1362
- queue: {
1363
- name: "my-task-queue",
1364
- concurrencyLimit: 5
1365
- }
1353
+ await myTask.batchTrigger([
1354
+ {
1355
+ payload: { message: "Hello, world!" },
1356
+ options: {
1357
+ idempotencyKey: "unique-key-123",
1358
+ concurrencyKey: "user-123-task",
1359
+ queue: {
1360
+ name: "my-task-queue",
1361
+ concurrencyLimit: 5
1366
1362
}
1367
1363
}
1368
- ]
1369
- } );
1364
+ }
1365
+ ] );
1370
1366
- lang : curl
1371
1367
source : |-
1372
- curl -X POST "https://api.trigger.dev/api/v1/tasks/my-task/ batch" \
1368
+ curl -X POST "https://api.trigger.dev/api/v1/tasks/batch" \
1373
1369
-H "Content-Type: application/json" \
1374
1370
-H "Authorization: Bearer tr_dev_1234" \
1375
1371
-d '{
1376
1372
"items": [
1377
1373
{
1374
+ "task": "my-task",
1378
1375
"payload": {
1379
1376
"message": "Hello, world!"
1380
1377
},
@@ -1547,6 +1544,15 @@ components:
1547
1544
" $ref " : " #/components/schemas/TriggerTaskRequestBody"
1548
1545
description : An array of payloads to trigger the task with
1549
1546
required : ["items"]
1547
+ BatchTriggerV2RequestBody :
1548
+ type : object
1549
+ properties :
1550
+ items :
1551
+ type : array
1552
+ items :
1553
+ " $ref " : " #/components/schemas/BatchTriggerTaskRequestBodyItem"
1554
+ description : An array of payloads to trigger the task with
1555
+ required : ["items"]
1550
1556
BatchTriggerTaskResponse :
1551
1557
type : object
1552
1558
required : ["batchId", "runs"]
@@ -1560,6 +1566,17 @@ components:
1560
1566
items :
1561
1567
type : string
1562
1568
description : An array of run IDs that were triggered
1569
+ BatchTriggerTaskRequestBodyItem :
1570
+ type : object
1571
+ allOf :
1572
+ - $ref : " #/components/schemas/TriggerTaskRequestBody"
1573
+ - type : object
1574
+ properties :
1575
+ task :
1576
+ type : string
1577
+ description : The task identifier to trigger. This is the `id` set in your `task()` functions.
1578
+ required :
1579
+ - task
1563
1580
TriggerTaskRequestBody :
1564
1581
type : object
1565
1582
properties :
0 commit comments