---
title: "Finish a conversation"
method: POST
path: "/v1/{organization}/conversation/{conversation_id}/finish/"
tags: ["Conversation"]
---

# Finish a conversation

`POST /v1/{organization}/conversation/{conversation_id}/finish/`

## Request

- Base URL: `https://api.amigo.ai`
- URL: `https://api.amigo.ai/v1/{organization}/conversation/{conversation_id}/finish/`
- Auth: HTTP bearer and API key in header `X-ORG-ID` and HTTP basic
- TypeScript: <https://skmtc.dev/amigo/apis/amigo-api/docs/v1/:organization/conversation/:conversation_id/finish/post.ts> (a function with typed inputs; its response is checked against the schema)

Conclude a conversation and asynchronously initiate post-conversation analysis. A conversation created with `is_test` gets no analysis.

This endpoint should only be called on a started, non-finished conversation. It can only be called when the previous [`Start a conversation`](start-conversation) and
[`Interact with a conversation`](interact-with-conversation) calls have finished.

If the conversation has no messages, the conversation is deleted.

It's possible for some conversations to automatically finish during an [`Interact with a conversation`](interact-with-conversation) call (for instance, if the user explicitly sends a message
indicating that they're done with the conversation). In that case, this endpoint shouldn't be called, as the [`Interact with a conversation`](interact-with-conversation) endpoint automatically
wraps up the conversation.

#### Permissions
This endpoint requires the following permissions:
* `User:UpdateUserInfo` on the user who started the conversation.
* `Conversation:FinishConversation` on the conversation.

## Path parameters

- `conversation_id` string, required: The identifier of the conversation to finish.
- `organization` string, required

## Headers

- `x-mongo-cluster-name` string, nullable: The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
- `Sec-WebSocket-Protocol` string[]

## Response `204`

Succeeded.

## Other responses

- `400`: The conversation has no interactions.
- `401`: Invalid authorization credentials.
- `403`: Missing required permissions.
- `404`: Specified organization or conversation is not found.
- `409`: The specified conversation is already finished, or a related operation is in process.
- `422`: Invalid request path parameter failed validation.
- `429`: The user has exceeded the rate limit of 5 requests per minute for this endpoint.
- `503`: The service is going through temporary maintenance.

---

[API](https://skmtc.dev/amigo/apis/amigo-api.md) - [All operations](https://skmtc.dev/amigo/apis/amigo-api/llms.txt) - [OpenAPI document](https://skmtc.dev/amigo/apis/amigo-api/revisions/fd3c06d4bc2c?raw)
