Company
This document provides in-depth instructions on how to send & receive text messages using the TextBetter API. We make it easy with flexible end points, on-demand reports, and instant integration capabilities.
The TextBetter Messaging APIs allow customers to send and receive SMS and MMS messages using either:
Both outgoing and incoming messaging are supported. New integrations should use v2 whenever possible.
Production
Production access is enabled by default.
Base URLs
Sandbox (staging) environments are available upon request.
Phone numbers must be provided as an 11-digit numeric string based on the E.164 standard.
For reference:
E.164 is the international telephone numbering plan that gives each device on the Public Switched Telephone Network (PSTN) a globally unique number.
Valid Example
15551230001
Invalid Example
+15551230001
(555) 123-0001
555-123-0001
Outgoing Messaging API (v2 — JSON)
Two credentials are required on every request.
Function Access Code
Customer API Key (APIKey)
Outgoing Messaging API (v1 — Querystring)
POST https://api2.textbetter.com/api/SendOutgoingMessages?code={FUNCTION_CODE}
Content-Type: application/json
| Parameter | Type | Description | Example |
|---|---|---|---|
| fromNumber | String | Sender phone number (digits-only E.164 format) |
“15551230001” |
| toNumber | Array | List of recipient phone number(s). Digits-only E.164 format. Maximum 100 numbers per request. |
[“12003004001”] |
| body | String | SMS message content |
“Hello World” |
| APIKey | String | Customer API key provided by TextBetter |
“YOUR_CUSTOMER_API_KEY” |
{
"fromNumber": "15551230001",
"toNumber": ["12003004001"],
"body": "Hello World",
"APIKey": "YOUR_CUSTOMER_API_KEY"
}
The following example demonstrates sending an SMS message using the v2 JSON API.
curl --location --globoff 'https://api2.textbetter.com/api/SendOutgoingMessages?code={FUNCTION_CODE}' \
--header 'Content-Type: application/json' \
--data '{
"fromNumber": "15551230001",
"toNumber": ["12003004001"],
"body": "Hello World",
"APIKey": "YOUR_CUSTOMER_API_KEY"
}'
| Parameter | Type | Description | Example |
| fromNumber | String | Sender phone number (digits-only E.164 format) |
“15551230001” |
| toNumber | Array<String> | List of recipient phone number(s). Digits-only E.164 format. Maximum 100 numbers per request. |
[“12003004001”] |
| body | String | Optional text content for the MMS |
“Here is the image” |
| filenames | Array<String> | File name(s) for attached media |
[“image.jpg”] |
| contentTypes | Array<String> | MIME type(s) for attached media |
[“image/jpeg”] |
| images | Array<String> | Base64-encoded media content |
[“BASE64_ENCODED_IMAGE”] |
| APIKey | String | Customer API key provided by TextBetter |
“YOUR_CUSTOMER_API_KEY” |
{
"fromNumber": "15551230001",
"toNumber": ["12003004001"],
"body": "Here is the image",
"APIKey": "YOUR_CUSTOMER_API_KEY",
"filenames": ["image.jpg"],
"contentTypes": ["image/jpeg"],
"images": ["BASE64_ENCODED_IMAGE"]
}
The following example demonstrates sending an MMS message using the v2 JSON API.
curl --location --globoff 'https://api2.textbetter.com/api/SendOutgoingMessages?code={FUNCTION_CODE}' \
--header 'Content-Type: application/json' \
--data '{
"fromNumber": "15551230001",
"toNumber": ["12003004001"],
"body": "Here is the image",
"APIKey": "YOUR_CUSTOMER_API_KEY",
"filenames": ["image.jpg"],
"contentTypes": ["image/jpeg"],
"images": ["BASE64_ENCODED_IMAGE"]
}'
Media fields must be arrays of equal length
Each index represents a single attachment
Media must be Base64 encoded
message: Human-readable status message for debugging and logging purposes only. Do not rely on this value for application logic.
RecordID: TextBetter internal message record identifier.
CarrierID: Carrier-assigned message identifier (when available).
Success — 201 Created
{
"message": "Valid Message",
"CarrierID": "17685045592347zt2zp3ohfr5mbmo",
"RecordID": "68041609"
}
Error — 400 Bad Request
{
"message": "Invalid Company/KEY/DID combination",
"CarrierID": "0",
"RecordID": "0"
}
GET https://api.textbetter.com/SendTexts.aspx
| Parameter | Type | Description | Example |
|---|---|---|---|
| KEY | String | Customer API key |
YOUR_KEY |
| DID | String | Sender phone number |
15551230001 |
| ToNumber | String | Recipient phone number. Digits-only E.164 format. Maximum 1 number per request. |
12003004001 |
| Message | String | URL-encoded SMS content |
Hello%20World |
https://api.textbetter.com/SendTexts.aspx?KEY=YOUR_KEY&DID=15551230001&ToNumber=12003004001&Message=Hello%20World
The following example demonstrates sending an SMS message using the v1 Querystring API.
curl 'https://api.textbetter.com/SendTexts.aspx?KEY=YOUR_KEY&DID=15551230001&ToNumber=12003004001&Message=Hello%20World'
Important:
v1 always returns HTTP 200 OK. Treat the request as successful only when the response body equals Success!.
Incoming messages are delivered to a customer-provided endpoint.
| Field | Type | Description |
|---|---|---|
| id | String | Unique message identifier |
| to | String | Your TextBetter-enabled number (digits-only E.164 format) |
| from | String | Sender phone number (digits-only E.164 format) |
| timestamp | Integer | Unix epoch timestamp (seconds, UTC) representing when TextBetter received the message |
| type | String | Message type (SMS or MMS) |
| text | String | Message body. May be empty for MMS messages |
| images | Array | MMS media objects. Present only for MMS messages |
{
"id": "123",
"to": "15551230001",
"from": "12003004001",
"timestamp": 1666798041,
"type": "SMS",
"text": "Hello World"
}
{
"id": "124",
"to": "15551230001",
"from": "12003004001",
"timestamp": 1666798123,
"type": "MMS",
"text": "",
"images": [
{
"Base64": "BASE64_ENCODED_IMAGE",
"type": "image/png"
}
]
}
Incoming v1 messages are delivered via querystring parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
| From | String | Sender phone number |
12003004001 |
| To | String | Your TextBetter-enabled number |
15551230001 |
| Message | String | Message body |
Hi |
https://your-endpoint.example?From=12003004001&To=15551230001&Message=Hi
| Use Case | Recommended API |
|---|---|
| New integrations | v2 — JSON |
| MMS support | v2 — JSON |
| Message IDs & timestamps | v2 — JSON |
| Legacy | v1 — Querystring |
Landline texting solutions built for business
Prefer to talk it through? Call us at (800) 322-1112