Training Data Input API
Purpose
This API saves question-and-answer data to Sidetalk with a specified category ID.
URL
HTTP method
POST
Headers
| Headers | Value | Description |
| Content-Type | application/json | Indicates that the request body is JSON. |
| Authorization | Bearer <api_key> | Use the API key provided under Install in the Sidetalk dashboard. |
Body
| Parameter | Type | Required | Description |
| categoryId | String | No | The category ID for the questions and answers. Manage categories in AI Category Management in the Sidetalk dashboard. |
| question | String | Yes | The user question. Pass one question as a string. |
| answer | String | Yes | The answer to the question. |
Example request
Bash
curl -X POST https://api.sidetalk.ai/v1/knowledge/qna \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${API_KEY}" \
-d '{
"categoryId": "1",
"question": "안녕하세요, 도움이 필요해요.",
"answer": "안녕하세요! 무엇을 도와드릴까요?"
}'Response format
Success response (200 OK)
When the request succeeds and question-and-answer data is saved, the following response is returned.
Response body
JSON
{
"success": true,
"data": {
"site_id": //해당 site_id,
"categoryId": "1",
"question": "안녕하세요, 도움이 필요해요.",
"answer": "안녕하세요! 무엇을 도와드릴까요?",
"created_at": "20241108120639",
},
"message": "Data has been successfully saved."
}Response fields
| Field | Type | Description |
| success | boolean | Indicates that the request succeeded; always true. |
| data | object | Contains information about the saved data. |
| data.site_id | integer | The site ID used for the request. |
| data.categoryId | string | The category ID of the saved question and answer. |
| data.question | string | The saved question. |
| data.answer | string | The saved answer. |
| data.created_at | string | The time the data was saved. |
| message | string | A message indicating request success. |
Error response (500 Internal Server Error)
If a server error or request processing problem occurs, the following response is returned.
Response body
JSON
{
"success": false,
"error": "오류 메시지 내용"
}Error response fields
| Field | Type | Description |
| success | boolean | Indicates that the request failed; always false. |
| error | string | Includes the error message and provides the cause of the problem. |
