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

# Send SMS

POST https://sms.send-2.com/v1/message
Content-Type: application/json

Reference: https://docs.send-2.com/send-2-sms-api/send-sms

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /v1/message:
    post:
      operationId: send-sms
      summary: Send SMS
      tags:
        - ''
      parameters:
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Send SMS_Response_200'
        '406':
          description: Not Acceptable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostV1MessageRequestNotAcceptableError'
      requestBody:
        description: This endpoint expects a JSON payload / object.
        content:
          application/json:
            schema:
              type: object
              properties:
                phone:
                  type: string
                  description: >-
                    MPESA hashed phone (e.g.
                    8556a495c390f3ba95d2bdf6d06436f2fd09f516531f0a7cd9591c60812fa46d)
                    or standard international format (e.g. +254722000000)
                text:
                  type: string
                  description: The SMS message content
                sender:
                  type: integer
                  description: The numeric sender ID assigned to your account
              required:
                - phone
                - text
                - sender
servers:
  - url: https://sms.send-2.com
components:
  schemas:
    V1MessagePostResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        id:
          type: string
        status:
          type: string
        units:
          type: integer
      required:
        - id
        - status
        - units
      title: V1MessagePostResponsesContentApplicationJsonSchemaData
    Send SMS_Response_200:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
        data:
          $ref: >-
            #/components/schemas/V1MessagePostResponsesContentApplicationJsonSchemaData
      required:
        - success
        - message
        - data
      title: Send SMS_Response_200
    PostV1MessageRequestNotAcceptableError:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
      required:
        - success
        - message
      title: PostV1MessageRequestNotAcceptableError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

```

## SDK Code Examples

```python Success: using MPESA hashed phone
import requests

url = "https://sms.send-2.com/v1/message"

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Success: using MPESA hashed phone
const url = 'https://sms.send-2.com/v1/message';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: undefined
};

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

```go Success: using MPESA hashed phone
package main

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

func main() {

	url := "https://sms.send-2.com/v1/message"

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 Success: using MPESA hashed phone
require 'uri'
require 'net/http'

url = URI("https://sms.send-2.com/v1/message")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'

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

```java Success: using MPESA hashed phone
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sms.send-2.com/v1/message")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Success: using MPESA hashed phone
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sms.send-2.com/v1/message', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Success: using MPESA hashed phone
using RestSharp;

var client = new RestClient("https://sms.send-2.com/v1/message");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Success: using MPESA hashed phone
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://sms.send-2.com/v1/message")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

```python Success: using numeric phone number
import requests

url = "https://sms.send-2.com/v1/message"

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Success: using numeric phone number
const url = 'https://sms.send-2.com/v1/message';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: undefined
};

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

```go Success: using numeric phone number
package main

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

func main() {

	url := "https://sms.send-2.com/v1/message"

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 Success: using numeric phone number
require 'uri'
require 'net/http'

url = URI("https://sms.send-2.com/v1/message")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'

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

```java Success: using numeric phone number
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sms.send-2.com/v1/message")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Success: using numeric phone number
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sms.send-2.com/v1/message', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Success: using numeric phone number
using RestSharp;

var client = new RestClient("https://sms.send-2.com/v1/message");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Success: using numeric phone number
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://sms.send-2.com/v1/message")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

```python Using MPESA hashed phone
import requests

url = "https://sms.send-2.com/v1/message"

payload = {
    "phone": "8556a495c390f3ba95d2bdf6d06436f2fd09f516531f0a7cd9591c60812fa46d",
    "text": "Hello, your OTP is 123456",
    "sender": 12345
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Using MPESA hashed phone
const url = 'https://sms.send-2.com/v1/message';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"phone":"8556a495c390f3ba95d2bdf6d06436f2fd09f516531f0a7cd9591c60812fa46d","text":"Hello, your OTP is 123456","sender":12345}'
};

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

```go Using MPESA hashed phone
package main

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

func main() {

	url := "https://sms.send-2.com/v1/message"

	payload := strings.NewReader("{\n  \"phone\": \"8556a495c390f3ba95d2bdf6d06436f2fd09f516531f0a7cd9591c60812fa46d\",\n  \"text\": \"Hello, your OTP is 123456\",\n  \"sender\": 12345\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 Using MPESA hashed phone
require 'uri'
require 'net/http'

url = URI("https://sms.send-2.com/v1/message")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"phone\": \"8556a495c390f3ba95d2bdf6d06436f2fd09f516531f0a7cd9591c60812fa46d\",\n  \"text\": \"Hello, your OTP is 123456\",\n  \"sender\": 12345\n}"

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

```java Using MPESA hashed phone
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sms.send-2.com/v1/message")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"phone\": \"8556a495c390f3ba95d2bdf6d06436f2fd09f516531f0a7cd9591c60812fa46d\",\n  \"text\": \"Hello, your OTP is 123456\",\n  \"sender\": 12345\n}")
  .asString();
```

```php Using MPESA hashed phone
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sms.send-2.com/v1/message', [
  'body' => '{
  "phone": "8556a495c390f3ba95d2bdf6d06436f2fd09f516531f0a7cd9591c60812fa46d",
  "text": "Hello, your OTP is 123456",
  "sender": 12345
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Using MPESA hashed phone
using RestSharp;

var client = new RestClient("https://sms.send-2.com/v1/message");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"phone\": \"8556a495c390f3ba95d2bdf6d06436f2fd09f516531f0a7cd9591c60812fa46d\",\n  \"text\": \"Hello, your OTP is 123456\",\n  \"sender\": 12345\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Using MPESA hashed phone
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "phone": "8556a495c390f3ba95d2bdf6d06436f2fd09f516531f0a7cd9591c60812fa46d",
  "text": "Hello, your OTP is 123456",
  "sender": 12345
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://sms.send-2.com/v1/message")! 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()
```

```python Using numeric phone number
import requests

url = "https://sms.send-2.com/v1/message"

payload = {
    "phone": "+254722000000",
    "text": "Hello, your OTP is 123456",
    "sender": 12345
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Using numeric phone number
const url = 'https://sms.send-2.com/v1/message';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"phone":"+254722000000","text":"Hello, your OTP is 123456","sender":12345}'
};

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

```go Using numeric phone number
package main

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

func main() {

	url := "https://sms.send-2.com/v1/message"

	payload := strings.NewReader("{\n  \"phone\": \"+254722000000\",\n  \"text\": \"Hello, your OTP is 123456\",\n  \"sender\": 12345\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 Using numeric phone number
require 'uri'
require 'net/http'

url = URI("https://sms.send-2.com/v1/message")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"phone\": \"+254722000000\",\n  \"text\": \"Hello, your OTP is 123456\",\n  \"sender\": 12345\n}"

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

```java Using numeric phone number
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sms.send-2.com/v1/message")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"phone\": \"+254722000000\",\n  \"text\": \"Hello, your OTP is 123456\",\n  \"sender\": 12345\n}")
  .asString();
```

```php Using numeric phone number
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sms.send-2.com/v1/message', [
  'body' => '{
  "phone": "+254722000000",
  "text": "Hello, your OTP is 123456",
  "sender": 12345
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Using numeric phone number
using RestSharp;

var client = new RestClient("https://sms.send-2.com/v1/message");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"phone\": \"+254722000000\",\n  \"text\": \"Hello, your OTP is 123456\",\n  \"sender\": 12345\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Using numeric phone number
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "phone": "+254722000000",
  "text": "Hello, your OTP is 123456",
  "sender": 12345
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://sms.send-2.com/v1/message")! 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()
```