Skip to content

Commit d4b9e85

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

File tree

3 files changed

+86
-1
lines changed

3 files changed

+86
-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/retrieve", "management/batches/stream-items"]
246+
"pages": ["management/batches/create", "management/batches/retrieve", "management/batches/retrieve-results", "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 batch results"
3+
openapi: "v3-openapi GET /api/v1/batches/{batchId}/results"
4+
---

docs/v3-openapi.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2294,6 +2294,87 @@ paths:
22942294
});
22952295
const batch = await response.json();
22962296
2297+
"/api/v1/batches/{batchId}/results":
2298+
parameters:
2299+
- name: batchId
2300+
in: path
2301+
required: true
2302+
schema:
2303+
type: string
2304+
description: The batch ID.
2305+
get:
2306+
operationId: get_batch_results_v1
2307+
summary: Retrieve batch results
2308+
description: Returns the execution results of all runs in a batch. Returns 404 if the batch doesn't exist.
2309+
responses:
2310+
"200":
2311+
description: Successful request
2312+
content:
2313+
application/json:
2314+
schema:
2315+
type: object
2316+
properties:
2317+
id:
2318+
type: string
2319+
description: The batch ID.
2320+
items:
2321+
type: array
2322+
description: Execution results for each run in the batch.
2323+
items:
2324+
type: object
2325+
required: [ok, id]
2326+
properties:
2327+
ok:
2328+
type: boolean
2329+
description: Whether this run completed successfully.
2330+
id:
2331+
type: string
2332+
description: The run ID.
2333+
output:
2334+
type: string
2335+
description: The serialized output (present when ok is true).
2336+
outputType:
2337+
type: string
2338+
description: The content type of the output, e.g. "application/json".
2339+
error:
2340+
type: object
2341+
description: Error details (present when ok is false).
2342+
usage:
2343+
type: object
2344+
properties:
2345+
durationMs:
2346+
type: number
2347+
description: Duration of the run in milliseconds.
2348+
taskIdentifier:
2349+
type: string
2350+
description: The task identifier.
2351+
"401":
2352+
description: Unauthorized request
2353+
content:
2354+
application/json:
2355+
schema:
2356+
$ref: "#/components/schemas/ErrorResponse"
2357+
"404":
2358+
description: Batch not found
2359+
content:
2360+
application/json:
2361+
schema:
2362+
$ref: "#/components/schemas/ErrorResponse"
2363+
tags:
2364+
- tasks
2365+
security:
2366+
- secretKey: []
2367+
x-codeSamples:
2368+
- lang: typescript
2369+
label: Fetch
2370+
source: |-
2371+
const response = await fetch("https://api.trigger.dev/api/v1/batches/batch_1234/results", {
2372+
headers: {
2373+
"Authorization": `Bearer ${process.env.TRIGGER_SECRET_KEY}`,
2374+
},
2375+
});
2376+
const results = await response.json();
2377+
22972378
"/api/v1/queues":
22982379
get:
22992380
operationId: list_queues_v1

0 commit comments

Comments
 (0)