Quickstart
Send your first SMS in a few minutes.
This guide takes you from a new account to a delivered message. Every request below uses a test key first, so you can try the API without sending or paying.
| Environment | Base URL | Key prefix |
|---|---|---|
| Test | https://api.appstractone.com/v1 | sk_test_ |
| Live | https://api.appstractone.com/v1 | sk_live_ |
The base URL is the same for both. Your key decides whether a message is real.
1. Get your API keys
Create a test key and a live key from your dashboard. Each key is shown once, so store it somewhere safe, such as a secrets manager.
2. Send a test message
curl https://api.appstractone.com/v1/messages \
-H "Authorization: Bearer $APPSTRACT_TEST_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "0241234567",
"from": "MYSHOP",
"text": "Your order #1042 is on its way."
}'You get 202 Accepted and the message:
{
"id": "msg_01M6MJSBSRYJK72AC5E720F8KQ",
"to": "+233241234567",
"status": "delivered",
"encoding": "GSM-7",
"segments": 1,
"cost": { "amount": "0.04", "currency": "GHS" },
"reference": null,
"test": true
}With a test key, nothing is sent, nothing is charged and the message is marked delivered straight away. See Test mode.
3. Request a sender ID
Live messages must come from an approved sender ID. Request one with the name your customers should see:
curl https://api.appstractone.com/v1/sender-ids \
-H "Authorization: Bearer $APPSTRACT_LIVE_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "MYSHOP",
"purpose": "Order updates for our customers",
"sampleMessage": "Your order #1042 is on its way."
}'Our team reviews it with the mobile networks. See Sender IDs.
4. Top up your wallet
Add funds from your dashboard. Each message is charged when you send it. Check your balance at any time:
curl https://api.appstractone.com/v1/balance \
-H "Authorization: Bearer $APPSTRACT_LIVE_KEY"5. Send a live message
Once your sender ID is approved, repeat step 2 with your live key. The message starts as queued, then moves to sent and delivered.
6. Track delivery
Register a webhook to hear about delivery as it happens:
curl https://api.appstractone.com/v1/webhooks \
-H "Authorization: Bearer $APPSTRACT_LIVE_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/webhooks/appstract",
"events": ["message.delivered", "message.failed"]
}'