const event = client.sendEvent({
  name: "test.job",
});

// Some time later...
const res = await client.cancelRunsForEvent(event.id);

console.log(res.cancelledRunIds);
console.log(res.failedToCancelRunIds);

These are the docs for Trigger.dev v2 which will be deprecated on January 31st, 2025. You probably want the v3 docs.

Parameters

eventId
string
required

The event ID to cancel the job runs for. This is returned when calling either client.sendEvent() or io.sendEvent().

Returns

const event = client.sendEvent({
  name: "test.job",
});

// Some time later...
const res = await client.cancelRunsForEvent(event.id);

console.log(res.cancelledRunIds);
console.log(res.failedToCancelRunIds);