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

# Send Live Agent Message

> Send a message from a live agent to the user, or end the conversation.

Use this endpoint to send messages from your live agent platform back to the user in the widget. This is the counterpart to the webhooks Bland sends to your system during a [live agent escalation](https://docs.bland.ai/tutorials/chat-widget.md#escalate-to-live-agents).

### Headers

**authorization** `string` *required*

Your API key for authentication.

### Path Parameters

**id** `string` *required*

The widget ID.

**thread\_id** `string` *required*

The thread ID from the `INITIAL_CONVERSATION` webhook payload.

### Body

The request body accepts two payload types:

> [tab] MESSAGE
>
> Send a message to the user.
>
> **type** `string` *required*
>
> Must be `"MESSAGE"`.
>
> **content** `string` *required*
>
> The message content to display to the user.
>
> **sender\_id** `string` *required*
>
> Identifier for the live agent sending the message. This can be used to distinguish between different agents in the conversation.
>
> **created\_at** `string`
>
> Optional ISO 8601 timestamp for the message. Defaults to the current time if not provided.

> [tab] END\_CONVERSATION
>
> End the live agent session.
>
> **type** `string` *required*
>
> Must be `"END_CONVERSATION"`.
>
> **sender\_id** `string`
>
> Optional identifier for the agent ending the conversation.

### Response

**status** `number`

HTTP status code (200 for success).

**data** `object`

For `MESSAGE` requests, returns the created message object. For `END_CONVERSATION` requests, returns the updated thread object with `ended_at` timestamp.

**errors** `array | null`

Array of error objects if the request failed, otherwise null.

### Error Codes

| Status | Error | Description |
| - | - | - |
| 400 | `INVALID_PARAMETER` | Request body validation failed. |
| 400 | `THREAD_ENDED` | The thread has already been ended. |
| 404 | `NOT_FOUND` | Thread not found with the given ID. |

```bash Send Message theme={null}
curl -X POST "https://api.bland.ai/v1/widget/{widget_id}/threads/{thread_id}/webhook" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "MESSAGE",
    "content": "Hi! I am a live agent. How can I help you today?",
    "sender_id": "agent_123"
  }'
```

```bash End Conversation theme={null}
curl -X POST "https://api.bland.ai/v1/widget/{widget_id}/threads/{thread_id}/webhook" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "END_CONVERSATION",
    "sender_id": "agent_123"
  }'
```

```json Message Response theme={null}
{
  "data": {
    "created_at": "2025-12-10T19:27:02.941Z",
    "updated_at": "2025-12-10T19:27:02.941Z",
    "id": "30a3e35d-9ffb-4810-aef7-2600346107e6",
    "org_id": "99a0d526-6910-4f31-92b8-72834d0827fb",
    "widget_id": "b5f3fb6b-2285-4c73-95be-6609eca09986",
    "thread_id": "f5ff280b-b0d8-4261-a1ed-b74003e733a2",
    "pathway_session_id": null,
    "sender_type": "LIVE_AGENT",
    "sender_id": "49e6e820-f5b7-4fb1-8aa8-7fb162fbcf91",
    "content": "You have a great day too!"
  },
  "errors": null
}
```

```json End Conversation Response theme={null}
{
  "data": {
    "created_at": "2025-12-10T19:25:00.809Z",
    "updated_at": "2025-12-10T20:26:41.180Z",
    "ended_at": "2025-12-10T20:26:41.179Z",
    "live_agent_handoff_at": "2025-12-10T19:25:04.745Z",
    "id": "f5ff280b-b0d8-4261-a1ed-b74003e733a2",
    "org_id": "99a0d526-6910-4f31-92b8-72834d0827fb",
    "widget_id": "b5f3fb6b-2285-4c73-95be-6609eca09986",
    "visitor_id": "ec14ee83-fa2b-493a-b009-0e29414a1e97",
    "live_agent_endpoint_url": "https://webhook.site/32d53101-7d67-4879-b350-6aa2d1e12ada",
    "language": "en"
  },
  "errors": null
}
```

***

Docs for agents: [llms.txt](https://docs.bland.ai/llms.txt)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.