Retrieve a waitpoint token
Retrieves a waitpoint token by its ID, including its current status and output if it has been completed.
secretKeyAuthorizationBearer <token>Use a named environment API key. It starts with tr_dev_sk_, tr_prod_sk_, tr_stg_sk_, etc.
Create a named API key in the API Keys section of your Trigger.dev project dashboard. Choose the narrowest access preset that supports your integration.
Our TypeScript SDK will default to using the value of the TRIGGER_SECRET_KEY environment variable if it is set. If you are using the SDK in a different environment, you can set the key using the configure function.
import { configure } from "@trigger.dev/sdk";configure({ accessToken: "tr_dev_sk_1234" });waitpointId*stringThe ID of the waitpoint token.
Successful request
application/json- response
id*stringThe unique ID of the waitpoint token.
url*stringAn HTTP callback URL. A POST request to this URL (with an optional JSON body) will complete the waitpoint without needing an API key.
status*stringThe current status of the waitpoint token.
"WAITING""COMPLETED""TIMED_OUT"idempotencyKey?stringThe idempotency key used when creating the token, if any.
idempotencyKeyExpiresAt?stringWhen the idempotency key expires.
date-timetimeoutAt?stringWhen the token will time out, if a timeout was set.
date-timecompletedAt?stringWhen the token was completed, if it has been completed.
date-timeoutput?stringThe serialized output data passed when completing the token. Only present when status is COMPLETED.
outputType?stringThe content type of the output (e.g. "application/json").
outputIsError?booleanWhether the output represents an error (e.g. a timeout).
tags*array<string>Tags attached to the waitpoint.
createdAt*stringWhen the waitpoint token was created.
date-timeimport { wait } from "@trigger.dev/sdk";const token = await wait.retrieveToken("waitpoint_abc123");console.log(token.status); // "WAITING" | "COMPLETED" | "TIMED_OUT"if (token.status === "COMPLETED") { console.log(token.output);}{ "id": "waitpoint_abc123", "url": "https://api.trigger.dev/api/v1/waitpoints/tokens/waitpoint_abc123/callback/abc123hash", "status": "WAITING", "idempotencyKey": "string", "idempotencyKeyExpiresAt": "2019-08-24T14:15:22Z", "timeoutAt": "2019-08-24T14:15:22Z", "completedAt": "2019-08-24T14:15:22Z", "output": "string", "outputType": "string", "outputIsError": true, "tags": [ "string" ], "createdAt": "2019-08-24T14:15:22Z"}Was this page helpful?
Last updated
Edit on GitHub