> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.chatbridge.mx/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.chatbridge.mx/_mcp/server.

# Send message

POST https://connect.chatbridge.mx/v1/sms/messages
Content-Type: application/json

Sends an SMS message to a recipient using a mask of the account. The send is **asynchronous**: the API responds `202 Accepted` immediately with a `message_id`; the message status (`SENT`, or an error status such as `FAILED`) is notified later through the status webhook, correlated by that `message_id`.

When the text contains characters outside the GSM-7 alphabet (accents, `ñ`, emoji), send `has_accents: true` so the message is encoded in UCS-2; this reduces the maximum size per segment. When a `complement` is sent, a trackable short link is generated and automatically appended to the end of the text before sending.

Reference: https://docs.chatbridge.mx/sms/messages/send-sms-message

## Authentication

- `x-api-key` header (required) — Account authentication key. The App-Key must have the SMS channel enabled; it cannot be used against the endpoints of other channels.
- `Authorization` header (bearer token, required) — OAuth 2.0 access token issued by `POST /api/oauth/token` (client-credentials). Takes precedence over `x-api-key` when both are sent. See the Authentication section.

## Request

### Body (application/json)

This endpoint expects a SendMessageRequest.

- `mask` (string, required) — Sender mask identifier obtained through GET /v1/sms/masks.
- `to` (string, required) — Destination number; the mask decides how it is read. National mask: 10 digits, also accepted with the Mexico country code `52`/`+52` or `521`/`+521` (for example, `525555555555`, `+5215555555555`), which is removed before sending. International mask (`is_international: true` in GET /v1/sms/masks): E.164 with or without `+`, always with the country code.
- `text` (string, required) — Text of the message.
- `has_accents` (boolean, optional, default: false) — Send `true` when the text contains accents, `ñ`, or other characters outside the GSM-7 alphabet. The message is encoded in UCS-2, which reduces the maximum size per segment.
- `complement` (Complement, optional) — Appends a trackable short link to the end of the message. The link is shortened and added to the text automatically before sending.

## Response

### 202

Message accepted and queued for delivery. Store `message_id`: it is the key to correlate the status webhooks of this send.

- `statusCode` (integer, optional)
- `message` ("ACCEPTED", optional) — Initial status of the send.
- `message_id` (string, optional) — Send identifier. Store it: it is the key to correlate the status webhooks of this send.

## Errors

### 400 Bad Request Error

The request contains invalid data or violates an SMS channel rule. The `errorCode` distinguishes the cause. Body validation errors (missing or malformed fields) respond with `errorCode` 400 and the detail of each field in `message`.

- `message` (string, optional)
- `error` (string, optional)
- `statusCode` (integer, optional)
- `errorCode` (integer, optional)

### 401 Unauthorized Error

Authentication is missing or invalid.

- `message` (string, optional)
- `error` (string, optional)
- `statusCode` (integer, optional)
- `errorCode` (integer, optional)

### 403 Forbidden Error

The API Key does not have access to the SMS channel.

- `message` (string, optional)
- `error` (string, optional)
- `statusCode` (integer, optional)
- `errorCode` (integer, optional)

### 429 Too Many Requests Error

The requests-per-minute limit was exceeded.

- `message` (string, optional)
- `error` (string, optional)
- `statusCode` (integer, optional)
- `errorCode` (integer, optional)

### 500 Internal Server Error

Unhandled internal error, including a temporary failure while checking the numbering plan. The message was not sent; the request can be retried.

- `message` (string, optional)
- `error` (string, optional)
- `statusCode` (integer, optional)
- `errorCode` (integer, optional)

## Types

### Complement

Appends a trackable short link to the end of the message. The link is shortened and added to the text automatically before sending.

- `link` (string, required) — Destination URL to shorten.
- `ttl_events` (integer, optional, default: 1440) — Validity of the short link for click tracking, in minutes. Minimum: 60 (1 hour); maximum: 4320 (72 hours). A value outside that range is rejected with `400`. Default: 1440 (24 hours).

## Examples

### Plain text

**Request**

