@@ -1297,19 +1297,17 @@ paths:
12971297 response = requests.post(url, headers=headers, json=data)
12981298 print(response.json())
12991299
1300- " /api/v1/tasks/{taskIdentifier}/batch " :
1301- parameters :
1302- - $ref : " #/components/parameters/taskIdentifier"
1300+ " /api/v1/tasks/batch " :
13031301 post :
13041302 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.
13071305 requestBody :
13081306 required : true
13091307 content :
13101308 application/json :
13111309 schema :
1312- " $ref " : " #/components/schemas/BatchTriggerRequestBody "
1310+ " $ref " : " #/components/schemas/BatchTriggerV2RequestBody "
13131311 responses :
13141312 " 200 " :
13151313 description : Task batch triggered successfully
@@ -1352,29 +1350,28 @@ paths:
13521350 });
13531351
13541352 // 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
13661362 }
13671363 }
1368- ]
1369- } );
1364+ }
1365+ ] );
13701366 - lang : curl
13711367 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" \
13731369 -H "Content-Type: application/json" \
13741370 -H "Authorization: Bearer tr_dev_1234" \
13751371 -d '{
13761372 "items": [
13771373 {
1374+ "task": "my-task",
13781375 "payload": {
13791376 "message": "Hello, world!"
13801377 },
@@ -1547,6 +1544,15 @@ components:
15471544 " $ref " : " #/components/schemas/TriggerTaskRequestBody"
15481545 description : An array of payloads to trigger the task with
15491546 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"]
15501556 BatchTriggerTaskResponse :
15511557 type : object
15521558 required : ["batchId", "runs"]
@@ -1560,6 +1566,17 @@ components:
15601566 items :
15611567 type : string
15621568 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
15631580 TriggerTaskRequestBody :
15641581 type : object
15651582 properties :
0 commit comments