> For the complete documentation index, see [llms.txt](https://docs.stammer.ai/stammer.ai-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stammer.ai/stammer.ai-docs/white-label/white-label-api/knowledge-base-api/add-ai-agent-q-a.md).

# Add AI Agent Q/A

Add Q/A to chatbot via API

You can interact with this API by sending a `POST` request. This API allows you to train your chatbot with given a Question and Answer.

***

**API Endpoint**

The following endpoint/URL should be used in order to access this API:

```
https://app.stammer.ai/en/chatbot/api/v1/qa/
```

***

**Request Headers**

The API must have the following request headers:

```
Content-Type: application/json
Authorization: Token <Your-API-Token>
```

***

**Request Body**

The API requires the following parameters in the request body:

* **`chatbot_uuid`** (Type: UUID, Required)

  Unique identifier (UUID) of the chatbot. You can find this UUID on the chatbot's detail page.
*
* **`question`** (Type: String, Required)

  Question to train chatbot. Must be under 5000 characters.
*
* **`answer`** (Type: String, Required)

  Answer of the above question to the chatbot. Must be under 5000 characters.

<figure><img src="/files/MmfPfJw0jEQjI1DHiJa6" alt=""><figcaption></figcaption></figure>

**Request Example**

Here's an example of the request:

```python
import requests

# Define the API endpoint
url = "https://app.stammer.ai/en/chatbot/api/v1/qa/"

# Set up authentication and headers
headers = {
    'Authorization': 'Token <YOUR-API-TOKEN>',
    'Content-Type': 'application/json',
    'Accept': 'application/json'
}



# Data is passed in the request body as JSON
data = {

    "chatbot_uuid": "12345678-1234-5678-1234-567812345678",

    "question": "Your message/string here.",

    "answer": "Your message/string here."

}
response = requests.post(url, headers=headers, json=data)



# Process the response
if response.status_code in (200, 201, 202):
    result = response.json()
    print("Response data:", result)
else:
    try:
        error_data = response.json()
        error_message = error_data.get('message') or error_data.get('error', 'Unknown error')
        print(f"Error: {error_message}")
    except ValueError:
        print(f"Error: Status code {response.status_code}")

```

Learn More - <https://app.stammer.ai/en/api-docs/chatbot/QA/>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.stammer.ai/stammer.ai-docs/white-label/white-label-api/knowledge-base-api/add-ai-agent-q-a.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
