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
- Live
https://api.ponitor.com/messaging/v1 - Sandbox
https://sandbox-api.ponitor.com/messaging/v1
Airtimeturn it on under Subscribed APIs, Airtime API
- Live
https://api.ponitor.com/airtime/v1 - Sandbox
https://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
| Endpoint | What it does | |
|---|---|---|
| POST | /messaging/v1/messages | Send an SMS or WhatsApp message |
| GET | /messaging/v1/messages/{id} | Get a message and its status |
| POST | /messaging/v1/messages/{id}/read | Mark a WhatsApp message as read |
| GET | /airtime/v1/products | List the data bundles on sale |
| GET | /airtime/v1/products/{idOrCode} | Get one data bundle, by id or code |
| POST | /airtime/v1/purchases | Buy 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
apiKeyheader. See API keys and base URLs. - Request and response bodies are JSON.
- Send an
externalIdwith every request that sends a message or makes a purchase. It makes retries safe. See Retries and externalId.