Agents API
List, create, rename, publish and delete the voice agents of your workspace, and read their saved workflow and published versions.
An agent is what answers and makes your calls. This API manages the agents of the key's workspace from your own systems. Prompts, voices, languages and tools are set in the dashboard; see Voice agents.
POST /v1/agents is a single-prompt agent that starts from your workspace's default prompt. Through the API you can change its name, publish it, read its published versions and delete it. Open it in the dashboard to write its prompt, choose its voice and language and add functions. Conversational-flow agents are made in the dashboard.Scopes
agents:readforGETagents:writeforPOST,PATCH,PUT,DELETEand publish
The agent object
| Field | Type | Notes |
|---|---|---|
id | string (UUID) | Set by Dhvanee. |
name | string | Up to 128 characters. |
language | string or null | The agent's first language, for example en-IN. |
published | boolean | false until the agent is published. |
workflow | object or null | The saved canvas of a conversational-flow agent. null for a single-prompt agent and until a canvas is saved. |
{"id": "ff296ea3-5c61-436e-9ed9-77aba6fcc4fc", "name": "Front desk", "language": "en-IN", "published": false, "workflow": null}List agents
Newest first. The response holds every agent in the workspace; there is no paging.
curl -sS -X GET "https://api.stage.dhvanee.com/v1/agents" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY"{"items": [{"id": "ff296ea3-...", "name": "Front desk", "language": "en-IN", "published": true, "workflow": null}]}Create an agent
name is optional, up to 128 characters. Without one the agent is called Untitled agent. Returns 201 with the agent. It is not published yet, so it takes no calls until you publish it.
curl -sS -X POST "https://api.stage.dhvanee.com/v1/agents" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Front desk"}'Read, rename and delete one agent
curl -sS -X GET "https://api.stage.dhvanee.com/v1/agents/AGENT_ID" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY"curl -sS -X PATCH "https://api.stage.dhvanee.com/v1/agents/AGENT_ID" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Front desk (Hindi)"}'curl -sS -X DELETE "https://api.stage.dhvanee.com/v1/agents/AGENT_ID" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY"PATCHchanges the name only, andnameis required (1 to 128 characters).DELETEreturns204. Phone numbers and campaigns that used the agent are left with no agent until you choose another one.
Publish an agent
Makes the agent's current settings live for new calls. Returns the agent with published: true. Calls already in progress are not changed.
curl -sS -X POST "https://api.stage.dhvanee.com/v1/agents/AGENT_ID/publish" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY"400 (No workflow to publish — save the Agent canvas first).The workflow (canvas)
A conversational-flow agent keeps its steps as a canvas. Read it with GET and replace the whole canvas with PUT. Saving the canvas does not publish it.
curl -sS -X GET "https://api.stage.dhvanee.com/v1/agents/AGENT_ID/workflow" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY"{"workflow": null}workflow is null until a canvas has been saved. PUT takes the same canvas the dashboard saves, inside graph:
curl -sS -X PUT "https://api.stage.dhvanee.com/v1/agents/AGENT_ID/workflow" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"graph": {
"nodes": {
"start_node": {
"type": "start",
"label": "Start",
"edge_order": [
"start_to_greet"
]
},
"greet": {
"type": "override_agent",
"label": "Greeting",
"additional_prompt": "Greet the caller and ask how you can help.",
"edge_order": [
"greet_to_end"
]
},
"end_node": {
"type": "end",
"label": "Ending"
}
},
"edges": {
"start_to_greet": {
"source": "start_node",
"target": "greet",
"forward_condition": {
"type": "unconditional"
}
},
"greet_to_end": {
"source": "greet",
"target": "end_node",
"forward_condition": {
"type": "llm",
"condition": "The caller is finished."
}
}
}
}
}'| Rule | Error (400) |
|---|---|
nodes is a non-empty object and edges is an object | Workflow graph.nodes must be a non-empty object |
A node called start_node of type start | Workflow must include start_node |
At least one node of type end | Workflow must include at least one end node |
| Every edge points at nodes that exist | Edge ... references unknown nodes |
Published versions
Each time you publish changed settings, a version is recorded. Publishing again with nothing changed does not add one.
curl -sS -X GET "https://api.stage.dhvanee.com/v1/agents/AGENT_ID/versions" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY"curl -sS -X GET "https://api.stage.dhvanee.com/v1/agents/AGENT_ID/versions/1" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY"| Field | Notes |
|---|---|
version | Whole number from 1. |
published_at | When it went live (ISO 8601). |
workflow | What was published. For a conversational-flow agent nodes and edges hold the canvas. For a single-prompt agent they are empty and prompt_config holds the settings: system_prompt, first_message, voice_id, languages, llm, knowledge_document_ids, prompt_functions and more. |
Keys that look like secrets (names with secret, password, token, api_key or credential) are removed from every response.
Errors
| Status | When |
|---|---|
401 | No key, or an unknown or revoked key (Valid API key is required). |
403 | The key lacks the scope (API key needs agents:write scope). |
404 | No agent with that id in this workspace (Agent not found), or no such version (Workflow version 1 not found). |
400 | An invalid canvas (table above), or an agent that cannot be published yet. |
422 | A body that is not valid: an empty name on rename, a missing graph, or an id that is not a UUID. |
To attach knowledge documents to an agent, see the Knowledge API. Limits and keys: Authentication, Rate limits.