Back to Developer Help
5

Monitor Phone Status (Heartbeats)

Send periodic heartbeats from your Android phone to report online status and battery level.

Endpoint

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

Request Body

Field Type
phone string (E.164, registered phone)
status string (e.g. 'online', 'offline')
battery integer (optional, 0-100)

Common Error Responses

403 FORBIDDEN

Phone is not registered to your account.

Code Samples

curl -X POST https://api.palmtext.com/api/v1/heartbeats \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"phone": "+15550001234", "status": "online", "battery": 85}'
import requests

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