Overview
The AvenoLink API is a plain REST API. Requests and responses use JSON, authentication is a single header, and every channel follows the same style. You can call it from any language that can make an HTTP request, with no SDK required.
| Environment | Base URL | Use it for |
|---|---|---|
| Production | https://api.avenolink.com | Real messages to real recipients. Uses SMS from your package. |
| Sandbox | https://sandbox.avenolink.com | Building and testing your integration safely. |
Authentication
Send your API key in the x-api-key header on every request. That is all you need: there are no tokens to exchange or refresh. The examples in these docs use a separate key for each channel, such as YOUR_SMS_API_KEY, YOUR_WA_API_KEY and YOUR_EMAIL_API_KEY.
- Keep keys on your server and load them from environment variables.
- Never commit keys to source control or ship them in mobile or browser code.
- Use sandbox keys while developing and production keys only when you go live.
- If a key is exposed, replace it straight away and update your servers.
Quickstart
- 1
Get your API key
Contact our team or open your dashboard to receive a sandbox key for the channel you need.
- 2
Send a test message
Make the request below against the sandbox host and check you receive a
queuedresponse. - 3
Listen for delivery
Add a webhook endpoint so your system learns when each message is delivered or fails.
- 4
Go live
Swap in your production key and host, then follow the go-live checklist in Resources.
curl -X POST https://sandbox.avenolink.com/api/v1/send/sms \
-H "x-api-key: YOUR_SMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"recipients": ["265XXXXXXXXX"],
"sender_id": "AVENOLINK",
"message": "Hello from AvenoLink"
}'Endpoints
All sending endpoints live under /api/v1/send. They accept the same style of request and return the same style of response.
| Method | Path | Description |
|---|---|---|
| POST | /api/v1/send/sms | Send an SMS to one or more recipients. |
| POST | /api/v1/send/whatsapp | Send a WhatsApp message to one or more recipients. Coming soon. |
| POST | /api/v1/send/email | Send an email with HTML and plain-text bodies. Coming soon. |
The SMS endpoint accepts these fields.
| Field | Required | Description |
|---|---|---|
| recipients | Yes | A list of 1 to 100 Malawi phone numbers. Duplicates are sent once. |
| message | Yes | The text to send, up to 480 characters. Longer messages use more than one SMS per recipient. |
| sender_id | No | An approved Sender ID of up to 11 characters. If you leave it out, your first approved Sender ID is used. |
Responses
A successful send returns 200 OK with a summary of what was accepted. The message is queued at this point. Delivery results arrive later through webhooks.
{
"success": true,
"batch_id": "bat_xk9m2p4q",
"status": "queued",
"recipients_count": 2,
"credits_used": 2,
"credits_remaining": 998,
"package": "Starter"
}| Field | Description |
|---|---|
| success | true when the request was accepted. |
| batch_id | Identifier for this send. Store it to reconcile delivery events. |
| status | The state of the batch. New sends start as queued. |
| recipients_count | How many recipients were in the request. |
| credits_used | SMS charged for this request: recipients multiplied by the SMS parts in your message. |
| credits_remaining | SMS left on the package this send used. |
| package | The name of the package this send used, such as Starter. |
Errors
Errors use standard HTTP status codes and always return the same JSON shape. Check the status code first, then use the error code in your own logic and read message for the detail.
{
"success": false,
"error": "quota_exceeded",
"message": "Your package limit has been reached, or this request is larger than what is left. Add a package or send fewer messages.",
"sms_required": 3,
"sms_remaining": 2
}| Status | Error code | What it means and what to do |
|---|---|---|
| 401 | missing_api_key, invalid_api_key | The x-api-key header is missing, wrong or revoked. Check the header and the key. |
| 402 | quota_exceeded | Your package limit is reached, or the request needs more SMS than are left. The response includes sms_required and sms_remaining. Add a package or send fewer messages. |
| 403 | no_active_package, no_sender_id, sender_not_allowed | Your account has no active package, no Sender ID, or the sender_id you sent is not yours. Fix the account or use an approved Sender ID. |
| 422 | validation_failed, invalid_recipients | A field is missing or badly formatted, or a number is not a valid Malawi number. A validation_failed response also lists each problem under errors. |
| 429 | rate_limited | Too many requests. Slow down and retry with a delay. See rate limits below. |
| 502 | delivery_failed | The network refused the message. Nothing was deducted from your package, so it is safe to retry. |
| 5xx | server_error | A temporary problem on our side. Retry with backoff and check API status if it continues. |
Rate limits
Limits are generous and designed so normal traffic never notices them. When you do hit one, the response includes headers that describe the limit and tell you when to try again, so your code never has to guess.
async function sendWithRetry(url, options, attempts = 4) {
for (let i = 0; i < attempts; i++) {
const res = await fetch(url, options);
if (res.status !== 429 && res.status < 500) return res;
await new Promise((r) => setTimeout(r, 2 ** i * 500));
}
throw new Error("Request failed after retries");
}Sending to many people? Put up to 100 recipients in one request as a recipients array instead of making a separate call for each. For longer lists, send several requests.
Versioning
The version is part of the path (/api/v1). We add new fields and endpoints without breaking existing integrations, so ignore response fields you do not recognise. Anything that would break your code is announced in the changelog before it changes.