Skip to content

Commit 1436008

Browse files
committed
added GET /api/v1/runs/{runId}/result docs
1 parent 97bf898 commit 1436008

File tree

3 files changed

+84
-1
lines changed

3 files changed

+84
-1
lines changed

docs/docs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@
256256
"management/runs/update-metadata",
257257
"management/runs/add-tags",
258258
"management/runs/retrieve-events",
259-
"management/runs/retrieve-trace"
259+
"management/runs/retrieve-trace",
260+
"management/runs/retrieve-result"
260261
]
261262
},
262263
{
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: "Retrieve run result"
3+
openapi: "v3-openapi GET /api/v1/runs/{runId}/result"
4+
---

docs/v3-openapi.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,84 @@ paths:
12131213
12141214
const handle = await runs.reschedule("run_1234", { delay: new Date("2024-06-29T20:45:56.340Z") });
12151215
1216+
"/api/v1/runs/{runId}/result":
1217+
parameters:
1218+
- $ref: "#/components/parameters/runId"
1219+
get:
1220+
operationId: get_run_result_v1
1221+
summary: Retrieve run result
1222+
description: Returns the execution result of a completed run. Returns 404 if the run doesn't exist or hasn't finished yet.
1223+
responses:
1224+
"200":
1225+
description: Successful request
1226+
content:
1227+
application/json:
1228+
schema:
1229+
type: object
1230+
required: [ok, id]
1231+
properties:
1232+
ok:
1233+
type: boolean
1234+
description: Whether the run completed successfully.
1235+
id:
1236+
type: string
1237+
description: The run ID.
1238+
output:
1239+
type: string
1240+
description: The serialized output (present when ok is true).
1241+
outputType:
1242+
type: string
1243+
description: The content type of the output, e.g. "application/json".
1244+
error:
1245+
type: object
1246+
description: Error details (present when ok is false).
1247+
usage:
1248+
type: object
1249+
description: Execution usage stats.
1250+
properties:
1251+
durationMs:
1252+
type: number
1253+
description: Duration of the run in milliseconds.
1254+
taskIdentifier:
1255+
type: string
1256+
description: The task identifier.
1257+
"401":
1258+
description: Unauthorized request
1259+
content:
1260+
application/json:
1261+
schema:
1262+
type: object
1263+
properties:
1264+
error:
1265+
type: string
1266+
enum:
1267+
- Invalid or Missing API Key
1268+
"404":
1269+
description: Run not found or not yet finished
1270+
content:
1271+
application/json:
1272+
schema:
1273+
type: object
1274+
properties:
1275+
error:
1276+
type: string
1277+
enum:
1278+
- Run either doesn't exist or is not finished
1279+
tags:
1280+
- runs
1281+
security:
1282+
- secretKey: []
1283+
x-codeSamples:
1284+
- lang: typescript
1285+
label: Fetch
1286+
source: |-
1287+
const response = await fetch("https://api.trigger.dev/api/v1/runs/run_1234/result", {
1288+
headers: {
1289+
"Authorization": `Bearer ${process.env.TRIGGER_SECRET_KEY}`,
1290+
},
1291+
});
1292+
const result = await response.json();
1293+
12161294
"/api/v3/runs/{runId}":
12171295
parameters:
12181296
- $ref: "#/components/parameters/runId"

0 commit comments

Comments
 (0)