Skip to main content
POST
/
api
/
v1
/
waitpoints
/
tokens
/
{waitpointId}
/
callback
/
{callbackHash}
cURL
# The full URL is returned as `url` when you create a token
curl -X POST "https://api.trigger.dev/api/v1/waitpoints/tokens/waitpoint_abc123/callback/abc123hash" \
  -H "Content-Type: application/json" \
  -d '{"status": "approved", "comment": "Looks good to me!"}'
import { wait } from "@trigger.dev/sdk";

// In your task: create the token and send the URL to an external service
const token = await wait.createToken({ timeout: "1h" });

await sendApprovalRequestEmail({
  callbackUrl: token.url, // give this URL to the external service
});

// The external service POSTs to token.url to unblock the run
const result = await wait.forToken<{ status: string }>(token);
import requests

url = "https://api.trigger.dev/api/v1/waitpoints/tokens/{waitpointId}/callback/{callbackHash}"

payload = {
    "status": "approved",
    "comment": "Looks good to me!"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({status: 'approved', comment: 'Looks good to me!'})
};

fetch('https://api.trigger.dev/api/v1/waitpoints/tokens/{waitpointId}/callback/{callbackHash}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.trigger.dev/api/v1/waitpoints/tokens/{waitpointId}/callback/{callbackHash}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'status' => 'approved',
    'comment' => 'Looks good to me!'
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.trigger.dev/api/v1/waitpoints/tokens/{waitpointId}/callback/{callbackHash}"

	payload := strings.NewReader("{\n  \"status\": \"approved\",\n  \"comment\": \"Looks good to me!\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.trigger.dev/api/v1/waitpoints/tokens/{waitpointId}/callback/{callbackHash}")
  .header("Content-Type", "application/json")
  .body("{\n  \"status\": \"approved\",\n  \"comment\": \"Looks good to me!\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.trigger.dev/api/v1/waitpoints/tokens/{waitpointId}/callback/{callbackHash}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"status\": \"approved\",\n  \"comment\": \"Looks good to me!\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": true
}

Path Parameters

waitpointId
string
required

The ID of the waitpoint token.

callbackHash
string
required

The HMAC hash that authenticates the request. This is embedded in the url returned when creating the token — do not construct it manually.

Body

application/json

Any JSON object. The entire body is passed as the output data to the run waiting on this token. If the body is not valid JSON, an empty object is used.

Response

Waitpoint token completed successfully

success
enum<boolean>
required

Always true when the request succeeds.

Available options:
true