Knowledge
Create a knowledge base
Creates an empty knowledge base.
POST https://api.diska.ai/v1/knowledge-bases
Scope: knowledge:write
Add documents with the three endpoints that follow and assign the base to an agent in the backoffice.
Request body
application/json
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Base name. Up to 200 characters. |
instruction | string | Yes | When and how the agent should use this base. Up to 4000 characters. |
description | string | null | No | Description. Up to 2000 characters. |
{
"name": "Produtos e preços",
"instruction": "Use esta base para responder a perguntas sobre produtos, preços e horários.",
"description": "Tabela de preços e horários de 2026."
}
Examples
curl -X POST "https://api.diska.ai/v1/knowledge-bases" \
-H "Authorization: Bearer $DISKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Produtos e preços","instruction":"Use esta base para responder a perguntas sobre produtos, preços e horários.","description":"Tabela de preços e horários de 2026."}'
import os
import requests
response = requests.post(
"https://api.diska.ai/v1/knowledge-bases",
headers={"Authorization": f"Bearer {os.environ['DISKA_API_KEY']}"},
json={
"name": "Produtos e preços",
"instruction": "Use esta base para responder a perguntas sobre produtos, preços e horários.",
"description": "Tabela de preços e horários de 2026.",
},
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/knowledge-bases', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DISKA_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "Produtos e preços",
"instruction": "Use esta base para responder a perguntas sobre produtos, preços e horários.",
"description": "Tabela de preços e horários de 2026."
})
})
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/knowledge-bases');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('DISKA_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Produtos e preços',
'instruction' => 'Use esta base para responder a perguntas sobre produtos, preços e horários.',
'description' => 'Tabela de preços e horários de 2026.',
]),
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/knowledge-basesStarts with dsk_. It stays in this browser tab only.
Enter an API key (dsk_…).
Response 201
| Field | Type | Description |
|---|---|---|
id | string | ID. |
organization_id | string | Organization it belongs to. |
name | string | Base name. |
instruction | string | When and how the agent should use this base. |
description | string | null | Description, or null. |
document_count | integer | Number of documents. Default: 0. |
assigned_agent_count | integer | Agents that use this base. Default: 0. |
created_at | string | null | Creation date (ISO 8601). |
updated_at | string | null | Last change date (ISO 8601). |
{
"id": "b2e4c6d8-1a3f-4e5b-9c7d-0f2a4b6c8e10",
"organization_id": "5c2e8a14-7d3b-4f9e-a1c6-0b8d2f4e6a93",
"name": "Produtos e preços",
"instruction": "Use esta base para responder a perguntas sobre produtos, preços e horários.",
"description": "Tabela de preços e horários de 2026.",
"document_count": 3,
"assigned_agent_count": 1,
"created_at": "2026-10-25T18:40:00Z",
"updated_at": "2026-10-25T18:40:00Z"
}
Errors
This endpoint has no errors of its own.
Errors common to every endpoint (401, 403, 422, 429 and 5xx) are in Errors.

