Create Q&A documents

このページは 日本語 ではまだ利用できません。デフォルトの言語 (English) で表示しています。

Create Q&A documents

POSThttps://api.cekat.ai/api/documents

Adds 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

api_keystringheaderrequired

Your Cekat API key, from Settings → Developers & API in the Cekat dashboard.

Authorizationstringheader

Alternative to api_key: send the same key as Bearer YOUR_API_KEY.

Body application/jsonrequired

ai_agent_idstring<uuid>required
qnaobject[]required
Show child attributes
questionstringrequired
answerstringrequired

Response

200
201
400
401
404
429

Nothing new to add; every pair already exists.

successboolean
messagestring
dataobject
Show child attributes
idsobject[]

Q&A added.

successboolean
messagestring
dataobject
Show child attributes
idsobject[]

The Q&A pairs that were added, with their new IDs.

Show child attributes
idstring
questionstring
answerstring

ai_agent_id or qna is missing, or qna is not an array.

successboolean
messagestring
statusCodeinteger
errorobject
Show child attributes
messagestring
correlationIdstring

Request ID. Include it when contacting Cekat support.

The API key is missing or invalid.

successboolean
messagestring
statusCodeinteger
errorobject
Show child attributes
messagestring
correlationIdstring

Request ID. Include it when contacting Cekat support.

The AI agent was not found.

successboolean
messagestring
statusCodeinteger
errorobject
Show child attributes
messagestring
correlationIdstring

Request ID. Include it when contacting Cekat support.

Rate limit exceeded. Wait and retry.

messagestring
POST/api/documents
cURL
JavaScript
Python
PHP
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;
Response
200
201
400
401
404
429
{
  "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>"
}