@@ -2018,6 +2018,89 @@ paths:
20182018 response = requests.post(url, headers=headers, json=data)
20192019 print(response.json())
20202020
2021+ " /api/v1/tasks/{taskId}/batch " :
2022+ parameters :
2023+ - name : taskId
2024+ in : path
2025+ required : true
2026+ schema :
2027+ type : string
2028+ description : The task identifier.
2029+ post :
2030+ operationId : batch_trigger_task_by_id_v1
2031+ summary : Batch trigger a specific task
2032+ description : Batch trigger a specific task with up to 1,000 payloads. All items in the batch run the same task.
2033+ requestBody :
2034+ required : true
2035+ content :
2036+ application/json :
2037+ schema :
2038+ type : object
2039+ required : ["items"]
2040+ properties :
2041+ items :
2042+ type : array
2043+ description : An array of payloads to trigger the task with (max 1,000 items).
2044+ items :
2045+ $ref : " #/components/schemas/TriggerTaskRequestBody"
2046+ responses :
2047+ " 200 " :
2048+ description : Batch triggered successfully
2049+ content :
2050+ application/json :
2051+ schema :
2052+ $ref : " #/components/schemas/BatchTriggerTaskResponse"
2053+ " 400 " :
2054+ description : Invalid request parameters or body
2055+ content :
2056+ application/json :
2057+ schema :
2058+ $ref : " #/components/schemas/ErrorResponse"
2059+ " 401 " :
2060+ description : Unauthorized request
2061+ content :
2062+ application/json :
2063+ schema :
2064+ $ref : " #/components/schemas/ErrorResponse"
2065+ " 404 " :
2066+ description : Task not found
2067+ content :
2068+ application/json :
2069+ schema :
2070+ $ref : " #/components/schemas/ErrorResponse"
2071+ tags :
2072+ - tasks
2073+ security :
2074+ - secretKey : []
2075+ x-codeSamples :
2076+ - lang : typescript
2077+ source : |-
2078+ import { task } from "@trigger.dev/sdk";
2079+
2080+ export const myTask = task({
2081+ id: "my-task",
2082+ run: async (payload: { message: string }) => {
2083+ console.log("Hello, world!");
2084+ }
2085+ });
2086+
2087+ // Somewhere else in your code
2088+ await myTask.batchTrigger([
2089+ { payload: { message: "Hello, world!" } },
2090+ { payload: { message: "Hello again!" } },
2091+ ]);
2092+ - lang : curl
2093+ source : |-
2094+ curl -X POST "https://api.trigger.dev/api/v1/tasks/my-task/batch" \
2095+ -H "Content-Type: application/json" \
2096+ -H "Authorization: Bearer tr_dev_1234" \
2097+ -d '{
2098+ "items": [
2099+ { "payload": { "message": "Hello, world!" } },
2100+ { "payload": { "message": "Hello again!" } }
2101+ ]
2102+ }'
2103+
20212104 " /api/v1/tasks/batch " :
20222105 post :
20232106 operationId : batch_trigger_task_v1
0 commit comments