API reference
Send a message
POST /api/pub/v1/tasks/{taskId}/messages, add a message to a task and start the reply.
POST
https://api.dhanu.ai/api/pub/v1/tasks/{taskId}/messagesAdds a message to an existing task and starts the reply. Returns the message you sent; the reply follows in the background.
Request
| Path parameter | Type | Required | Notes |
|---|---|---|---|
taskId | string | Yes |
| Field | Type | Required | Notes |
|---|---|---|---|
input | string | Yes | The message, as plain text. At least 1 characters, up to 50000 characters. |
fileIds | array | No | Files (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
| Code | Status | Meaning |
|---|---|---|
invalid_api_key | 401 | The bearer key is missing or unknown. |
api_key_revoked | 401 | The key was revoked. |
api_key_expired | 401 | The key passed its expiry date. |
api_key_ip_not_allowed | 403 | The caller's IP is outside the key's allowlist. |
developer_access_revoked | 403 | The key's creator lost developer access in the workspace. |
api_key_project_scope | 403 | The key covers no active projects, or projectId is outside its scope. |
invalid_request_body | 422 | The body did not match the schema; error.issues names each field. |
not_found | 404 | No such resource in the key's workspace. |