Skip to content
dhanu docs
Browse pages

API reference

Send a message

POST /api/pub/v1/tasks/{taskId}/messages, add a message to a task and start the reply.

POSThttps://api.dhanu.ai/api/pub/v1/tasks/{taskId}/messages

Adds a message to an existing task and starts the reply. Returns the message you sent; the reply follows in the background.

Request

Path parameterTypeRequiredNotes
taskIdstringYes
FieldTypeRequiredNotes
inputstringYesThe message, as plain text. At least 1 characters, up to 50000 characters.
fileIdsarrayNoFiles (from POST /files) to attach to the message.
curl -X POST https://api.dhanu.ai/api/pub/v1/tasks/$TASK_ID/messages \
  -H "Authorization: Bearer $DHANU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "input": "Now group them by product." }'
const message = await dhanu.tasks.send(taskId, "Now group them by product.");
message = dhanu.tasks.send(task_id, "Now group them by product.")

Response

202 Accepted

{ "message": { "id": "…", "role": "user", "text": "Now group them by product.", "createdAt": "…" } }

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.
not_found404No such resource in the key's workspace.