Skip to content

Baze de cunoștințe ​

11 endpoint-uri. Fiecare cale de mai jos este relativă la URL-ul de bază al API-ului și include deja prefixul /api/v1 — vezi convențiile pentru autentificare, paginare, erori și idempotență.

Endpoint
GET/knowledge-basesLists the organization's knowledge bases, newest first
POST/knowledge-basesCreates a knowledge base with its embedding, chunking and retrieval configuration
GET/knowledge-bases/{knowledgeBase}Returns one knowledge base with its retrieval and embedding settings
PUT/knowledge-bases/{knowledgeBase}Updates a knowledge base, refusing an embedding model change once content has already been embedded
DELETE/knowledge-bases/{knowledgeBase}Deletes a knowledge base, every document and chunk in it, and detaches it from all assistants
GET/knowledge-bases/{knowledgeBase}/documentsLists the documents in a knowledge base with their ingestion status and progress
POST/knowledge-bases/{knowledgeBase}/documentsAccepts a file, URL or pasted text for ingestion and queues extraction and embedding on the queue
GET/knowledge-bases/{knowledgeBase}/documents/{document}Returns one knowledge document with its ingestion status, progress and failure reason
DELETE/knowledge-bases/{knowledgeBase}/documents/{document}Deletes one document, its chunks and its stored source file, and refreshes the base's counters
POST/knowledge-bases/{knowledgeBase}/documents/{document}/retryClears a document's chunks and failure state and re-queues it for ingestion
POST/knowledge-bases/{knowledgeBase}/queryRuns a real hybrid retrieval query against the knowledge base and returns the matching passages

Endpoint-uri ​

Lists the organization's knowledge bases, newest first ​

GET/knowledge-bases
  • Necesită knowledge.read.
  • Only limit is honoured (default 25, capped at 100); there are no filters.

Parametri de interogare

NumeTipObligatoriuNote
limitinteger—default 25
bash
curl -X GET "$CALLAGENT_API_URL/knowledge-bases?limit=25" \
  -H "Authorization: Bearer $CALLAGENT_API_KEY" \
  -H "Accept: application/json"
js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/knowledge-bases?limit=25`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
    Accept: 'application/json',
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.type}: ${error.message}`);
}

const { data } = await response.json();
php
<?php

$handle = curl_init(getenv('CALLAGENT_API_URL') . '/knowledge-bases?limit=25');

curl_setopt_array($handle, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
        'Accept: application/json',
    ],
]);

$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);

if ($status >= 400) {
    throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}

$data = $body['data'];
python
import os, requests

response = requests.get(
    f"{os.environ['CALLAGENT_API_URL']}/knowledge-bases?limit=25",
    headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]

Răspunsuri

StatusCorp
200Paginated set of KnowledgeBaseResource

Erori

StatusCând apare
403The key lacks knowledge.read

Exemplu de răspuns, generat din schemă:

json
{
  "data": [
    {
      "id": "01JQ0000000000000000000000",
      "object": "string",
      "name": "Support Line",
      "description": "string",
      "provider": "string",
      "namespace": "Support Line",
      "embedding": {},
      "chunk_size": 1,
      "chunk_overlap": 1,
      "retrieval": {},
      "custom_provider": {},
      "knowledge_only": true,
      "knowledge_only_plan": {},
      "status": "string",
      "document_count": 1,
      "chunk_count": 1,
      "total_bytes": 1,
      "metadata": {},
      "documents": [],
      "created_at": "2026-01-01T12:00:00+00:00",
      "updated_at": "2026-01-01T12:00:00+00:00"
    }
  ],
  "links": {
    "first": "string",
    "last": "string",
    "prev": "string",
    "next": "string"
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "links": [
      {}
    ],
    "path": "string",
    "per_page": 25,
    "to": 1,
    "total": 1
  }
}

Creates a knowledge base with its embedding, chunking and retrieval configuration ​

POST/knowledge-bases
  • Necesită knowledge.write.

Corpul cererii

