Skip to content

Commit b953966

Browse files
committed
added GET /api/v1/batches/{batchId} docs
1 parent 4e62c4b commit b953966

File tree

3 files changed

+105
-1
lines changed

3 files changed

+105
-1
lines changed

docs/docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
},
244244
{
245245
"group": "Batches API",
246-
"pages": ["management/batches/create", "management/batches/stream-items"]
246+
"pages": ["management/batches/create", "management/batches/retrieve", "management/batches/stream-items"]
247247
},
248248
{
249249
"group": "Runs API",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: "Retrieve a batch"
3+
openapi: "v3-openapi GET /api/v1/batches/{batchId}"
4+
---

docs/v3-openapi.yaml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,6 +2194,106 @@ paths:
21942194
]
21952195
}'
21962196
2197+
"/api/v1/batches/{batchId}":
2198+
parameters:
2199+
- name: batchId
2200+
in: path
2201+
required: true
2202+
schema:
2203+
type: string
2204+
description: The batch ID.
2205+
get:
2206+
operationId: retrieve_batch_v1
2207+
summary: Retrieve a batch
2208+
description: Retrieve a batch by its ID, including its status and the IDs of all runs in the batch.
2209+
responses:
2210+
"200":
2211+
description: Successful request
2212+
content:
2213+
application/json:
2214+
schema:
2215+
type: object
2216+
properties:
2217+
id:
2218+
type: string
2219+
description: The batch ID.
2220+
status:
2221+
type: string
2222+
enum: [PENDING, PROCESSING, COMPLETED, PARTIAL_FAILED, ABORTED]
2223+
description: The current status of the batch.
2224+
idempotencyKey:
2225+
type: string
2226+
nullable: true
2227+
description: The idempotency key provided when triggering, if any.
2228+
createdAt:
2229+
type: string
2230+
format: date-time
2231+
updatedAt:
2232+
type: string
2233+
format: date-time
2234+
runCount:
2235+
type: integer
2236+
description: The total number of runs in the batch.
2237+
runs:
2238+
type: array
2239+
items:
2240+
type: string
2241+
description: Array of run IDs in the batch.
2242+
successfulRunCount:
2243+
type: integer
2244+
nullable: true
2245+
description: Number of successful runs (populated after completion).
2246+
failedRunCount:
2247+
type: integer
2248+
nullable: true
2249+
description: Number of failed runs (populated after completion).
2250+
errors:
2251+
type: array
2252+
nullable: true
2253+
description: Error details for failed items (present for PARTIAL_FAILED batches).
2254+
items:
2255+
type: object
2256+
properties:
2257+
index:
2258+
type: integer
2259+
description: The index of the failed item.
2260+
taskIdentifier:
2261+
type: string
2262+
description: The task identifier of the failed item.
2263+
error:
2264+
type: object
2265+
description: The error details.
2266+
errorCode:
2267+
type: string
2268+
nullable: true
2269+
description: An optional error code.
2270+
"401":
2271+
description: Unauthorized request
2272+
content:
2273+
application/json:
2274+
schema:
2275+
$ref: "#/components/schemas/ErrorResponse"
2276+
"404":
2277+
description: Batch not found
2278+
content:
2279+
application/json:
2280+
schema:
2281+
$ref: "#/components/schemas/ErrorResponse"
2282+
tags:
2283+
- tasks
2284+
security:
2285+
- secretKey: []
2286+
x-codeSamples:
2287+
- lang: typescript
2288+
label: Fetch
2289+
source: |-
2290+
const response = await fetch("https://api.trigger.dev/api/v1/batches/batch_1234", {
2291+
headers: {
2292+
"Authorization": `Bearer ${process.env.TRIGGER_SECRET_KEY}`,
2293+
},
2294+
});
2295+
const batch = await response.json();
2296+
21972297
"/api/v1/queues":
21982298
get:
21992299
operationId: list_queues_v1

0 commit comments

Comments
 (0)