Back to Developer Help
2
Register a Phone
Register an Android phone to use as an SMS gateway for sending and receiving messages.
Endpoint
POST
/api/v1/phones
Requires authentication (X-API-Key)
Request Body
| Field | Type |
|---|---|
| phone | string (E.164 format, e.g. +15550001234) |
| label | string (optional, display name) |
Common Error Responses
409
DUPLICATE_PHONE
This phone is already registered.
403
PLAN_LIMIT_REACHED
You have reached the maximum phones for your plan.
Code Samples
curl -X POST https://api.palmtext.com/api/v1/phones \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"phone": "+15550001234", "label": "Office Phone"}'
import requests
resp = requests.post(
'https://api.palmtext.com/api/v1/phones',
headers={'X-API-Key': 'YOUR_API_KEY'},
json={'phone': '+15550001234', 'label': 'Office Phone'}
)
print(resp.json())
const res = await fetch('https://api.palmtext.com/api/v1/phones', {
method: 'POST',
headers: { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ phone: '+15550001234', label: 'Office Phone' })
});
const data = await res.json();
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.palmtext.com/api/v1/phones',
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['X-API-Key: YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode(['phone' => '+15550001234', 'label' => 'Office Phone']),
CURLOPT_RETURNTRANSFER => true,
]);
$resp = curl_exec($ch);
echo $resp;
curl_close($ch);
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
body, _ := json.Marshal(map[string]string{
"phone": "+15550001234", "label": "Office Phone",
})
req, _ := http.NewRequest("POST",
"https://api.palmtext.com/api/v1/phones", bytes.NewBuffer(body))
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
fmt.Println(resp.Status)
}