```json
{
  "mask": "6a4bffd5e77672e33fd5304f",
  "to": "5555555555",
  "text": "mensaje ejemplo Chatbridge."
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "message_id": "b3e1c2a4-9f3d-4b7a-8c1e-2a6f9d3b7e10"
}
```

**SDK Code**

```python Plain text
import requests

url = "https://connect.chatbridge.mx/v1/sms/messages"

payload = {
    "mask": "6a4bffd5e77672e33fd5304f",
    "to": "5555555555",
    "text": "mensaje ejemplo Chatbridge."
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Plain text
const url = 'https://connect.chatbridge.mx/v1/sms/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"mask":"6a4bffd5e77672e33fd5304f","to":"5555555555","text":"mensaje ejemplo Chatbridge."}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Plain text
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://connect.chatbridge.mx/v1/sms/messages"

	payload := strings.NewReader("{\n  \"mask\": \"6a4bffd5e77672e33fd5304f\",\n  \"to\": \"5555555555\",\n  \"text\": \"mensaje ejemplo Chatbridge.\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Plain text
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/sms/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"mask\": \"6a4bffd5e77672e33fd5304f\",\n  \"to\": \"5555555555\",\n  \"text\": \"mensaje ejemplo Chatbridge.\"\n}"

response = http.request(request)
puts response.read_body
```

```java Plain text
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/sms/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"mask\": \"6a4bffd5e77672e33fd5304f\",\n  \"to\": \"5555555555\",\n  \"text\": \"mensaje ejemplo Chatbridge.\"\n}")
  .asString();
```

```php Plain text
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/sms/messages', [
  'body' => '{
  "mask": "6a4bffd5e77672e33fd5304f",
  "to": "5555555555",
  "text": "mensaje ejemplo Chatbridge."
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Plain text
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/sms/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"mask\": \"6a4bffd5e77672e33fd5304f\",\n  \"to\": \"5555555555\",\n  \"text\": \"mensaje ejemplo Chatbridge.\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Plain text
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "mask": "6a4bffd5e77672e33fd5304f",
  "to": "5555555555",
  "text": "mensaje ejemplo Chatbridge."
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/sms/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Text with accents (UCS-2)

**Request**

```json
{
  "mask": "6a4bffd5e77672e33fd5304f",
  "to": "5555555555",
  "text": "mensaje ejemplo Chatbridge.",
  "has_accents": true
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "message_id": "b3e1c2a4-9f3d-4b7a-8c1e-2a6f9d3b7e10"
}
```

**SDK Code**

```python Text with accents (UCS-2)
import requests

url = "https://connect.chatbridge.mx/v1/sms/messages"

