> For the complete documentation index, see [llms.txt](https://docs.cekat.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cekat.ai/api-documentation/ai/create-q-and-a-documents.md).

# Create Q\&A 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.

```json
{"openapi":"3.0.3","info":{"title":"Cekat Open API","version":"1.0.0"},"tags":[{"name":"AI","description":"Manage your AI agents' Q&A knowledge, test AI replies, and manage the OrderOnline integration."}],"servers":[{"url":"https://api.cekat.ai","description":"Production"}],"security":[{"CekatApiKey":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"CekatApiKey":{"type":"apiKey","in":"header","name":"api_key","description":"Your business's Cekat API key, from **Settings → Developers & API** in the Cekat dashboard (https://chat.cekat.ai/developers?section=apikeys). Available on the Business and Enterprise plans."},"BearerAuth":{"type":"http","scheme":"bearer","description":"The same Cekat API key, sent as `Authorization: Bearer YOUR_API_KEY`. Accepted only by endpoints under `/api/...`."}},"schemas":{"ApiError":{"type":"object","description":"Error body returned by the `/api/...` endpoints.","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"statusCode":{"type":"integer"},"error":{"type":"object","properties":{"message":{"type":"string"}}},"correlationId":{"type":"string","description":"Request ID. Include it when contacting Cekat support."}}},"RateLimitError":{"type":"object","properties":{"message":{"type":"string"}}}},"responses":{"ApiUnauthorized":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"TooManyRequests":{"description":"Rate limit exceeded. Wait and retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitError"}}}}}},"paths":{"/api/documents":{"post":{"tags":["AI"],"operationId":"CreateQnaDocuments","summary":"Create Q&A documents","description":"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.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ai_agent_id","qna"],"properties":{"ai_agent_id":{"type":"string","format":"uuid"},"qna":{"type":"array","items":{"type":"object","required":["question","answer"],"properties":{"question":{"type":"string"},"answer":{"type":"string"}}}}}}}}},"responses":{"200":{"description":"Nothing new to add; every pair already exists.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"object"}}}}}}}}},"201":{"description":"Q&A added.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"ids":{"type":"array","description":"The Q&A pairs that were added, with their new IDs.","items":{"type":"object","properties":{"id":{"type":"string"},"question":{"type":"string"},"answer":{"type":"string"}}}}}}}}}}},"400":{"description":"`ai_agent_id` or `qna` is missing, or `qna` is not an array.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"$ref":"#/components/responses/ApiUnauthorized"},"404":{"description":"The AI agent was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"$ref":"#/components/responses/TooManyRequests"}}}}}}
```