CâmpTipObligatoriuNote
namestringdamax 255 chars
descriptionstring | null—max 255 chars
providerpgvector · custom · qdrant · pinecone · weaviate | null—
namespacestring | null—max 255 chars
embedding_providerstring | null—max 48 chars
embedding_modelstring | null—max 96 chars
chunk_sizeinteger | null—min 64. max 4000
chunk_overlapinteger | null—min 0. max 2000
retrievalobject—
retrieval.top_kinteger | null—min 1. max 50
retrieval.thresholdnumber | null—min 0. max 1
retrieval.vector_weightnumber | null—min 0. max 1
retrieval.lexical_weightnumber | null—min 0. max 1
retrieval.max_context_charsinteger | null—min 200. max 100000
retrieval.citationsinline · footnote · none · null | null—
retrieval.metadata_filtersstring[] | null—
custom_providerobject—
custom_provider.urlstring | null—uri. max 2048 chars
custom_provider.headersstring[] | null—
custom_provider.timeout_secondsinteger | null—min 1. max 60
knowledge_onlyboolean | null—
knowledge_only_planstring[] | null—
metadatastring[] | null—
bash
curl -X POST "$CALLAGENT_API_URL/knowledge-bases" \
  -H "Authorization: Bearer $CALLAGENT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
       "name": "Support Line",
       "provider": "pgvector",
       "namespace": "Support Line",
       "chunk_size": 1,
       "chunk_overlap": 1,
       "retrieval": {
         "top_k": 1,
         "threshold": 1,
         "vector_weight": 1,
         "lexical_weight": 1,
         "max_context_chars": 1,
         "citations": "inline",
         "metadata_filters": [
           "string"
         ]
       },
       "custom_provider": {
         "url": "https://example.com/hook",
         "headers": [
           "string"
         ],
         "timeout_seconds": 30
       }
     }'
js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/knowledge-bases`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "Support Line",
    "provider": "pgvector",
    "namespace": "Support Line",
    "chunk_size": 1,
    "chunk_overlap": 1,
    "retrieval": {
      "top_k": 1,
      "threshold": 1,
      "vector_weight": 1,
      "lexical_weight": 1,
      "max_context_chars": 1,
      "citations": "inline",
      "metadata_filters": [
        "string"
      ]
    },
    "custom_provider": {
      "url": "https://example.com/hook",
      "headers": [
        "string"
      ],
      "timeout_seconds": 30
    }
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.type}: ${error.message}`);
}

const { data } = await response.json();
php
<?php

$handle = curl_init(getenv('CALLAGENT_API_URL') . '/knowledge-bases');

curl_setopt_array($handle, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
        'Accept: application/json',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
    'name' => 'Support Line',
    'provider' => 'pgvector',
    'namespace' => 'Support Line',
    'chunk_size' => 1,
    'chunk_overlap' => 1,
    'retrieval' => [
        'top_k' => 1,
        'threshold' => 1,
        'vector_weight' => 1,
        'lexical_weight' => 1,
        'max_context_chars' => 1,
        'citations' => 'inline',
        'metadata_filters' => [
            'string',
        ],
    ],
    'custom_provider' => [
        'url' => 'https://example.com/hook',
        'headers' => [
            'string',
        ],
        'timeout_seconds' => 30,
    ],
]),
]);

$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);

if ($status >= 400) {
    throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}

$data = $body['data'];
python
import os, requests

response = requests.post(
    f"{os.environ['CALLAGENT_API_URL']}/knowledge-bases",
    headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
    json={
      "name": "Support Line",
      "provider": "pgvector",
      "namespace": "Support Line",
      "chunk_size": 1,
      "chunk_overlap": 1,
      "retrieval": {
        "top_k": 1,
        "threshold": 1,
        "vector_weight": 1,
        "lexical_weight": 1,
        "max_context_chars": 1,
        "citations": "inline",
        "metadata_filters": [
          "string"
        ]
      },
      "custom_provider": {
        "url": "https://example.com/hook",
        "headers": [
          "string"
        ],
        "timeout_seconds": 30
      }
    },
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]

Răspunsuri

StatusCorp
201KnowledgeBaseResource

Erori

StatusCând apare
403The key lacks knowledge.write
422Validation failed

