Skip to main content

API reference

Every endpoint, with its request, responses and an example in curl, Node.js, Python and PHP. To send your first message, start with Send your first SMS.

Base URLs​

Messagingturn it on under Subscribed APIs, Messaging API

  • Livehttps://api.ponitor.com/messaging/v1
  • Sandboxhttps://sandbox-api.ponitor.com/messaging/v1

Airtimeturn it on under Subscribed APIs, Airtime API

  • Livehttps://api.ponitor.com/airtime/v1
  • Sandboxhttps://sandbox-api.ponitor.com/airtime/v1

Use live keys with the live base URLs and sandbox keys with the sandbox ones. A key sent to the other one is refused with 401. See API keys and base URLs.

Endpoints​

EndpointWhat it does
POST/messaging/v1/messagesSend an SMS or WhatsApp message
GET/messaging/v1/messages/{id}Get a message and its status
POST/messaging/v1/messages/{id}/readMark a WhatsApp message as read
GET/airtime/v1/productsList the data bundles on sale
GET/airtime/v1/products/{idOrCode}Get one data bundle, by id or code
POST/airtime/v1/purchasesBuy airtime or a data bundle for a number
GET/airtime/v1/purchases/{id}Get a purchase and its status

Ponitor also calls your server, under Webhooks (Ponitor calls you): webhook events report what happened, and the USSD webhook builds each USSD screen.

A failed request answers with an error object and a code that never changes. See Errors. Too many requests in a minute answer 429. See Rate limits. What changed, and when, is in the Changelog.

Every request​

curl -X POST https://api.ponitor.com/messaging/v1/messages \
-H "apiKey: $PONITOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ … }'
  • Send your team's key in the apiKey header. See API keys and base URLs.
  • Request and response bodies are JSON.
  • Send an externalId with every request that sends a message or makes a purchase. It makes retries safe. See Retries and externalId.