Agents
Update an agent
Changes the agent's draft: only the fields you send change, and null clears the optional texts.
PATCH https://api.diska.ai/v1/agents/{agent_id}
Scope: agents:write
Calls keep using the published version until you publish. Voice, engine and actions are edited in the backoffice. Flow Builder agents take their text from their flows, so prompt is refused. If two changes arrive at once, the last one wins.
Parameters
Path
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | The agent's ID. |
Request body
application/json
| Field | Type | Required | Description |
|---|---|---|---|
name | string | null | No | New name. Up to 120 characters. |
description | string | null | No | New description; null clears it. Up to 2000 characters. |
prompt | string | null | No | New instructions (prompt-mode agents only). Up to 60000 characters. |
greeting | object | null | No | Changes the greeting; only the fields sent change. |
greeting.mode | string | null | No | agent_first or human_first. |
greeting.message | string | null | No | The greeting; null clears it. Up to 500 characters. |
language | string | null | No | Language, in the pt-PT format. |
personality | string | null | No | Personality and tone; null clears it. Up to 10000 characters. |
objections | string | null | No | How to handle objections; null clears it. Up to 10000 characters. |
knowledge_notes | string | null | No | Knowledge notes; null clears them. Up to 10000 characters. |
knowledge_base_ids | array | No | Replaces the assigned bases with the list sent. |
{
"prompt": "És a recepcionista da Clínica Sol. Marca consultas de segunda a sexta.",
"greeting": {
"mode": "agent_first",
"message": "Clínica Sol, bom dia!"
},
"language": "pt-PT"
}
Examples
curl -X PATCH "https://api.diska.ai/v1/agents/<agent_id>" \
-H "Authorization: Bearer $DISKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"És a recepcionista da Clínica Sol. Marca consultas de segunda a sexta.","greeting":{"mode":"agent_first","message":"Clínica Sol, bom dia!"},"language":"pt-PT"}'
import os
import requests
response = requests.patch(
"https://api.diska.ai/v1/agents/<agent_id>",
headers={"Authorization": f"Bearer {os.environ['DISKA_API_KEY']}"},
json={
"prompt": "És a recepcionista da Clínica Sol. Marca consultas de segunda a sexta.",
"greeting": {
"mode": "agent_first",
"message": "Clínica Sol, bom dia!",
},
"language": "pt-PT",
},
timeout=30,
)
response.raise_for_status()
print(response.json())
// Node.js 18 or later, in a .mjs file
const response = await fetch('https://api.diska.ai/v1/agents/<agent_id>', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.DISKA_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"prompt": "És a recepcionista da Clínica Sol. Marca consultas de segunda a sexta.",
"greeting": {
"mode": "agent_first",
"message": "Clínica Sol, bom dia!"
},
"language": "pt-PT"
})
})
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`)
console.log(await response.json())
<?php
$ch = curl_init('https://api.diska.ai/v1/agents/<agent_id>');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('DISKA_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'prompt' => 'És a recepcionista da Clínica Sol. Marca consultas de segunda a sexta.',
'greeting' => [
'mode' => 'agent_first',
'message' => 'Clínica Sol, bom dia!',
],
'language' => 'pt-PT',
]),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException("HTTP $status: $body");
}
print_r(json_decode($body, true));
Try it
Send the request from this page, with your key. The key stays on this page: it is not stored and is only sent to api.diska.ai. Use a test key with the fewest scopes you need.
PATCH
https://api.diska.ai/v1/agents/{agent_id}Starts with dsk_. It stays in this browser tab only.
path
Enter an API key (dsk_…).
Response 200
| Field | Type | Description |
|---|---|---|
id | string | Agent ID. |
name | string | Agent name. |
slug | string | Readable agent identifier. |
description | string | null | Description, or null. |
status | string | draft, active, inactive or archived. A published agent is active. |
agent_type | string | inbound, outbound, voice_widget or chat. |
editing_mode | string | prompt or flow (Flow Builder). It does not change after creation. Default: prompt. |
version | integer | Agent version number. Default: 1. |
phone_number | string | null | Number assigned to the agent, or null. |
public_channel_enabled | boolean | true when the agent's public link is on. Default: false. |
created_at | string | Creation date (ISO 8601). |
updated_at | string | Last change date (ISO 8601). |
configuration | object | The editable configuration (the draft). |
configuration.prompt | string | null | The agent's instructions (prompt-mode agents only; null for Flow Builder agents). |
configuration.greeting | object | How the conversation opens. |
configuration.greeting.mode | string | agent_first (the agent speaks first) or human_first (it waits for the person). Default: agent_first. |
configuration.greeting.message | string | null | The greeting, or null. |
configuration.language | string | null | Conversation language, for example pt-PT. |
configuration.personality | string | null | Personality and tone. |
configuration.objections | string | null | How to handle objections. |
configuration.knowledge_notes | string | null | Knowledge notes written on the agent. |
configuration.knowledge_base_ids | array | Assigned knowledge bases. |
has_unpublished_changes | boolean | true when the draft differs from the published version. Default: false. |
{
"id": "5c2e8a14-7d3b-4f9e-a1c6-0b8d2f4e6a93",
"name": "Exemplo",
"slug": "recepcao",
"description": "CRM — produção",
"status": "draft",
"agent_type": "inbound",
"editing_mode": "prompt",
"version": 3,
"phone_number": "+244900000000",
"public_channel_enabled": false,
"created_at": "2026-10-25T18:40:00Z",
"updated_at": "2026-10-25T18:40:00Z",
"configuration": {
"prompt": "…",
"greeting": {
"mode": "agent_first",
"message": "…"
},
"language": "…",
"personality": "…",
"objections": "…",
"knowledge_notes": "…",
"knowledge_base_ids": [
"…"
]
},
"has_unpublished_changes": false
}
Errors
| Code | When |
|---|---|
404 | Agente não encontrado. — the agent does not exist in this organization. |
404 | Base de conhecimento não encontrada. — one of the knowledge_base_ids does not exist. |
409 | The agent is archived, or prompt was sent for a Flow Builder agent. |
422 | An unknown field, a value out of bounds, or null in name, prompt, greeting or language. |
Errors common to every endpoint (401, 403, 422, 429 and 5xx) are in Errors.