Exemplu de răspuns, generat din schemă:

json
{
  "data": {
    "id": "01JQ0000000000000000000000",
    "object": "string",
    "name": "Support Line",
    "description": "string",
    "provider": "string",
    "namespace": "Support Line",
    "embedding": {
      "provider": "string",
      "model": "string",
      "dimensions": 1
    },
    "chunk_size": 1,
    "chunk_overlap": 1,
    "retrieval": {},
    "custom_provider": {},
    "knowledge_only": true,
    "knowledge_only_plan": {},
    "status": "string",
    "document_count": 1,
    "chunk_count": 1,
    "total_bytes": 1,
    "metadata": {},
    "documents": [
      {}
    ],
    "created_at": "2026-01-01T12:00:00+00:00",
    "updated_at": "2026-01-01T12:00:00+00:00"
  }
}

Returns one knowledge base with its retrieval and embedding settings ​

GET/knowledge-bases/{knowledgeBase}
  • Necesită knowledge.read.

Parametri de cale

NumeTipObligatoriuNote
knowledgeBasestringdaThe knowledge base ID
bash
curl -X GET "$CALLAGENT_API_URL/knowledge-bases/01JQ0000000000000000000000" \
  -H "Authorization: Bearer $CALLAGENT_API_KEY" \
  -H "Accept: application/json"
js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/knowledge-bases/01JQ0000000000000000000000`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
    Accept: 'application/json',
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.type}: ${error.message}`);
}

const { data } = await response.json();
php
<?php

$handle = curl_init(getenv('CALLAGENT_API_URL') . '/knowledge-bases/01JQ0000000000000000000000');

curl_setopt_array($handle, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
        'Accept: application/json',
    ],
]);

$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);

if ($status >= 400) {
    throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}

$data = $body['data'];
python
import os, requests

response = requests.get(
    f"{os.environ['CALLAGENT_API_URL']}/knowledge-bases/01JQ0000000000000000000000",
    headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]

Răspunsuri

StatusCorp
200KnowledgeBaseResource

Erori

StatusCând apare
403The key lacks knowledge.read
404No such knowledge base in this organization

Exemplu de răspuns, generat din schemă:

json
{
  "data": {
    "id": "01JQ0000000000000000000000",
    "object": "string",
    "name": "Support Line",
    "description": "string",
    "provider": "string",
    "namespace": "Support Line",
    "embedding": {
      "provider": "string",
      "model": "string",
      "dimensions": 1
    },
    "chunk_size": 1,
    "chunk_overlap": 1,
    "retrieval": {},
    "custom_provider": {},
    "knowledge_only": true,
    "knowledge_only_plan": {},
    "status": "string",
    "document_count": 1,
    "chunk_count": 1,
    "total_bytes": 1,
    "metadata": {},
    "documents": [
      {}
    ],
    "created_at": "2026-01-01T12:00:00+00:00",
    "updated_at": "2026-01-01T12:00:00+00:00"
  }
}

Updates a knowledge base, refusing an embedding model change once content has already been embedded ​

PUT/knowledge-bases/{knowledgeBase}
  • Necesită knowledge.write.
  • PATCH este acceptat pe aceeași cale, cu același corp.
  • Changing embedding_model on a base with stored chunks is a 422: create a new knowledge base instead.

Parametri de cale

NumeTipObligatoriuNote
knowledgeBasestringdaThe knowledge base ID

Corpul cererii

