> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# End of Conversation API

<Badge icon="arrow-left" color="gray">[Back to API List](/ai-for-service/apis/agent-ai/api-list)</Badge>

Notifies Agent AI when a conversation terminates, triggering configured post-conversation actions such as cleanup and state reset. Invoke this API only once at the final termination of the call — whether it ends normally or unexpectedly — to ensure accurate event handling and prevent duplicate processing.

***

## API Details

| **Field**         | **Value**                                                                                                                        |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| **Method**        | `POST`                                                                                                                           |
| **Endpoint**      | `https://{{host}}/agentai/api/v1/hooks/{{botId}}`                                                                                |
| **Content Type**  | `application/json`                                                                                                               |
| **Authorization** | `auth: {{JWT}}` — See [How to generate the JWT Token](/ai-for-service/apis/automation/api-introduction#generating-the-jwt-token) |

## Path Parameters

| **Parameter** | **Required** | **Description**                                                                   |
| ------------- | ------------ | --------------------------------------------------------------------------------- |
| `host`        | Yes          | The environment URL. For example, `https://platform.kore.ai`.                     |
| `botId`       | Yes          | AI Agent ID or Stream ID. Available on the General Settings page of the AI Agent. |

## Sample Request

```bash theme={null}
curl --location 'https://{{host}}/agentai/api/v1/hooks/st-56fbfece-0293-55a3-9154-7e3e19xxxxxx' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data '{
    "botId": "st-56fbfece-0293-55a3-9154-7e3e19xxxxxx",
    "conversationId": "atesta-mlxxxxxx",
    "events": [{
        "name": "END_OF_CONVERSATION",
        "reason": "agent_initiated",
        "language": "en",
        "experience": "voice",
        "participant": {
            "identity": "agent1",
            "name": "Agent AI",
            "type": "agent",
            "customFields": {
                "agentEmail": "qqqqqq",
                "queueId": "1694",
                "queueName": "queue11"
            }
        }
    }]
}'
```

## Body Parameters

| **Parameter**                                  | **Required** | **Description**                                                     |
| ---------------------------------------------- | ------------ | ------------------------------------------------------------------- |
| `conversationId`                               | Yes          | Unique identifier of the conversation.                              |
| `botId`                                        | Yes          | Unique identifier of the bot.                                       |
| `events`                                       | Yes          | List of events to trigger.                                          |
| `events[].name`                                | Yes          | Name of the event. For example, `"END_OF_CONVERSATION"`.            |
| `events[].reason`                              | Yes          | Reason for ending the conversation. For example, `agent_initiated`. |
| `events[].language`                            | Yes          | Language of the conversation. For example, `en`.                    |
| `events[].experience`                          | Yes          | Interaction type. For example, `voice` or `chat`.                   |
| `events[].participant`                         | Yes          | Participant details associated with the event.                      |
| `events[].participant.identity`                | Yes          | Unique participant identifier.                                      |
| `events[].participant.name`                    | Yes          | Display name of the participant.                                    |
| `events[].participant.type`                    | Yes          | Participant type. For example, `agent`.                             |
| `events[].participant.customFields`            | No           | Custom metadata associated with the participant.                    |
| `events[].participant.customFields.agentEmail` | No           | Agent email identifier.                                             |
| `events[].participant.customFields.queueId`    | No           | Queue identifier.                                                   |
| `events[].participant.customFields.queueName`  | No           | Queue name.                                                         |

## Sample Response

```json theme={null}
{
    "STATUS": "OK"
}
```
