Back to Developer Help
6

Manage Phone Groups

Create and manage phone groups to organize devices and share credits.

Endpoint

POST /api/v1/phone-groups Requires authentication (X-API-Key)

Request Body

Field Type
name string (group name, must be unique)

Common Error Responses

409 DUPLICATE_NAME

A group with this name already exists.

403 PLAN_LIMIT_REACHED

You have reached the maximum groups for your plan.

400 DEFAULT_GROUP_LOCKED

The default group cannot be modified.

Code Samples

curl -X POST https://api.palmtext.com/api/v1/phone-groups \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"name": "Marketing Team"}'
import requests

resp = requests.post(
    'https://api.palmtext.com/api/v1/phone-groups',
    headers={'X-API-Key': 'YOUR_API_KEY'},
    json={'name': 'Marketing Team'}
)
print(resp.json())
const res = await fetch('https://api.palmtext.com/api/v1/phone-groups', {
  method: 'POST',
  headers: { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Marketing Team' })
});
const data = await res.json();
<?php
$ch = curl_init();
curl_setopt_array($ch, [
  CURLOPT_URL => 'https://api.palmtext.com/api/v1/phone-groups',
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => ['X-API-Key: YOUR_API_KEY', 'Content-Type: application/json'],
  CURLOPT_POSTFIELDS => json_encode(['name' => 'Marketing Team']),
  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{"name": "Marketing Team"})
  req, _ := http.NewRequest("POST",
    "https://api.palmtext.com/api/v1/phone-groups", 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)
}