CâmpTipObligatoriuNote
namestring—max 255 chars
descriptionstring | null—max 255 chars
providerpgvector · custom · qdrant · pinecone · weaviate | null—
namespacestring | null—max 255 chars
embedding_providerstring | null—max 48 chars
embedding_modelstring | null—max 96 chars
chunk_sizeinteger | null—min 64. max 4000
chunk_overlapinteger | null—min 0. max 2000
retrievalobject—
retrieval.top_kinteger | null—min 1. max 50
retrieval.thresholdnumber | null—min 0. max 1
retrieval.vector_weightnumber | null—min 0. max 1
retrieval.lexical_weightnumber | null—min 0. max 1
retrieval.max_context_charsinteger | null—min 200. max 100000
retrieval.citationsinline · footnote · none · null | null—
retrieval.metadata_filtersstring[] | null—
custom_providerobject—
custom_provider.urlstring | null—uri. max 2048 chars
custom_provider.headersstring[] | null—
custom_provider.timeout_secondsinteger | null—min 1. max 60
knowledge_onlyboolean | null—
knowledge_only_planstring[] | null—
metadatastring[] | null—
bash
curl -X PUT "$CALLAGENT_API_URL/knowledge-bases/01JQ0000000000000000000000" \
  -H "Authorization: Bearer $CALLAGENT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
       "name": "Support Line",
       "provider": "pgvector",
       "namespace": "Support Line",
       "chunk_size": 1,
       "chunk_overlap": 1,
       "retrieval": {
         "top_k": 1,
         "threshold": 1,
         "vector_weight": 1,
         "lexical_weight": 1,
         "max_context_chars": 1,
         "citations": "inline",
         "metadata_filters": [
           "string"
         ]
       },
       "custom_provider": {
         "url": "https://example.com/hook",
         "headers": [
           "string"
         ],
         "timeout_seconds": 30
       }
     }'
js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/knowledge-bases/01JQ0000000000000000000000`, {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "Support Line",
    "provider": "pgvector",
    "namespace": "Support Line",
    "chunk_size": 1,
    "chunk_overlap": 1,
    "retrieval": {
      "top_k": 1,
      "threshold": 1,
      "vector_weight": 1,
      "lexical_weight": 1,
      "max_context_chars": 1,
      "citations": "inline",
      "metadata_filters": [
        "string"
      ]
    },
    "custom_provider": {
      "url": "https://example.com/hook",
      "headers": [
        "string"
      ],
      "timeout_seconds": 30
    }
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.type}: ${error.message}`);
}

const { data } = await response.json();
php
<?php

$handle = curl_init(getenv('CALLAGENT_API_URL') . '/knowledge-bases/01JQ0000000000000000000000');

curl_setopt_array($handle, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
        'Accept: application/json',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
    'name' => 'Support Line',
    'provider' => 'pgvector',
    'namespace' => 'Support Line',
    'chunk_size' => 1,
    'chunk_overlap' => 1,
    'retrieval' => [
        'top_k' => 1,
        'threshold' => 1,
        'vector_weight' => 1,
        'lexical_weight' => 1,
        'max_context_chars' => 1,
        'citations' => 'inline',
        'metadata_filters' => [
            'string',
        ],
    ],
    'custom_provider' => [
        'url' => 'https://example.com/hook',
        'headers' => [
            'string',
        ],
        'timeout_seconds' => 30,
    ],
]),
]);

$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);

if ($status >= 400) {
    throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}

$data = $body['data'];
python
import os, requests

response = requests.put(
    f"{os.environ['CALLAGENT_API_URL']}/knowledge-bases/01JQ0000000000000000000000",
    headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
    json={
      "name": "Support Line",
      "provider": "pgvector",
      "namespace": "Support Line",
      "chunk_size": 1,
      "chunk_overlap": 1,
      "retrieval": {
        "top_k": 1,
        "threshold": 1,
        "vector_weight": 1,
        "lexical_weight": 1,
        "max_context_chars": 1,
        "citations": "inline",
        "metadata_filters": [
          "string"
        ]
      },
      "custom_provider": {
        "url": "https://example.com/hook",
        "headers": [
          "string"
        ],
        "timeout_seconds": 30
      }
    },
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]

Răspunsuri

StatusCorp
200KnowledgeBaseResource

Erori

StatusCând apare
403The key lacks knowledge.write
404No such knowledge base in this organization
422Validation failed, or the embedding model was changed on a base that already has chunks

Exemplu de răspuns, generat din schemă:

