Agents
Publish an agent
Publishes the agent's draft as a new version and leaves the agent active.
POST https://api.diska.ai/v1/agents/{agent_id}/publish
Scope: agents:write
For flow agents it also publishes the main flow and the subflows it uses. If nothing changed since the last publish, no new version is created. The body is optional.
Parameters
Path
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | The agent's ID. |
Request body
application/json — The body is optional.
| Field | Type | Required | Description |
|---|---|---|---|
label | string | null | No | Version name. Default: Versão N. Up to 120 characters. |
{
"label": "Horário de Dezembro"
}
Examples
curl -X POST "https://api.diska.ai/v1/agents/<agent_id>/publish" \
-H "Authorization: Bearer $DISKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"label":"Horário de Dezembro"}'
import os
import requests
response = requests.post(
"https://api.diska.ai/v1/agents/<agent_id>/publish",
headers={"Authorization": f"Bearer {os.environ['DISKA_API_KEY']}"},
json={
"label": "Horário de Dezembro",
},
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>/publish', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DISKA_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"label": "Horário de Dezembro"
})
})
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>/publish');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('DISKA_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'label' => 'Horário de Dezembro',
]),
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.
POST
https://api.diska.ai/v1/agents/{agent_id}/publishStarts 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). |
{
"id": "3f1c2a7e-5b9d-4c1e-8f3a-2d6b7e9c1a40",
"name": "Recepção",
"slug": "recepcao",
"description": "Atende as chamadas da recepção.",
"status": "active",
"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"
}
Errors
| Code | When |
|---|---|
404 | Agente não encontrado. — the agent does not exist in this organization. |
409 | O agente está arquivado. Restaure-o antes de publicar. (archived: restore it first). |
422 | The agent cannot be published — for example O agente precisa de instruções (prompt) antes de ser publicado. (needs a prompt) or a flow validation error. |
Errors common to every endpoint (401, 403, 422, 429 and 5xx) are in Errors.