payload = {
    "mask": "6a4bffd5e77672e33fd5304f",
    "to": "5555555555",
    "text": "mensaje ejemplo Chatbridge.",
    "has_accents": True
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Text with accents (UCS-2)
const url = 'https://connect.chatbridge.mx/v1/sms/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"mask":"6a4bffd5e77672e33fd5304f","to":"5555555555","text":"mensaje ejemplo Chatbridge.","has_accents":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Text with accents (UCS-2)
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://connect.chatbridge.mx/v1/sms/messages"

	payload := strings.NewReader("{\n  \"mask\": \"6a4bffd5e77672e33fd5304f\",\n  \"to\": \"5555555555\",\n  \"text\": \"mensaje ejemplo Chatbridge.\",\n  \"has_accents\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Text with accents (UCS-2)
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/sms/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"mask\": \"6a4bffd5e77672e33fd5304f\",\n  \"to\": \"5555555555\",\n  \"text\": \"mensaje ejemplo Chatbridge.\",\n  \"has_accents\": true\n}"

response = http.request(request)
puts response.read_body
```

```java Text with accents (UCS-2)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/sms/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"mask\": \"6a4bffd5e77672e33fd5304f\",\n  \"to\": \"5555555555\",\n  \"text\": \"mensaje ejemplo Chatbridge.\",\n  \"has_accents\": true\n}")
  .asString();
```

```php Text with accents (UCS-2)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/sms/messages', [
  'body' => '{
  "mask": "6a4bffd5e77672e33fd5304f",
  "to": "5555555555",
  "text": "mensaje ejemplo Chatbridge.",
  "has_accents": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Text with accents (UCS-2)
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/sms/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"mask\": \"6a4bffd5e77672e33fd5304f\",\n  \"to\": \"5555555555\",\n  \"text\": \"mensaje ejemplo Chatbridge.\",\n  \"has_accents\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Text with accents (UCS-2)
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "mask": "6a4bffd5e77672e33fd5304f",
  "to": "5555555555",
  "text": "mensaje ejemplo Chatbridge.",
  "has_accents": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/sms/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### With trackable short link

**Request**

```json
{
  "mask": "6a4bffd5e77672e33fd5304f",
  "to": "5555555555",
  "text": "mensaje ejemplo Chatbridge.",
  "has_accents": true,
  "complement": {
    "link": "https://google.com",
    "ttl_events": 1440
  }
}
```

**Response**

```json
{
  "statusCode": 202,
  "message": "ACCEPTED",
  "message_id": "b3e1c2a4-9f3d-4b7a-8c1e-2a6f9d3b7e10"
}
```

**SDK Code**

```python With trackable short link
import requests

url = "https://connect.chatbridge.mx/v1/sms/messages"

payload = {
    "mask": "6a4bffd5e77672e33fd5304f",
    "to": "5555555555",
    "text": "mensaje ejemplo Chatbridge.",
    "has_accents": True,
    "complement": {
        "link": "https://google.com",
        "ttl_events": 1440
    }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript With trackable short link
const url = 'https://connect.chatbridge.mx/v1/sms/messages';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"mask":"6a4bffd5e77672e33fd5304f","to":"5555555555","text":"mensaje ejemplo Chatbridge.","has_accents":true,"complement":{"link":"https://google.com","ttl_events":1440}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go With trackable short link
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://connect.chatbridge.mx/v1/sms/messages"

	payload := strings.NewReader("{\n  \"mask\": \"6a4bffd5e77672e33fd5304f\",\n  \"to\": \"5555555555\",\n  \"text\": \"mensaje ejemplo Chatbridge.\",\n  \"has_accents\": true,\n  \"complement\": {\n    \"link\": \"https://google.com\",\n    \"ttl_events\": 1440\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby With trackable short link
require 'uri'
require 'net/http'

url = URI("https://connect.chatbridge.mx/v1/sms/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"mask\": \"6a4bffd5e77672e33fd5304f\",\n  \"to\": \"5555555555\",\n  \"text\": \"mensaje ejemplo Chatbridge.\",\n  \"has_accents\": true,\n  \"complement\": {\n    \"link\": \"https://google.com\",\n    \"ttl_events\": 1440\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java With trackable short link
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://connect.chatbridge.mx/v1/sms/messages")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"mask\": \"6a4bffd5e77672e33fd5304f\",\n  \"to\": \"5555555555\",\n  \"text\": \"mensaje ejemplo Chatbridge.\",\n  \"has_accents\": true,\n  \"complement\": {\n    \"link\": \"https://google.com\",\n    \"ttl_events\": 1440\n  }\n}")
  .asString();
```

```php With trackable short link
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://connect.chatbridge.mx/v1/sms/messages', [
  'body' => '{
  "mask": "6a4bffd5e77672e33fd5304f",
  "to": "5555555555",
  "text": "mensaje ejemplo Chatbridge.",
  "has_accents": true,
  "complement": {
    "link": "https://google.com",
    "ttl_events": 1440
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp With trackable short link
using RestSharp;

var client = new RestClient("https://connect.chatbridge.mx/v1/sms/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"mask\": \"6a4bffd5e77672e33fd5304f\",\n  \"to\": \"5555555555\",\n  \"text\": \"mensaje ejemplo Chatbridge.\",\n  \"has_accents\": true,\n  \"complement\": {\n    \"link\": \"https://google.com\",\n    \"ttl_events\": 1440\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift With trackable short link
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "mask": "6a4bffd5e77672e33fd5304f",
  "to": "5555555555",
  "text": "mensaje ejemplo Chatbridge.",
  "has_accents": true,
  "complement": [
    "link": "https://google.com",
    "ttl_events": 1440
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://connect.chatbridge.mx/v1/sms/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```