json
{
  "data": {
    "id": "01JQ0000000000000000000000",
    "object": "string",
    "name": "Support Line",
    "description": "string",
    "provider": "string",
    "namespace": "Support Line",
    "embedding": {
      "provider": "string",
      "model": "string",
      "dimensions": 1
    },
    "chunk_size": 1,
    "chunk_overlap": 1,
    "retrieval": {},
    "custom_provider": {},
    "knowledge_only": true,
    "knowledge_only_plan": {},
    "status": "string",
    "document_count": 1,
    "chunk_count": 1,
    "total_bytes": 1,
    "metadata": {},
    "documents": [
      {}
    ],
    "created_at": "2026-01-01T12:00:00+00:00",
    "updated_at": "2026-01-01T12:00:00+00:00"
  }
}

Deletes a knowledge base, every document and chunk in it, and detaches it from all assistants ​

DELETE/knowledge-bases/{knowledgeBase}
  • Necesită knowledge.write.
  • Acest răspuns nu este împachetat în data.
  • Body is a bare {"deleted": true, "id": "..."}. Side effects: stored source files are removed from disk and assistants are detached.

Parametri de cale

NumeTipObligatoriuNote
knowledgeBasestringdaThe knowledge base ID
bash
curl -X DELETE "$CALLAGENT_API_URL/knowledge-bases/01JQ0000000000000000000000" \
  -H "Authorization: Bearer $CALLAGENT_API_KEY" \
  -H "Accept: application/json"
js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/knowledge-bases/01JQ0000000000000000000000`, {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
    Accept: 'application/json',
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.type}: ${error.message}`);
}

const { data } = await response.json();
php
<?php

$handle = curl_init(getenv('CALLAGENT_API_URL') . '/knowledge-bases/01JQ0000000000000000000000');

curl_setopt_array($handle, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
        'Accept: application/json',
    ],
]);

$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);

if ($status >= 400) {
    throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}

$data = $body['data'];
python
import os, requests

response = requests.delete(
    f"{os.environ['CALLAGENT_API_URL']}/knowledge-bases/01JQ0000000000000000000000",
    headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]

Răspunsuri

StatusCorp
200Bare JSON object, not data-wrapped

Erori

StatusCând apare
403The key lacks knowledge.write
404No such knowledge base in this organization

Exemplu de răspuns, generat din schemă:

json
{
  "deleted": true,
  "id": null
}

Lists the documents in a knowledge base with their ingestion status and progress ​

GET/knowledge-bases/{knowledgeBase}/documents
  • Necesită knowledge.read.
  • Query params: status, limit (default 25, capped at 100).

Parametri de cale

NumeTipObligatoriuNote
knowledgeBasestringdaThe knowledge base ID

Parametri de interogare

NumeTipObligatoriuNote
limitinteger—default 25
bash
curl -X GET "$CALLAGENT_API_URL/knowledge-bases/01JQ0000000000000000000000/documents?limit=25" \
  -H "Authorization: Bearer $CALLAGENT_API_KEY" \
  -H "Accept: application/json"
js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/knowledge-bases/01JQ0000000000000000000000/documents?limit=25`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
    Accept: 'application/json',
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.type}: ${error.message}`);
}

const { data } = await response.json();
php
<?php

$handle = curl_init(getenv('CALLAGENT_API_URL') . '/knowledge-bases/01JQ0000000000000000000000/documents?limit=25');

curl_setopt_array($handle, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
        'Accept: application/json',
    ],
]);

$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);

if ($status >= 400) {
    throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}

$data = $body['data'];
python
import os, requests

response = requests.get(
    f"{os.environ['CALLAGENT_API_URL']}/knowledge-bases/01JQ0000000000000000000000/documents?limit=25",
    headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]

Răspunsuri

StatusCorp
200Paginated set of KnowledgeDocumentResource

Erori

StatusCând apare
403The key lacks knowledge.read
404No such knowledge base in this organization

Exemplu de răspuns, generat din schemă:

