---
title: "Send a message via Twilio for a workspace"
---

> Documentation Index
> Fetch the complete documentation index at: https://developer.channelautomations.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Channel Automation API › Messages

`POST /api/send-message`

## Request body

_Required._

- `to` (`post/api/send-message.to`; string, required) — The recipient's phone number
- `content` (`post/api/send-message.content`; string, required) — The message body
- `workspaceId` (`post/api/send-message.workspaceId`; string, required) — The workspace ID

## Example request

```json
{
  "to": "string",
  "content": "string",
  "workspaceId": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.channelautomation.com/api/send-message \
  --header 'Content-Type: application/json' \
  --data '
{
  "to": "string",
  "content": "string",
  "workspaceId": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.channelautomation.com/api/send-message';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({to: 'string', content: 'string', workspaceId: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.channelautomation.com/api/send-message"

payload = {
    "to": "string",
    "content": "string",
    "workspaceId": "string"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Message sent successfully

#### Example

```json
{
  "success": true,
  "message": "string",
  "sid": "string"
}
```

- `success` (`post/api/send-message.response.200.success`; boolean, optional)
- `message` (`post/api/send-message.response.200.message`; string, optional)
- `sid` (`post/api/send-message.response.200.sid`; string, optional)

### 400

Missing required fields

#### Example

```json
{
  "success": true,
  "error": "string"
}
```

- `success` (`post/api/send-message.response.400.success`; boolean, optional)
- `error` (`post/api/send-message.response.400.error`; string, optional)

### 500

Internal server error

#### Example

```json
{
  "success": true,
  "error": "string"
}
```

- `success` (`post/api/send-message.response.500.success`; boolean, optional)
- `error` (`post/api/send-message.response.500.error`; string, optional)


Source: https://developer.channelautomations.com/api/post-api-send-message/index.md
