Skip to content
dhanu docs
Browse pages

API reference

Trigger a staff member

POST /api/pub/v1/staff/{address}/trigger, hand an AI staff member a piece of work from your own server and read the reply back.

POSThttps://api.dhanu.ai/api/pub/v1/staff/{address}/trigger

Hands a staff member a piece of work through its API address, the opaque stf_… string on the staff member’s Channels tab. A task is created in the staff member’s workspace and the reply is written to it in the background, so the call returns at once with the task and you read its messages to see the answer.

The run spends workspace credits like any other task; the trigger itself is not billed. Everything you send is treated as untrusted text: the staff member reports on it, it never obeys instructions inside it.

Request

Path parameterTypeRequiredNotes
addressstringYes
FieldTypeRequiredNotes
inputstringYesThe work to hand over, as plain text. At least 1 characters, up to 50000 characters.
subjectstringNo
threadIdstringNoContinue an earlier task instead of starting a new one.
curl -X POST https://api.dhanu.ai/api/pub/v1/staff/stf_abc123/trigger \
  -H "Authorization: Bearer $DHANU_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "input": "Draft minutes for today\u0027s stand-up.", "subject": "Stand-up minutes" }'
import { Dhanu } from "dhanu";

const dhanu = new Dhanu(process.env.DHANU_API_KEY!);

const task = await dhanu.tasks.trigger({
  address: "stf_abc123",
  input: "Draft minutes for today's stand-up.",
  subject: "Stand-up minutes",
  idempotencyKey: crypto.randomUUID(),
});
import os
import uuid
from dhanu import Dhanu

dhanu = Dhanu(os.environ["DHANU_API_KEY"])

task = dhanu.tasks.trigger(
    address="stf_abc123",
    input="Draft minutes for today's stand-up.",
    subject="Stand-up minutes",
    idempotency_key=str(uuid.uuid4()),
)

Pass threadId, a task id from an earlier trigger, to continue that task instead of opening a new one.

Response

202 Accepted

{
  "task": {
    "id": "…",
    "title": "Stand-up minutes",
    "createdAt": "2026-09-17T10:15:00.000Z",
    "updatedAt": "2026-09-17T10:15:00.000Z"
  }
}

Errors

CodeStatusMeaning
invalid_api_key401The bearer key is missing or unknown.
api_key_revoked401The key was revoked.
api_key_expired401The key passed its expiry date.
api_key_ip_not_allowed403The caller's IP is outside the key's allowlist.
developer_access_revoked403The key's creator lost developer access in the workspace.
api_key_project_scope403The key covers no active projects, or projectId is outside its scope.
invalid_request_body422The body did not match the schema; error.issues names each field.
channel_route_not_found404No staff member in the key's workspace has that trigger address.

The full list is on Errors.