json
{
  "data": [
    {
      "id": "01JQ0000000000000000000000",
      "object": "string",
      "knowledge_base_id": "01JQ0000000000000000000000",
      "title": "string",
      "source_type": "string",
      "source_url": "https://example.com/hook",
      "mime_type": "string",
      "extension": "string",
      "size_bytes": 1,
      "status": "string",
      "progress": 1,
      "failure_code": "string",
      "failure_reason": "string",
      "extracted_chars": 1,
      "chunk_count": 1,
      "token_count": 1,
      "language": "string",
      "metadata": {},
      "ingested_at": "2026-01-01T12:00:00+00:00",
      "created_at": "2026-01-01T12:00:00+00:00"
    }
  ],
  "links": {
    "first": "string",
    "last": "string",
    "prev": "string",
    "next": "string"
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "links": [
      {}
    ],
    "path": "string",
    "per_page": 25,
    "to": 1,
    "total": 1
  }
}

Accepts a file, URL or pasted text for ingestion and queues extraction and embedding on the queue ​

POST/knowledge-bases/{knowledgeBase}/documents
  • Necesită knowledge.write.
  • 202, not 201: the document is accepted, not ingested. source_type (file|url|text) is required; a file upload is multipart and is size- and extension-checked.

Parametri de cale

NumeTipObligatoriuNote
knowledgeBasestringdaThe knowledge base ID

Corpul cererii

CâmpTipObligatoriuNote
source_typefile · url · textda
titlestring | null—max 255 chars
filestring—The extension list is the one the extractor genuinely handles — accepting a PDF we cannot parse would be a silent ingestion of nothing (§188).. binary
urlstring | null—uri. max 2048 chars
textstring | null—max 2000000 chars
metadatastring[] | null—
bash
curl -X POST "$CALLAGENT_API_URL/knowledge-bases/01JQ0000000000000000000000/documents" \
  -H "Authorization: Bearer $CALLAGENT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
       "source_type": "file",
       "url": "https://example.com/hook"
     }'
js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/knowledge-bases/01JQ0000000000000000000000/documents`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "source_type": "file",
    "url": "https://example.com/hook"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.type}: ${error.message}`);
}

const { data } = await response.json();
php
<?php

$handle = curl_init(getenv('CALLAGENT_API_URL') . '/knowledge-bases/01JQ0000000000000000000000/documents');

curl_setopt_array($handle, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
        'Accept: application/json',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
    'source_type' => 'file',
    'url' => 'https://example.com/hook',
]),
]);

$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);

if ($status >= 400) {
    throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}

$data = $body['data'];
python
import os, requests

response = requests.post(
    f"{os.environ['CALLAGENT_API_URL']}/knowledge-bases/01JQ0000000000000000000000/documents",
    headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
    json={
      "source_type": "file",
      "url": "https://example.com/hook"
    },
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]

Răspunsuri

StatusCorp
202KnowledgeDocumentResource

Erori

StatusCând apare
403The key lacks knowledge.write
404No such knowledge base in this organization
422Validation failed, an unsupported file type, or a URL refused by the SSRF guard

Exemplu de răspuns, generat din schemă:

json
{
  "data": {
    "id": "01JQ0000000000000000000000",
    "object": "string",
    "knowledge_base_id": "01JQ0000000000000000000000",
    "title": "string",
    "source_type": "string",
    "source_url": "https://example.com/hook",
    "mime_type": "string",
    "extension": "string",
    "size_bytes": 1,
    "status": "string",
    "progress": 1,
    "failure_code": "string",
    "failure_reason": "string",
    "extracted_chars": 1,
    "chunk_count": 1,
    "token_count": 1,
    "language": "string",
    "metadata": {},
    "ingested_at": "2026-01-01T12:00:00+00:00",
    "created_at": "2026-01-01T12:00:00+00:00"
  }
}

Returns one knowledge document with its ingestion status, progress and failure reason ​

GET/knowledge-bases/{knowledgeBase}/documents/{document}
  • Necesită knowledge.read.

Parametri de cale

NumeTipObligatoriuNote
knowledgeBasestringdaThe knowledge base ID
documentstringdaThe document ID
bash
curl -X GET "$CALLAGENT_API_URL/knowledge-bases/01JQ0000000000000000000000/documents/01JQ0000000000000000000000" \
  -H "Authorization: Bearer $CALLAGENT_API_KEY" \
  -H "Accept: application/json"
js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/knowledge-bases/01JQ0000000000000000000000/documents/01JQ0000000000000000000000`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
    Accept: 'application/json',
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.type}: ${error.message}`);
}

