Twilio-compatible API
Move an existing Twilio-compatible SMS integration to PalmText by changing only the base URL and the credentials.
Find your Account SID and the base URL in Settings → API Keys. This is a thin compatibility layer: the native API above offers more, including bulk sends, contact groups and idempotency keys.
Endpoint
/twilio-api/2010-04-01/Accounts/{AccountSid}/Messages.json
HTTP Basic auth: Account SID as the username, a PalmText API key as the password
Request Body
| Field | Type |
|---|---|
| To | string (E.164, recipient number) |
| From | string (E.164, one of your registered phones) |
| Body | string (1–1600 characters) |
| StatusCallback | string (optional, public http(s) URL for status updates) |
What it is
A thin Twilio-compatible layer over PalmText: send one SMS, fetch a message, list messages, and receive status callbacks, using the paths, parameters and response shapes your integration already uses. Messages go out from your own phones and cost one message each, as with the native API.
Base URL and credentials
- Base URL:
https://palmtext.com/twilio-api, followed by the same paths, starting at /2010-04-01/. - Every uri, next_page_uri and previous_page_uri in a response is relative to that base URL.
- Username: your Account SID (AC…), shown in Settings → API Keys.
- Password: a PalmText API key. A key created in Settings can send as any of your phones; a device's own key only as that device.
- The Account SID in the URL must be the same as the username.
Supported endpoints and parameters
POST /2010-04-01/Accounts/{AccountSid}/Messages.json— To, From, Body, StatusCallbackGET /2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}.jsonGET /2010-04-01/Accounts/{AccountSid}/Messages.json— To, From, DateSent, DateSent<, DateSent>, PageSize, Page, PageToken
Refused parameters
Any other parameter is refused with error 20422, naming it, so a typo or an unsupported feature never goes unnoticed.
| AddressRetention | retention settings are not supported |
| ApplicationSid | TwiML applications are not supported; use StatusCallback for status updates |
| Attempt | attempt counts are not supported |
| ContentRetention | retention settings are not supported |
| ContentSid | content templates are not supported; send the text in Body |
| ContentVariables | content templates are not supported; send the text in Body |
| FallbackFrom | fallback senders are not supported |
| ForceDelivery | ForceDelivery is not supported |
| MaxPrice | MaxPrice is not supported; PalmText charges one message per SMS |
| MediaUrl | MMS is not supported; PalmText sends SMS only |
| MessageIntent | message intents are not supported |
| MessagingServiceSid | Messaging Services are not supported; send with From set to one of your phones |
| PersistentAction | persistent actions are not supported |
| ProvideFeedback | message feedback is not supported |
| RiskCheck | risk checks are not supported |
| ScheduleType | scheduled sending is not supported |
| SendAsMms | MMS is not supported; PalmText sends SMS only |
| SendAt | scheduled sending is not supported |
| ShortenUrls | link shortening is not supported |
| SmartEncoded | smart encoding is not supported; Body is sent as written |
| TrafficType | traffic types are not supported |
| ValidityPeriod | validity periods are not supported |
Statuses
| PalmText | Reported as |
|---|---|
| pending | queued |
| sending | sending |
| sent | sent |
| delivered | delivered |
| failed | failed (30008) |
| expired | failed (30001) |
| received | received |
undelivered is never reported: phones report a failure only before sending.
Status callbacks
Pass StatusCallback when you create a message. Its URL receives a form-encoded POST when the message is sent, delivered or failed, in that order, with MessageSid, SmsSid, AccountSid, From, To, MessageStatus, SmsStatus, ApiVersion and, on failure, ErrorCode. No callback is sent for queued or sending.
Each request carries an X-Twilio-Signature header. Validate it with your usual request validator, using the API key that created the message as the auth token. If you rotate that key, later callbacks are signed with the new key; if you revoke it, they stop.
Callbacks are retried three times in all, and must go to a public address: private, loopback and cloud metadata addresses are refused.
Error codes
Errors use the shape {code, message, more_info, status}. Codes from 90001 are PalmText's own, for cases with no equivalent code.
| Code | HTTP | Meaning |
|---|---|---|
| 20003 | 401 | Authentication failed, or the Account SID does not match the key's account. |
| 20005 | 403 | The account is suspended. |
| 20404 | 404 | No such message on this account, or the resource is not provided. |
| 20422 | 400 | An unsupported or unknown parameter, a JSON body, or a malformed filter. |
| 20429 | 429 | Too many requests. The limit is shared with the native API. |
| 20500 | 500 | Something went wrong on our side. Try again shortly. |
| 21211 | 400 | To is not an E.164 phone number. |
| 21212 | 400 | From is not an E.164 phone number. |
| 21602 | 400 | Body is missing or empty. |
| 21603 | 400 | From is missing. |
| 21604 | 400 | To is missing. |
| 21606 | 400 | From is not a phone this key may send as. |
| 21609 | 400 | StatusCallback is not a public http(s) URL. |
| 21617 | 400 | Body is longer than 1600 characters. |
| 30001 | — | On a message: it expired before the phone sent it. |
| 30008 | — | On a message: the phone reported a failure, or did not confirm sending in time. |
| 90001 | 402 | PalmText only: no messages left in this phone's group. |
| 90002 | 403 | PalmText only: the phone or device is not active. |
Known differences
- No idempotency key: retrying a create sends twice. The native API's request_id prevents duplicates.
- SMS only: no MMS or media.
- No scheduled sending, validity periods, Messaging Services or content templates.
- Incoming SMS appear in the message list; there is no inbound webhook that replies with markup. Use the native message.received webhook.
- Messages cannot be deleted or redacted through this layer.
- price is always null: PalmText charges one message per SMS from your balance.
Helper libraries
Plain HTTP, as in the samples below, works from any language. The official Python helper library is verified: create the client with your Account SID and API key, then set its base URL:
client = Client(ACCOUNT_SID, PALMTEXT_API_KEY)
client.api.base_url = "https://palmtext.com/twilio-api"
Other helper libraries are not verified yet; use them only if they let you set the whole base URL, including the /twilio-api path.
Code Samples
# The same request your Twilio-compatible integration already makes:
# only the host and the credentials change.
curl -X POST https://palmtext.com/twilio-api/2010-04-01/Accounts/$ACCOUNT_SID/Messages.json \
-u "$ACCOUNT_SID:$PALMTEXT_API_KEY" \
--data-urlencode 'From=+15550001234' \
--data-urlencode 'To=+15550009999' \
--data-urlencode 'Body=Hello from PalmText' \
--data-urlencode 'StatusCallback=https://yourapp.com/sms/status'
# Page through messages: follow next_page_uri until it is null
curl -u "$ACCOUNT_SID:$PALMTEXT_API_KEY" \
'https://palmtext.com/twilio-api/2010-04-01/Accounts/'$ACCOUNT_SID'/Messages.json?PageSize=50'
import requests
ACCOUNT_SID = 'AC...' # Settings → API Keys
API_KEY = 'sk_live_...' # a PalmText API key
BASE = f'https://palmtext.com/twilio-api/2010-04-01/Accounts/{ACCOUNT_SID}'
resp = requests.post(
f'{BASE}/Messages.json',
auth=(ACCOUNT_SID, API_KEY),
data={'From': '+15550001234', 'To': '+15550009999', 'Body': 'Hello from PalmText',
'StatusCallback': 'https://yourapp.com/sms/status'},
)
message = resp.json()
print(message['sid'], message['status']) # SM... queued
# Validate a status callback in your handler (pip install twilio)
from twilio.request_validator import RequestValidator
def is_genuine(request_url, form_params, signature_header):
return RequestValidator(API_KEY).validate(request_url, form_params, signature_header)
const ACCOUNT_SID = 'AC...';
const API_KEY = 'sk_live_...';
const base = `https://palmtext.com/twilio-api/2010-04-01/Accounts/${ACCOUNT_SID}`;
const res = await fetch(`${base}/Messages.json`, {
method: 'POST',
headers: {
Authorization: 'Basic ' + btoa(`${ACCOUNT_SID}:${API_KEY}`),
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({ From: '+15550001234', To: '+15550009999', Body: 'Hello from PalmText' }),
});
const message = await res.json(); // { sid: 'SM...', status: 'queued', ... }
<?php
$accountSid = 'AC...';
$apiKey = 'sk_live_...';
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "https://palmtext.com/twilio-api/2010-04-01/Accounts/$accountSid/Messages.json",
CURLOPT_USERPWD => "$accountSid:$apiKey",
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query([
'From' => '+15550001234', 'To' => '+15550009999', 'Body' => 'Hello from PalmText',
]),
CURLOPT_RETURNTRANSFER => true,
]);
$message = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $message['sid'];