Skip to content

Commit 8e1232e

Browse files
committed
added POST /api/v1/waitpoints/tokens/{waitpointId}/complete docs
1 parent e62a4a0 commit 8e1232e

File tree

3 files changed

+95
-1
lines changed

3 files changed

+95
-1
lines changed

docs/docs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@
307307
"pages": [
308308
"management/waitpoints/create",
309309
"management/waitpoints/list",
310-
"management/waitpoints/retrieve"
310+
"management/waitpoints/retrieve",
311+
"management/waitpoints/complete"
311312
]
312313
},
313314
{
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: "Complete a waitpoint token"
3+
openapi: "v3-openapi POST /api/v1/waitpoints/tokens/{waitpointId}/complete"
4+
---

docs/v3-openapi.yaml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2805,6 +2805,64 @@ paths:
28052805
console.log(token.id);
28062806
}
28072807
2808+
"/api/v1/waitpoints/tokens/{waitpointId}/complete":
2809+
post:
2810+
operationId: complete_waitpoint_token_v1
2811+
summary: Complete a waitpoint token
2812+
description: >-
2813+
Completes a waitpoint token, unblocking any run that is waiting for it via `wait.forToken()`.
2814+
An optional `data` payload can be passed and will be returned to the waiting run.
2815+
If the token is already completed, this is a no-op and returns `success: true`.
2816+
2817+
2818+
This endpoint accepts both secret API keys and short-lived JWTs (public access tokens),
2819+
making it safe to call from frontend clients.
2820+
parameters:
2821+
- in: path
2822+
name: waitpointId
2823+
required: true
2824+
schema:
2825+
type: string
2826+
description: The ID of the waitpoint token to complete.
2827+
example: waitpoint_abc123
2828+
requestBody:
2829+
required: false
2830+
content:
2831+
application/json:
2832+
schema:
2833+
"$ref": "#/components/schemas/CompleteWaitpointTokenRequest"
2834+
responses:
2835+
"200":
2836+
description: Waitpoint token completed successfully
2837+
content:
2838+
application/json:
2839+
schema:
2840+
"$ref": "#/components/schemas/CompleteWaitpointTokenResponse"
2841+
"401":
2842+
description: Unauthorized
2843+
"404":
2844+
description: Waitpoint token not found
2845+
"500":
2846+
description: Internal Server Error
2847+
tags:
2848+
- waitpoints
2849+
security:
2850+
- secretKey: []
2851+
- publicAccessToken: []
2852+
x-codeSamples:
2853+
- lang: typescript
2854+
source: |-
2855+
import { wait } from "@trigger.dev/sdk";
2856+
2857+
// Complete with data (returned to the waiting run)
2858+
await wait.completeToken(token, {
2859+
status: "approved",
2860+
comment: "Looks good to me!",
2861+
});
2862+
2863+
// Complete with no data
2864+
await wait.completeToken(token, {});
2865+
28082866
"/api/v1/waitpoints/tokens/{waitpointId}":
28092867
get:
28102868
operationId: retrieve_waitpoint_token_v1
@@ -2982,6 +3040,17 @@ components:
29823040
29833041
configure({ accessToken: "tr_pat_1234" });
29843042
```
3043+
3044+
publicAccessToken:
3045+
type: http
3046+
scheme: bearer
3047+
description: |
3048+
A short-lived JWT scoped to a specific waitpoint token. Returned as `publicAccessToken`
3049+
when you call `wait.createToken()` or `POST /api/v1/waitpoints/tokens`.
3050+
3051+
This token is safe to embed in frontend clients — it can only complete the specific
3052+
waitpoint it was issued for and cannot be used for any other API operations.
3053+
29853054
schemas:
29863055
RunTag:
29873056
type: string
@@ -4408,6 +4477,26 @@ components:
44084477
results:
44094478
type: string
44104479
description: CSV-formatted results
4480+
CompleteWaitpointTokenRequest:
4481+
type: object
4482+
properties:
4483+
data:
4484+
description: >-
4485+
Any JSON-serializable value to pass back to the run waiting on this token.
4486+
The data will be returned from `wait.forToken()` as the result payload.
4487+
example:
4488+
status: approved
4489+
comment: Looks good to me!
4490+
CompleteWaitpointTokenResponse:
4491+
type: object
4492+
required:
4493+
- success
4494+
properties:
4495+
success:
4496+
type: boolean
4497+
enum:
4498+
- true
4499+
description: Always `true` when the request succeeds.
44114500
ListWaitpointTokensResult:
44124501
type: object
44134502
required:

0 commit comments

Comments
 (0)