const { data } = await response.json();
php
<?php

$handle = curl_init(getenv('CALLAGENT_API_URL') . '/knowledge-bases/01JQ0000000000000000000000/documents/01JQ0000000000000000000000');

curl_setopt_array($handle, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
        'Accept: application/json',
    ],
]);

$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);

if ($status >= 400) {
    throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}

$data = $body['data'];
python
import os, requests

response = requests.get(
    f"{os.environ['CALLAGENT_API_URL']}/knowledge-bases/01JQ0000000000000000000000/documents/01JQ0000000000000000000000",
    headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]

Răspunsuri

StatusCorp
200KnowledgeDocumentResource

Erori

StatusCând apare
403The key lacks knowledge.read
404No such knowledge base, or the document belongs to another base

Exemplu de răspuns, generat din schemă:

json
{
  "data": {
    "id": "01JQ0000000000000000000000",
    "object": "string",
    "knowledge_base_id": "01JQ0000000000000000000000",
    "title": "string",
    "source_type": "string",
    "source_url": "https://example.com/hook",
    "mime_type": "string",
    "extension": "string",
    "size_bytes": 1,
    "status": "string",
    "progress": 1,
    "failure_code": "string",
    "failure_reason": "string",
    "extracted_chars": 1,
    "chunk_count": 1,
    "token_count": 1,
    "language": "string",
    "metadata": {},
    "ingested_at": "2026-01-01T12:00:00+00:00",
    "created_at": "2026-01-01T12:00:00+00:00"
  }
}

Deletes one document, its chunks and its stored source file, and refreshes the base's counters ​

DELETE/knowledge-bases/{knowledgeBase}/documents/{document}
  • Necesită knowledge.write.
  • Acest răspuns nu este împachetat în data.
  • Body is a bare {"deleted": true, "id": "..."}. Deleting a document requires the base's update permission, not a delete permission.

Parametri de cale

NumeTipObligatoriuNote
knowledgeBasestringdaThe knowledge base ID
documentstringdaThe document ID
bash
curl -X DELETE "$CALLAGENT_API_URL/knowledge-bases/01JQ0000000000000000000000/documents/01JQ0000000000000000000000" \
  -H "Authorization: Bearer $CALLAGENT_API_KEY" \
  -H "Accept: application/json"
js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/knowledge-bases/01JQ0000000000000000000000/documents/01JQ0000000000000000000000`, {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
    Accept: 'application/json',
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.type}: ${error.message}`);
}

const { data } = await response.json();
php
<?php

$handle = curl_init(getenv('CALLAGENT_API_URL') . '/knowledge-bases/01JQ0000000000000000000000/documents/01JQ0000000000000000000000');

curl_setopt_array($handle, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
        'Accept: application/json',
    ],
]);

$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);

if ($status >= 400) {
    throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}

$data = $body['data'];
python
import os, requests

response = requests.delete(
    f"{os.environ['CALLAGENT_API_URL']}/knowledge-bases/01JQ0000000000000000000000/documents/01JQ0000000000000000000000",
    headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]

Răspunsuri

StatusCorp
200Bare JSON object, not data-wrapped

Erori

StatusCând apare
403The key lacks knowledge.write
404No such knowledge base, or the document belongs to another base

Exemplu de răspuns, generat din schemă:

json
{
  "deleted": true,
  "id": null
}

Clears a document's chunks and failure state and re-queues it for ingestion ​

POST/knowledge-bases/{knowledgeBase}/documents/{document}/retry
  • Necesită knowledge.write.
  • Accepts any document in any state, not just failed ones, and destroys its existing chunks before re-queueing.

Parametri de cale

NumeTipObligatoriuNote
knowledgeBasestringdaThe knowledge base ID
documentstringdaThe document ID
bash
curl -X POST "$CALLAGENT_API_URL/knowledge-bases/01JQ0000000000000000000000/documents/01JQ0000000000000000000000/retry" \
  -H "Authorization: Bearer $CALLAGENT_API_KEY" \
  -H "Accept: application/json"
