---
title: "Send an outbound SMS or MMS message"
description: "Sends a text, image, or video message through the workspace phone number and saves the outbound message to LiveChat history."
---

> 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 /send-sms`

Sends a text, image, or video message through the workspace phone number and saves the outbound message to LiveChat history.

## Authentication

- `ApiKeyAuth`, apiKey, in header, header `X-API-Key`, format `API_KEY`

## Header parameters

- `X-Workspace-Id` (`post/send-sms.header.X-Workspace-Id`; string, required) — Workspace ID for data isolation

## Request body

_Required._

- `to` (`post/send-sms.to`; string, required) — Recipient phone number.
- `workspaceId` (`post/send-sms.workspaceId`; string, required) — Workspace identifier.
- `contactId` (`post/send-sms.contactId`; string, required) — Contact identifier.
  - format `uuid`
- `message` (`post/send-sms.message`; string, optional) — Message body.
- `mediaUrls` (`post/send-sms.mediaUrls`; array<string>, optional)
  - format `uri`
- `messageType` (`post/send-sms.messageType`; string, optional)
  - one of `"text"`, `"image"`, `"video"`; default `"text"`
- `mediaData` (`post/send-sms.mediaData`; object, optional)

## Example requests

### Simple SMS message

```json
{
  "to": "+1234567890",
  "message": "Hello! This is a test message.",
  "workspaceId": "123e4567-e89b-12d3-a456-426614174000"
}
```

### Personalized SMS with merge fields

```json
{
  "to": "+1234567890",
  "message": "Hi {{firstName}}, your appointment on {{appointmentDate}} is confirmed!",
  "workspaceId": "123e4567-e89b-12d3-a456-426614174000",
  "contactId": "456e7890-e89b-12d3-a456-426614174001"
}
```

### MMS with media attachment

```json
{
  "to": "+1234567890",
  "message": "Check out this awesome product!",
  "mediaUrl": "https://example.com/product-image.jpg",
  "workspaceId": "123e4567-e89b-12d3-a456-426614174000",
  "campaignId": "789e1234-e89b-12d3-a456-426614174002"
}
```

### Scheduled SMS message

```json
{
  "to": "+1234567890",
  "message": "Reminder: Your appointment is tomorrow at 2 PM",
  "workspaceId": "123e4567-e89b-12d3-a456-426614174000",
  "scheduledTime": "2024-02-15T14:00:00Z",
  "priority": "high"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.channelautomation.com/send-sms \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <X-API-Key>' \
  --header 'X-Workspace-Id: 15213' \
  --data '
{
  "to": "+1234567890",
  "message": "Hello! This is a test message.",
  "workspaceId": "123e4567-e89b-12d3-a456-426614174000"
}
'
```

### TypeScript

```typescript
const url = 'https://api.channelautomation.com/send-sms';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Workspace-Id': '15213',
    'X-API-Key': '<X-API-Key>'
  },
  body: JSON.stringify({
    to: '+1234567890',
    message: 'Hello! This is a test message.',
    workspaceId: '123e4567-e89b-12d3-a456-426614174000'
  })
};

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/send-sms"

payload = {
    "to": "+1234567890",
    "message": "Hello! This is a test message.",
    "workspaceId": "123e4567-e89b-12d3-a456-426614174000"
}
headers = {
    "Content-Type": "application/json",
    "X-Workspace-Id": "15213",
    "X-API-Key": "<X-API-Key>"
}

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

print(response.text)
```

## Responses

### 200

Message sent and saved successfully.

#### Example

```json
{
  "success": true,
  "message": "SMS sent successfully",
  "messageSid": "SM1234567890abcdef1234567890abcdef",
  "messageId": "123e4567-e89b-12d3-a456-426614174000",
  "cost": "0.0075",
  "status": "queued",
  "queuedAt": "2024-01-15T10:30:00Z",
  "estimatedDelivery": "2024-01-15T10:30:05Z"
}
```

- `success` (`post/send-sms.response.200.success`; boolean, optional) — Whether the SMS was sent successfully
- `messageSid` (`post/send-sms.response.200.messageSid`; string, optional) — Twilio message SID for tracking
- `message` (`post/send-sms.response.200.message`; string, optional) — Success or error message
- `cost` (`post/send-sms.response.200.cost`; string, optional) — Message cost in USD

### 400

Missing or invalid request fields.

#### Example

```json
{
  "error": "Validation failed",
  "details": [
    "string"
  ]
}
```

- `error` (`post/send-sms.response.400.error`; string, optional)
  - example `"Validation failed"`
- `details` (`post/send-sms.response.400.details`; array<string>, optional)

### 401

Authentication required

#### Example

```json
{
  "error": "Authentication required",
  "success": false
}
```

- `error` (`post/send-sms.response.401.error`; string, optional)
  - example `"Authentication required"`
- `success` (`post/send-sms.response.401.success`; boolean, optional)
  - example `false`

### 402

Insufficient balance or quota exceeded

#### Example

```json
{
  "success": false,
  "error": "Insufficient SMS balance or quota exceeded",
  "balance": "string",
  "quota_remaining": 0
}
```

- `success` (`post/send-sms.response.402.success`; boolean, optional)
  - example `false`
- `error` (`post/send-sms.response.402.error`; string, optional)
  - example `"Insufficient SMS balance or quota exceeded"`
- `balance` (`post/send-sms.response.402.balance`; string, optional) — Current account balance
- `quota_remaining` (`post/send-sms.response.402.quota_remaining`; integer, optional) — Remaining SMS quota for current period

### 403

Contact cannot receive messages

### 404

Workspace phone number or contact was not found.

### 500

Failed to send or save the message.

#### Example

```json
{
  "error": "Internal server error",
  "details": "string",
  "success": false
}
```

- `error` (`post/send-sms.response.500.error`; string, optional)
  - example `"Internal server error"`
- `details` (`post/send-sms.response.500.details`; string, optional)
- `success` (`post/send-sms.response.500.success`; boolean, optional)
  - example `false`


Source: https://developer.channelautomations.com/api/send-sms/create/index.md
