# AI Agent Conversations

You can interact with this API by sending a `GET` request. This allows you to get conversations of specific AI Agent in your Agency Account.

\
**API Endpoint**

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

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

**Request Headers**

The API must have the following request headers:

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

**Request Body**

* `chatbot_id` (Type: Integer, Optional)
  * The ID of the chatbot.
  * If provided, 'chatbot\_uuid' should not be used.
* `chatbot_uuid` (Type: UUID, Optional)
  * The UUID of the chatbot.
  * If provided, 'chatbot\_id' should not be used.
* `startDate` (Type: Date, Optional)
  * The start date for filtering conversations.
  * If both 'startDate' and 'endDate' are provided, 'startDate' should not be later than 'endDate'.
* `endDate` (Type: Date, Optional)
  * The end date for filtering conversations.
  * If both 'startDate' and 'endDate' are provided, 'startDate' should not be later than 'endDate'.
* `sourcePlatform` (Type: Choice, Optional)
  * The source platform from which the conversation originated.
* `onlyDeletedConversations` (Type: Boolean, Required)
  * Flag to filter only deleted conversations.
* `conversation_number` (Type: Integer, Optional)
  * The conversation number for filtering conversations.

**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/conversations/"

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



# Data is passed as URL query parameters
params = {

    "chatbot_id": 610,

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

    "startDate": "2023-12-01",

    "endDate": "2023-12-01",

    "sourcePlatform": "Choices:['none', 'whatsapp', 'facebook', 'instagram', 'dashboard', 'embeded', 'shared', 'personalized', 'API', 'AUDIO', 'masterchat']",

    "onlyDeletedConversations": True,

    "conversation_number": 610

}
response = requests.get(url, headers=headers, params=params)



# 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/conversations>


---

# Agent Instructions: 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:

```
GET https://docs.stammer.ai/stammer.ai-docs/white-label/white-label-api/conversations/ai-agent-conversations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
