Create Q&A documents
此页面暂无中文版本。显示默认语言(English)。
Create Q&A documents
https://api.cekat.ai/api/documentsAdds question-and-answer pairs to an AI agent’s knowledge. Pairs that already exist with the same question and answer, and items missing a question or answer, are skipped. New pairs are processed for the AI agent to use.
Authorization
Your Cekat API key, from Settings → Developers & API in the Cekat dashboard.
Alternative to api_key: send the same key as Bearer YOUR_API_KEY.
Body application/jsonrequired
Show child attributes
Response
Nothing new to add; every pair already exists.
Show child attributes
Q&A added.
Show child attributes
The Q&A pairs that were added, with their new IDs.
Show child attributes
ai_agent_id or qna is missing, or qna is not an array.
Show child attributes
Request ID. Include it when contacting Cekat support.
The API key is missing or invalid.
Show child attributes
Request ID. Include it when contacting Cekat support.
The AI agent was not found.
Show child attributes
Request ID. Include it when contacting Cekat support.
Rate limit exceeded. Wait and retry.
curl --request POST \
--url 'https://api.cekat.ai/api/documents' \
--header 'api_key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"ai_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"qna": [
{
"question": "<string>",
"answer": "<string>"
}
]
}'
const response = await fetch('https://api.cekat.ai/api/documents', {
method: 'POST',
headers: { 'api_key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({
"ai_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"qna": [
{
"question": "<string>",
"answer": "<string>"
}
]
})
});
const data = await response.json();
console.log(data);
import requests
url = "https://api.cekat.ai/api/documents"
headers = {"api_key": "YOUR_API_KEY"}
payload = {
"ai_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"qna": [
{
"question": "<string>",
"answer": "<string>"
}
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.cekat.ai/api/documents',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['api_key: YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'ai_agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'qna' => [[
'question' => '<string>',
'answer' => '<string>'
]]
]),
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"success": true,
"message": "<string>",
"data": {
"ids": [
{}
]
}
}
{
"success": true,
"message": "<string>",
"data": {
"ids": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"question": "<string>",
"answer": "<string>"
}
]
}
}
{
"success": true,
"message": "<string>",
"statusCode": 1,
"error": {
"message": "<string>"
},
"correlationId": "<string>"
}
{
"success": true,
"message": "<string>",
"statusCode": 1,
"error": {
"message": "<string>"
},
"correlationId": "<string>"
}
{
"success": true,
"message": "<string>",
"statusCode": 1,
"error": {
"message": "<string>"
},
"correlationId": "<string>"
}
{
"message": "<string>"
}