@@ -2700,6 +2700,49 @@ paths:
27002700 console.log(token.id); // e.g. "waitpoint_abc123"
27012701 console.log(token.url); // HTTP callback URL to complete externally
27022702
2703+ " /api/v1/waitpoints/tokens/{waitpointId} " :
2704+ get :
2705+ operationId : retrieve_waitpoint_token_v1
2706+ summary : Retrieve a waitpoint token
2707+ description : >-
2708+ Retrieves a waitpoint token by its ID, including its current status and output
2709+ if it has been completed.
2710+ parameters :
2711+ - in : path
2712+ name : waitpointId
2713+ required : true
2714+ schema :
2715+ type : string
2716+ description : The ID of the waitpoint token.
2717+ example : waitpoint_abc123
2718+ responses :
2719+ " 200 " :
2720+ description : Successful request
2721+ content :
2722+ application/json :
2723+ schema :
2724+ " $ref " : " #/components/schemas/WaitpointTokenObject"
2725+ " 401 " :
2726+ description : Unauthorized
2727+ " 404 " :
2728+ description : Waitpoint token not found
2729+ tags :
2730+ - waitpoints
2731+ security :
2732+ - secretKey : []
2733+ x-codeSamples :
2734+ - lang : typescript
2735+ source : |-
2736+ import { wait } from "@trigger.dev/sdk";
2737+
2738+ const token = await wait.retrieveToken("waitpoint_abc123");
2739+
2740+ console.log(token.status); // "WAITING" | "COMPLETED" | "TIMED_OUT"
2741+
2742+ if (token.status === "COMPLETED") {
2743+ console.log(token.output);
2744+ }
2745+
27032746components :
27042747 parameters :
27052748 taskIdentifier :
@@ -4260,6 +4303,74 @@ components:
42604303 results :
42614304 type : string
42624305 description : CSV-formatted results
4306+ WaitpointTokenObject :
4307+ type : object
4308+ required :
4309+ - id
4310+ - url
4311+ - status
4312+ - tags
4313+ - createdAt
4314+ properties :
4315+ id :
4316+ type : string
4317+ description : The unique ID of the waitpoint token.
4318+ example : waitpoint_abc123
4319+ url :
4320+ type : string
4321+ description : >-
4322+ An HTTP callback URL. A POST request to this URL (with an optional JSON body)
4323+ will complete the waitpoint without needing an API key.
4324+ example : https://api.trigger.dev/api/v1/waitpoints/tokens/waitpoint_abc123/callback/abc123hash
4325+ status :
4326+ type : string
4327+ enum :
4328+ - WAITING
4329+ - COMPLETED
4330+ - TIMED_OUT
4331+ description : The current status of the waitpoint token.
4332+ idempotencyKey :
4333+ type : string
4334+ nullable : true
4335+ description : The idempotency key used when creating the token, if any.
4336+ idempotencyKeyExpiresAt :
4337+ type : string
4338+ format : date-time
4339+ nullable : true
4340+ description : When the idempotency key expires.
4341+ timeoutAt :
4342+ type : string
4343+ format : date-time
4344+ nullable : true
4345+ description : When the token will time out, if a timeout was set.
4346+ completedAt :
4347+ type : string
4348+ format : date-time
4349+ nullable : true
4350+ description : When the token was completed, if it has been completed.
4351+ output :
4352+ type : string
4353+ nullable : true
4354+ description : >-
4355+ The serialized output data passed when completing the token.
4356+ Only present when `status` is `COMPLETED`.
4357+ outputType :
4358+ type : string
4359+ nullable : true
4360+ description : The content type of the output (e.g. `"application/json"`).
4361+ outputIsError :
4362+ type : boolean
4363+ nullable : true
4364+ description : Whether the output represents an error (e.g. a timeout).
4365+ tags :
4366+ type : array
4367+ items :
4368+ type : string
4369+ description : Tags attached to the waitpoint.
4370+ createdAt :
4371+ type : string
4372+ format : date-time
4373+ description : When the waitpoint token was created.
42634374 CreateWaitpointTokenRequest :
42644375 type : object
42654376 properties :
0 commit comments