js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/knowledge-bases/01JQ0000000000000000000000/documents/01JQ0000000000000000000000/retry`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
    Accept: 'application/json',
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.type}: ${error.message}`);
}

const { data } = await response.json();
php
<?php

$handle = curl_init(getenv('CALLAGENT_API_URL') . '/knowledge-bases/01JQ0000000000000000000000/documents/01JQ0000000000000000000000/retry');

curl_setopt_array($handle, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
        'Accept: application/json',
    ],
]);

$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);

if ($status >= 400) {
    throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}

$data = $body['data'];
python
import os, requests

response = requests.post(
    f"{os.environ['CALLAGENT_API_URL']}/knowledge-bases/01JQ0000000000000000000000/documents/01JQ0000000000000000000000/retry",
    headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]

Răspunsuri

StatusCorp
202KnowledgeDocumentResource

Erori

StatusCând apare
403The key lacks knowledge.write
404No such knowledge base, or the document belongs to another base

Exemplu de răspuns, generat din schemă:

json
{
  "data": {
    "id": "01JQ0000000000000000000000",
    "object": "string",
    "knowledge_base_id": "01JQ0000000000000000000000",
    "title": "string",
    "source_type": "string",
    "source_url": "https://example.com/hook",
    "mime_type": "string",
    "extension": "string",
    "size_bytes": 1,
    "status": "string",
    "progress": 1,
    "failure_code": "string",
    "failure_reason": "string",
    "extracted_chars": 1,
    "chunk_count": 1,
    "token_count": 1,
    "language": "string",
    "metadata": {},
    "ingested_at": "2026-01-01T12:00:00+00:00",
    "created_at": "2026-01-01T12:00:00+00:00"
  }
}

Runs a real hybrid retrieval query against the knowledge base and returns the matching passages ​

POST/knowledge-bases/{knowledgeBase}/query
  • Necesită knowledge.read.
  • Read-only despite being a POST. query is required; top_k, threshold, namespace and metadata_filters override the base's defaults for this call only.

Parametri de cale

NumeTipObligatoriuNote
knowledgeBasestringdaThe knowledge base ID

Corpul cererii

CâmpTipObligatoriuNote
querystringdamax 4000 chars. min 1 chars
top_kinteger | null—min 1. max 50
thresholdnumber | null—min 0. max 1
namespacestring | null—max 255 chars
metadata_filtersstring[] | null—
bash
curl -X POST "$CALLAGENT_API_URL/knowledge-bases/01JQ0000000000000000000000/query" \
  -H "Authorization: Bearer $CALLAGENT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
       "query": "string",
       "top_k": 1,
       "threshold": 1,
       "namespace": "Support Line"
     }'
js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/knowledge-bases/01JQ0000000000000000000000/query`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "query": "string",
    "top_k": 1,
    "threshold": 1,
    "namespace": "Support Line"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.type}: ${error.message}`);
}

const { data } = await response.json();
php
<?php

$handle = curl_init(getenv('CALLAGENT_API_URL') . '/knowledge-bases/01JQ0000000000000000000000/query');

curl_setopt_array($handle, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
        'Accept: application/json',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
    'query' => 'string',
    'top_k' => 1,
    'threshold' => 1,
    'namespace' => 'Support Line',
]),
]);

$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);

if ($status >= 400) {
    throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}

$data = $body['data'];
python
import os, requests

response = requests.post(
    f"{os.environ['CALLAGENT_API_URL']}/knowledge-bases/01JQ0000000000000000000000/query",
    headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
    json={
      "query": "string",
      "top_k": 1,
      "threshold": 1,
      "namespace": "Support Line"
    },
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]

Răspunsuri

StatusCorp
200data-wrapped object

Erori

StatusCând apare
403The key lacks knowledge.read
404No such knowledge base in this organization
422Validation failed, the vector store is unimplemented, or retrieval/embedding failed

Exemplu de răspuns, generat din schemă:

json
{
  "data": {
    "query": "string",
    "untrusted": true,
    "top_score": 1,
    "truncated": true,
    "passages": {}
  }
}

Scrisă după cod. Ce nu este încă implementat este marcat ca atare, niciodată descris ca funcțional.