API reference · v2
API documentation
The FasterMessage REST contract: send SMS and email, verify codes, manage your address book, follow every delivery and steer your balance from a single interface.
Quick start
The FasterMessage API currently sends SMS, email and WhatsApp messages, handles verification codes (OTP) and an address book, from a single REST contract. Voice is declared in the contract but not served yet: see Availability.
1. Collect your credentials
In the back office, open Integration & API. There you find your API username and password, and there you generate two keys: a test key and a live key. A key is shown only once: it is stored hashed and cannot be read back.
2. Declare a sender
SMS requires an approved Sender ID, email an active sending address. Both are declared in the back office. See Senders.
3. Send with the test key
curl -X POST https://api.fastermessage.com/v2/sms/send \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": "+2290160000000", "from": "FASTERMSG", "content": "Your order is ready." }'
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/sms/send', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "to": "+2290160000000", "from": "FASTERMSG", "content": "Your order is ready." }), }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/sms/send'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'to' => '+2290160000000', 'from' => 'FASTERMSG', 'content' => 'Your order is ready.', ]), ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.post( "https://api.fastermessage.com/v2/sms/send", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, json={ "to": "+2290160000000", "from": "FASTERMSG", "content": "Your order is ready.", }, timeout=15, ) print(response.status_code, response.json())
{
"id": "66f1c2a4e8b7d90012ab34cd",
"channel": "sms",
"status": "queued",
"to": "+2290160000000",
"from": "FASTERMSG",
"units": 1,
"price": null,
"currency": "",
"refund": null,
"client_reference": null,
"fallback_of": null,
"fallback": null,
"error": null,
"created_at": "2026-11-04T10:00:00.000Z",
"scheduled_at": null,
"sent_at": null,
"delivered_at": null
}4. Track, then go live
- Read the message back through
GET /v2/messages/{id}, or receive its outcome on a webhook. - Make your sends replayable with
Idempotency-Key: a send cannot be cancelled. - Replace the
fm_test_…key with thefm_live_…key. Nothing else changes, and the first real send remains a milestone to check: test proves neither the balance, nor the price, nor the delivery.
Authentication
Every call carries two credentials, both mandatory, in headers only: never in the URL or the body. This is not redundancy, the two do not designate the same thing.
| Credential | Header | Designates |
|---|---|---|
| Basic | Authorization | The account charged: base64(username:password). |
| API key | X-Api-Key | The account making the request: the same account, or one of its sub-accounts. |
Authorization: Basic bW9uLWNvbXB0ZTpzZWNyZXQ= X-Api-Key: fm_live_xxxxxxxxxxxxxxxxxxxxxxxx Content-Type: application/json
Which account for what?
| Topic | Account used |
|---|---|
| Balance, charge, movements | The charged account (Basic). |
| Sender ID, sending address | The key’s account. |
| “Do not contact” list | The key’s account: a sub-account keeps its own opt-outs. |
| Messages read back, contacts, OTP | The key’s account. |
| Rate limit | The key’s account: two sub-accounts each have their own pace. |
Keep both server-side. A key exposed in a web or mobile client is a published key: revoke it from the back office and generate a new one.
Environments
| Environment | Key prefix | Behaviour |
|---|---|---|
| test | fm_test_… | Simulated sends, on SMS and email: nothing is delivered, nothing is charged, no webhook is called. |
| production | fm_live_… | Real sends, charged, delivered, genuine receipts. |
What a test key does
- Same checks as in production, same error codes: number, sender, content, “Do not contact”, destination. Your sender must therefore be approved, even in test.
- No balance or price required: you can write your whole integration before buying anything.
- An immediate send is marked
deliveredat once, a scheduled send staysscheduled.priceis alwaysnull. - Messages sealed off: a test key reads back only its simulated sends, never your real traffic, and the other way round. Simulations are erased after 30 days.
- OTP: the code is a run of zeros (
000000, or0000depending on the length). Since no SMS goes out, this is what lets you exercisePOST /v2/otp/verify.
Try the API
Compose a call with your test credentials and run it from this page. The equivalent snippet is regenerated live in all four languages.
Test environment only — never use your production credentials on this page. The values you type stay in your browser: they are neither stored nor sent to a third party.
curl -X POST https://api.fastermessage.com/v2/sms/send \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": "", "from": "FASTERMSG", "content": "Your code is 480912. Valid for 5 min." }'
Fill in the required fields to run the call.
SDKs and plugins
The official SDKs and plugins rely only on API v2. This table says “available” only for what you can install today.
| Tool | Type | Status |
|---|---|---|
| PHP | SDK | Available (PHP 8.1 or later): SMS, email, WhatsApp, OTP, contacts, usable numbers, templates and addresses |
| Node.js / TypeScript | SDK | Available (Node.js 20.3 or later): SMS, email, WhatsApp, OTP, contacts, usable numbers, templates and addresses |
| Python | SDK | In preparation |
| Java | SDK | In preparation |
| Symfony | Plugin | In preparation |
| WordPress | Plugin | Available (WordPress 6.5 and PHP 8.1 or later): SMS, WhatsApp and email — download |
| WooCommerce | Plugin | Available (WooCommerce 8.9 or later, with the WordPress plugin 0.2.0): order notifications by SMS and WhatsApp — download |
| PrestaShop | Plugin | In preparation |
| Shopify | Plugin | In preparation |
Install the PHP SDK
composer require fastermessage/fastermessage-phpuse FasterMessage\Client; $fm = new Client( getenv('FM_API_USER'), getenv('FM_API_PASSWORD'), getenv('FM_API_KEY'), // fm_test_… / fm_live_… ); $message = $fm->sms->send([ 'to' => '+2290160000000', 'from' => 'FASTERMSG', 'content' => 'Votre commande est prete.', 'client_reference' => 'cmd-42', ]); echo $message['id'], ' ', $message['status']; // queued
$message = $fm->whatsapp->send([ 'to' => '+2290160000000', 'from' => '+2290161000000', // votre numéro WhatsApp raccordé 'content' => [ 'template' => 'confirmation_commande', 'language' => 'fr', 'variables' => ['1' => 'Awa', '2' => '1187'], ], ]); // Code de vérification par WhatsApp (modèle d'authentification) $otp = $fm->otp->request(['to' => '+2290160000000', 'channel' => 'whatsapp', 'from' => '+2290161000000']);
The source code and full reference are on GitHub. On your brand’s API domain, add the base_url option to the client.
Install the Node.js SDK
npm install @fastermessage/sdkimport { FasterMessage } from '@fastermessage/sdk'; const fm = new FasterMessage({ username: process.env.FM_API_USER, password: process.env.FM_API_PASSWORD, apiKey: process.env.FM_API_KEY, // fm_test_… / fm_live_… }); const message = await fm.sms.send({ to: '+2290160000000', from: 'FASTERMSG', content: 'Votre commande est prete.', client_reference: 'cmd-42', }); console.log(message.id, message.status); // queued
const message = await fm.whatsapp.send({ to: '+2290160000000', from: '+2290161000000', // votre numéro WhatsApp raccordé content: { template: 'confirmation_commande', language: 'fr', variables: { 1: 'Awa', 2: '1187' } }, }); // Code de vérification par WhatsApp (modèle d'authentification) const otp = await fm.otp.request({ to: '+2290160000000', channel: 'whatsapp', from: '+2290161000000' });
Node.js 20.3 or later, server side only: the client carries your credentials and refuses to start in a browser. The source code and full reference are on GitHub.
Install the WordPress plugin
Download the fastermessage-x.y.z.zip file of the latest release, then in WordPress: Plugins › Add New › Upload Plugin. In Settings › FasterMessage, enter your API username, password and key, then click “Test the connection”. The plugin sends SMS, WhatsApp messages and emails from the admin screen or from your code (fastermessage_send_sms(), fastermessage_send_whatsapp(), fastermessage_send_email()), and offers as lists the numbers, templates and addresses your account can use. Since version 0.2.0, an option (off by default) also sends the emails WordPress sends by itself through FasterMessage, with an automatic fallback to the normal sending.
Install the WooCommerce plugin
It complements the WordPress plugin, which must be installed and configured (version 0.2.0 or later). Download the fastermessage-woocommerce-x.y.z.zip file of the latest release, upload it like the WordPress plugin, then configure it in WooCommerce › Settings › FasterMessage. It notifies the customer at each order status change, by SMS, by WhatsApp or by WhatsApp with an SMS fallback, chosen for each status, alerts the shop on each new order, and asks for the customer’s consent at checkout.
Availability
What is declared in the contract without being served answers 501 not_implemented. This is not an outage: retrying changes nothing.
| Feature | Status | Detail |
|---|---|---|
| SMS | served | Single send, batch of up to 500, scheduling, tracking, webhooks. |
| served | Single send to one address, scheduling, tracking, webhooks. No batch. | |
| OTP | served | By SMS (default) or WhatsApp (authentication template). |
| Contacts and groups | served | The same address book as the back office. |
| Balance and movements | served | |
| served | Approved template, or free text within the 24-hour window. Tracking, webhooks, fallback, OTP. Not yet: batch, scheduling, media header. See Send a WhatsApp message. | |
| Voice | 501 | Sending and reading: not_implemented. |
| Campaign reports | 501 | GET /v2/campaigns and GET /v2/campaigns/{id}. |
| Cross-channel fallback | served | Between SMS, email and WhatsApp, single sends and OTP. See Fallback. |
Shape of exchanges
| Topic | Rule |
|---|---|
| Base | https://api.fastermessage.com, or your brand’s API domain. A key is only valid on its brand’s domains. |
| Body | JSON, with Content-Type: application/json. |
| Success | The resource as it stands, with no wrapper: the HTTP code carries the outcome. |
| Fields | snake_case. |
| Dates | ISO 8601 in UTC. Always write the time zone: 2026-11-04T10:00:00Z. |
| Identifiers | Opaque strings. Do not parse them. |
| Numbers | 8 to 15 digits, + optional. Spaces and punctuation are stripped; the + is kept in the response when provided. |
| Evolution | The contract is stable and additive: fields and codes may be added, none changes meaning. Ignore the fields you do not know. |
| Unreadable values | Refused with 400, never ignored. error.param names the field, including nested ones (content.subject, messages[3].to). |
Success codes
| HTTP | Routes |
|---|---|
| 200 | Reads, PATCH, POST /v2/sms/batch, POST /v2/contacts/batch, POST /v2/otp/verify. |
| 201 | Single sends, POST /v2/otp, creating a contact or a group. |
| 204 | DELETE: no body. |
Response headers
| Header | Content |
|---|---|
| X-Request-Id | Request identifier, echoed in error.request_id. You may provide your own: letters, digits, . _ : -, 100 characters at most. |
| X-RateLimit-* | Rate state: see Limits. |
Idempotency
A send cannot be cancelled. If your call times out on the network, you do not know whether it went through: without protection, replaying it sends and charges twice. The optional Idempotency-Key header solves this on any POST, PATCH or DELETE request.
Idempotency-Key: cmd-42-2026-11-04
What happens on replay
| Situation | Response |
|---|---|
| Same key, same method, same path, same body | The memorised response, HTTP code included. Nothing is re-executed or charged. JSON field order does not count. |
| Same key, other payload or other route | 409 idempotency_key_reuse. |
| Same key, first request still in flight | 409 idempotency_key_in_flight. Wait, then replay unchanged. |
| The first request failed (4xx, 5xx) | The key is released: the replay really runs. Only successes are memorised. |
| More than 24 h later | The key is forgotten: the call goes through again. |
Pagination
Lists are walked by cursor, newest first: an insertion during the walk neither skips nor duplicates a line. Pass next_cursor back as ?cursor= as long as has_more is true.
Common parameters
| Field | Type | Description |
|---|---|---|
| limitoptional | integer | Page size: 50 by default, 200 at most. Beyond that, the value is capped with no error. |
| cursoroptional | string | Opaque next_cursor value, to pass back as is. An unreadable value is refused (400 invalid_cursor). |
{
"data": [ ... ],
"has_more": true,
"next_cursor": "NjZmMWMyYTRlOGI3ZDkwMDEyYWIzNGNk"
}Send an SMS
Sends an SMS to one recipient. Returns 201 Created and the message resource: the request is accepted and queued, delivery is asynchronous.
Request body
| Field | Type | Description |
|---|---|---|
| torequired | string | Recipient number: 8 to 15 digits, + optional. |
| fromrequired | string | Sender ID the key’s account may use. No default sender is applied. Case does not matter: the SMS goes out under the spelling of the declared record. |
| contentrequired | string | object | The text, or { text, unicode }. unicode: true (strict boolean) keeps accents and emojis, at the cost of shorter segments. |
| scheduled_atoptional | string | Send date, ISO 8601 with time zone. Absent or past = immediate send. Unreadable = 400. |
| callback_urloptional | string | http(s) callback URL for this message. Takes precedence over the account’s. See Webhooks. |
| client_referenceoptional | string | Your free-form reference, echoed in the response and webhooks, and filterable on read. It deduplicates nothing: that is the job of Idempotency-Key. |
| fallbackoptional | array | Channels to try if the message fails, with their recipient and sender: see Fallback. |
curl -X POST https://api.fastermessage.com/v2/sms/send \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": "+2290160000000", "from": "FASTERMSG", "content": "Your order cmd-42 is ready.", "client_reference": "cmd-42", "callback_url": "https://example.test/webhooks/messages" }'
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/sms/send', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "to": "+2290160000000", "from": "FASTERMSG", "content": "Your order cmd-42 is ready.", "client_reference": "cmd-42", "callback_url": "https://example.test/webhooks/messages" }), }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/sms/send'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'to' => '+2290160000000', 'from' => 'FASTERMSG', 'content' => 'Your order cmd-42 is ready.', 'client_reference' => 'cmd-42', 'callback_url' => 'https://example.test/webhooks/messages', ]), ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.post( "https://api.fastermessage.com/v2/sms/send", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, json={ "to": "+2290160000000", "from": "FASTERMSG", "content": "Your order cmd-42 is ready.", "client_reference": "cmd-42", "callback_url": "https://example.test/webhooks/messages", }, timeout=15, ) print(response.status_code, response.json())
{
"error": {
"type": "business_error",
"code": "insufficient_balance",
"message": "Insufficient balance to process the request.",
"request_id": "2f1c9d4e-8a6b-4c1e-9f2a-7d3b5e0c1a84"
}
}Encoding and segments
| Encoding | When | 1 segment | Per segment beyond |
|---|---|---|---|
| GSM-7 | By default. Accents are removed (é becomes e), other characters outside the alphabet are replaced with a safe equivalent or deleted, emojis included. That text is what is counted, charged and sent. | 160 | 153 |
| UCS-2 | content.unicode: true. An emoji counts as 2. | 70 | 67 |
units returns the number of segments charged. To keep an accented text, pass content.unicode: true, and check its length: a long message then costs more segments.
When the balance is charged
- Immediate send: charged on receipt, according to the recipient and the number of segments. If the balance does not cover this message:
402, and nothing is created. - Scheduled send: charged when due. On receipt, only a zero balance is refused. If the balance no longer covers the send when due, the message moves to
failed. - The send response returns
price: nullandcurrency: "": the amount is read later onGET /v2/messages/{id}or inGET /v2/credits.
Refusals to know
| HTTP | code | Cause |
|---|---|---|
| 400 | missing_parameter | to, content or from missing; param names it. |
| 400 | invalid_number | Unreadable number. |
| 400 | unsupported_destination | Country not served by the platform. Do not retry this number. |
| 402 | insufficient_balance | SMS balance too low. |
| 403 | sender_not_approved | Sender ID unknown or not approved. |
| 403 | destination_not_priced | Country served, but not open to this account: ask your provider for a price. |
| 403 | recipient_opted_out | Number on your “Do not contact” list. Another format changes nothing. |
| 409 | account_not_configured | The account has no default price. Topping up changes nothing. |
Send an email
Sends an email to one address only. Returns 201 Created and the message resource. The contract does not currently provide copies, attachments or a reply-to address.
Request body
| Field | Type | Description |
|---|---|---|
| torequired | string | Recipient address. |
| fromoptional | string | Sending address allowed for the key’s account. Absent: its oldest active address, or 400 sender_required when it has none. |
| contentrequired | object | { subject, html, text, reply_to }. subject is mandatory, with html and/or text. A bare string is refused (400 invalid_content). reply_to is optional: the address that receives the recipient’s replies, without a display name. It does not have to be a sending address of the account. |
| scheduled_atoptional | string | Same as for SMS. |
| callback_urloptional | string | Same as for SMS. |
| client_referenceoptional | string | Same as for SMS. |
curl -X POST https://api.fastermessage.com/v2/email/send \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": "[email protected]", "from": "[email protected]", "content": { "subject": "Your November invoice", "html": "<p>Hello Awa, your invoice is available.</p>", "text": "Hello Awa, your invoice is available." }, "client_reference": "invoice-1187" }'
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/email/send', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "to": "[email protected]", "from": "[email protected]", "content": { "subject": "Your November invoice", "html": "<p>Hello Awa, your invoice is available.</p>", "text": "Hello Awa, your invoice is available." }, "client_reference": "invoice-1187" }), }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/email/send'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'to' => '[email protected]', 'from' => '[email protected]', 'content' => [ 'subject' => 'Your November invoice', 'html' => '<p>Hello Awa, your invoice is available.</p>', 'text' => 'Hello Awa, your invoice is available.', ], 'client_reference' => 'invoice-1187', ]), ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.post( "https://api.fastermessage.com/v2/email/send", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, json={ "to": "[email protected]", "from": "[email protected]", "content": { "subject": "Your November invoice", "html": "<p>Hello Awa, your invoice is available.</p>", "text": "Hello Awa, your invoice is available.", }, "client_reference": "invoice-1187", }, timeout=15, ) print(response.status_code, response.json())
Refusals to know
| HTTP | code | Cause |
|---|---|---|
| 400 | missing_parameter | content.subject, or content.html and content.text both absent. |
| 400 | invalid_recipient | Invalid recipient address. |
| 400 | invalid_parameter | content.reply_to is not a valid address (a display name, Awa <[email protected]>, is refused). |
| 400 | sender_required | No from, and no active address on the account. |
| 402 | insufficient_balance | Email balance at zero. |
| 403 | sender_not_approved | Sending address unknown or not allowed. |
| 403 | recipient_opted_out | Address on your email “Do not contact” list. |
| 409 | account_not_configured | No email price is set for this account. A price of 0 counts as no price. |
WhatsApp follows Meta’s rules, and they change how you send: you write from a number that belongs to you, and a first message always goes through an approved template. This page gathers what to know before calling POST /v2/whatsapp/send.
Before the first send
- A WhatsApp number connected to your account, from the back office, and validated by the platform. It is your sender:
fromis mandatory, no number is chosen for you. - Templates approved by Meta, created or imported from the back office. A template is named by its name and its language; it must belong to the same WhatsApp Business account as the number sending it.
- A WhatsApp price on your account, and a balance covering at least one message.
- The usable numbers and templates can be read with
GET /v2/whatsapp/numbersandGET /v2/whatsapp/templates, expected variables included — see Account resources.
Template or free text
| Content | When | Rate |
|---|---|---|
Template { template, language, variables } | At any time. | Its category’s: marketing or utility. |
Free text { text } | Only if the recipient wrote to this number in the last 24 hours. Otherwise 409 session_window_closed. | Service. |
| Verification code | At any time, through POST /v2/otp and your authentication template. | Authentication. |
A template’s variables are passed in an object: "1", "2"… for {{1}}, {{2}}… of the body, "header" for a text header variable, "button_1"… for a button link suffix. A missing variable is refused, naming it: nothing goes out.
Price, tracking and callbacks
- Price: by the recipient’s country and the message category. It is held when the message leaves, charged on delivery and returned on failure.
- Statuses:
queued,sent(accepted by Meta),delivered,undelivered(failure after acceptance),failed(refused before any send). A read message staysdelivered: its reading is inread_at. - Webhook: in the same format as SMS —
Sended,Delivered,UndeliveredorRejected. Reading is not notified. See Webhooks. - Fallback: a WhatsApp message can fall back to SMS or email, and WhatsApp can serve as a fallback step. See Fallback.
- Test key: the send is simulated, without price or balance, with the same checks as for real.
Send a WhatsApp message
Sends a WhatsApp message to one number only, from a WhatsApp number connected to your account. Returns 201 Created and the message resource. Two possible contents, and Meta’s rule decides: an approved template goes at any time; a free text only goes if the recipient wrote to this number in the last 24 hours.
Request body
| Field | Type | Description |
|---|---|---|
| torequired | string | Recipient number, in international format. |
| fromrequired | string | Sending WhatsApp number, connected to your account. Mandatory: no number is chosen for you. |
| contentrequired | object | { template, language, variables } for a template, or { text } for a free text (4,096 characters at most). The template is named by its name; language is optional when it exists in one language only. |
| content.variablesoptional | object | "1", "2"… for {{1}}, {{2}}… of the body; "header" for a text header variable; "button_1", "button_2"… for a button link suffix, by its position. A missing variable is refused, naming it. |
| callback_urloptional | string | Same as for SMS. |
| client_referenceoptional | string | Same as for SMS. |
curl -X POST https://api.fastermessage.com/v2/whatsapp/send \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": "+2290160000000", "from": "+2290161000000", "content": { "template": "order_confirmation", "language": "en", "variables": { "1": "Awa", "2": "1187" } }, "client_reference": "order-1187" }'
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/whatsapp/send', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "to": "+2290160000000", "from": "+2290161000000", "content": { "template": "order_confirmation", "language": "en", "variables": { "1": "Awa", "2": "1187" } }, "client_reference": "order-1187" }), }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/whatsapp/send'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'to' => '+2290160000000', 'from' => '+2290161000000', 'content' => [ 'template' => 'order_confirmation', 'language' => 'en', 'variables' => [ '1' => 'Awa', '2' => '1187', ], ], 'client_reference' => 'order-1187', ]), ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.post( "https://api.fastermessage.com/v2/whatsapp/send", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, json={ "to": "+2290160000000", "from": "+2290161000000", "content": { "template": "order_confirmation", "language": "en", "variables": { "1": "Awa", "2": "1187", }, }, "client_reference": "order-1187", }, timeout=15, ) print(response.status_code, response.json())
Refusals to know
| HTTP | code | Cause |
|---|---|---|
| 400 | sender_required | No from. |
| 400 | template_not_found | No template with this name and language on the account, or a template of another WhatsApp Business account than the sending number. |
| 400 | template_not_sendable | Template not approved by Meta, an authentication template (see OTP) or with a media header (not open to the API yet). |
| 400 | invalid_content | Missing variable, language to specify, or empty or too long text. |
| 400 | unsupported_parameter | scheduled_at: not open on WhatsApp yet. |
| 402 | insufficient_balance | WhatsApp balance below the price of one message. |
| 403 | sender_not_approved | Sending number not connected to your account. |
| 403 | sender_unavailable | Number disconnected, awaiting validation, or restricted by Meta (it can still reply within the 24-hour window). |
| 403 | recipient_opted_out | Number on your WhatsApp “Do not contact” list. |
| 409 | session_window_closed | Free text outside the 24-hour window: send a template. |
| 409 | account_not_configured | No WhatsApp price for this country and category. |
Unified sending
Same effect as the per-channel routes, with the channel as a parameter: channel is sms, email or whatsapp. Useful to switch channel by configuration, without changing the call. Both paths share the same rules and return the same resource.
curl -X POST https://api.fastermessage.com/v2/messages \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "channel": "sms", "to": "+2290160000000", "from": "FASTERMSG", "content": "Your appointment is confirmed." }'
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/messages', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "channel": "sms", "to": "+2290160000000", "from": "FASTERMSG", "content": "Your appointment is confirmed." }), }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/messages'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'channel' => 'sms', 'to' => '+2290160000000', 'from' => 'FASTERMSG', 'content' => 'Your appointment is confirmed.', ]), ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.post( "https://api.fastermessage.com/v2/messages", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, json={ "channel": "sms", "to": "+2290160000000", "from": "FASTERMSG", "content": "Your appointment is confirmed.", }, timeout=15, ) print(response.status_code, response.json())
channelabsent:400 missing_parameter. Unknown channel:400 invalid_channel.- On a per-channel route, a contradictory
channelis refused (400 channel_mismatch), never ignored. POST /v2/voice/sendandchannel: voiceanswer501 not_implemented, once the body is validated.
Cross-channel fallback
If your message does not get through, FasterMessage sends it on the next channel you listed. The fallback field is an array, one line per channel, in the order you want. It goes on POST /v2/messages, POST /v2/sms/send, POST /v2/email/send and POST /v2/otp. Batch sending has no fallback: POST /v2/sms/batch refuses it with 400 invalid_fallback.
When the fallback runs
| Send | The fallback runs… |
|---|---|
| Message | As soon as the message definitely fails, with no delay. A delivered message triggers nothing. |
| OTP, SMS failed | At once, without waiting for the delay. |
| OTP, SMS sent | If the code is not confirmed within the delay set on your account (OTP screen), even when the SMS is delivered. |
{
"channel": "sms",
"to": "+22997000000",
"from": "MABOUTIQUE",
"content": "Votre commande est prête.",
"fallback": [
{
"channel": "email",
"to": "[email protected]",
"from": "[email protected]",
"content": { "subject": "Votre commande", "text": "Votre commande est prête." }
}
]
}A fallback line
| Field | Type | Description |
|---|---|---|
| channelrequired | string | sms, email or whatsapp. voice is accepted but does not go out yet. Neither the primary channel nor a duplicate. To WhatsApp, content is { template, language, variables } (approved template) or { text } (free text, which only goes if the 24-hour window is open); for an OTP, the authentication template, which you can omit when the account has only one. After a WhatsApp template message, an email step must carry its own content. |
| torequired | string | Recipient on this channel: email address or number. |
| fromrequired | string | Approved sender on this channel: address or Sender ID. |
| contentoptional | object | To email: optional, the SMS text is reused and the default subject is your brand name. To SMS: required, an email does not boil down to an SMS. For an OTP: optional, and a custom content must contain {code}. |
What the response says
A badly written line refuses the request (400) and nothing goes out. A block tied to your account, however, never stops the main message: it goes out, and the fallback field of the response says, channel by channel, what cannot follow.
{
"fallback": {
"will_run": true,
"state": "watching",
"steps": [
{ "channel": "whatsapp", "will_run": false, "reason": "channel_not_available", "message_id": null },
{ "channel": "email", "will_run": true, "reason": null, "message_id": null }
]
}
}| reason | Meaning |
|---|---|
| channel_not_available | Voice, not open yet. |
| invalid_recipient | Unreadable fallback recipient. |
| sender_not_allowed | Sender not approved on this account. |
| channel_not_priced | No price on this channel. |
| insufficient_balance | Insufficient balance on this channel. |
| recipient_blocked | Recipient on the “Do not contact” list. |
| destination_not_available | Country not served, or without a price on this account. |
| ttl_too_short | OTP: the code would expire before the delay ends. |
| rate_limited | OTP: too many codes requested for this address within an hour. |
| account_not_active | Since the request: account suspended, brand disabled, API access closed or key replaced. |
| send_failed | Incident while preparing or sending the fallback. |
| template_not_available | WhatsApp: template not found, not approved or incomplete. |
| session_window_closed | WhatsApp: free text outside the 24-hour window. |
- Billing: the fallback is a send charged at the price of its channel, on top of the original message, which keeps its charge unless refunded under the usual rules.
- Watching: a message without an outcome after 72 hours no longer triggers a fallback (
expired). - Refused send: if the main message is refused at request time, for lack of balance for example, you get the error and no fallback starts.
Test with a test key
With fm_test_…, add "test_outcome": "failed" to your send: the simulated message fails and the simulated fallback goes out within seconds, with no cost or delivery. Read it back through GET /v2/messages/{id}. For an OTP, without this field, the fallback goes out once the delay is over if you do not confirm the code. A live key refuses test_outcome with 400.
Batch sending (SMS)
Up to 500 SMS per call, for a single rate unit. Values set at batch level are inherited by every line that does not carry its own: the same route serves broadcasting (one text, N numbers) and grouped transactional sending (one text per line). Every line becomes an ordinary message, tracked and charged individually.
Request body
| Field | Type | Description |
|---|---|---|
| messagesrequired | array | From 1 to 500 lines. Each accepts to, from, content, scheduled_at, callback_url and client_reference. |
| fromoptional | string | Batch sender. Mandatory as soon as a line has none of its own. |
| contentoptional | string | object | Batch content, mandatory when no line has its own. |
| scheduled_atoptional | string | Common send date. |
| callback_urloptional | string | Common callback URL. |
curl -X POST https://api.fastermessage.com/v2/sms/batch \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "from": "FASTERMSG", "content": "Your delivery arrives tomorrow between 9 am and 12 pm.", "messages": [ { "to": "+2290160000000", "client_reference": "cmd-42" }, { "to": "+2290161000001", "content": "Your delivery arrives today.", "client_reference": "cmd-43" }, { "to": "2296", "client_reference": "cmd-44" } ] }'
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/sms/batch', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "from": "FASTERMSG", "content": "Your delivery arrives tomorrow between 9 am and 12 pm.", "messages": [ { "to": "+2290160000000", "client_reference": "cmd-42" }, { "to": "+2290161000001", "content": "Your delivery arrives today.", "client_reference": "cmd-43" }, { "to": "2296", "client_reference": "cmd-44" } ] }), }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/sms/batch'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'from' => 'FASTERMSG', 'content' => 'Your delivery arrives tomorrow between 9 am and 12 pm.', 'messages' => [ [ 'to' => '+2290160000000', 'client_reference' => 'cmd-42', ], [ 'to' => '+2290161000001', 'content' => 'Your delivery arrives today.', 'client_reference' => 'cmd-43', ], [ 'to' => '2296', 'client_reference' => 'cmd-44', ], ], ]), ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.post( "https://api.fastermessage.com/v2/sms/batch", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, json={ "from": "FASTERMSG", "content": "Your delivery arrives tomorrow between 9 am and 12 pm.", "messages": [ { "to": "+2290160000000", "client_reference": "cmd-42", }, { "to": "+2290161000001", "content": "Your delivery arrives today.", "client_reference": "cmd-43", }, { "to": "2296", "client_reference": "cmd-44", }, ], }, timeout=15, ) print(response.status_code, response.json())
{
"total": 3,
"accepted": 2,
"rejected": 1,
"data": [
{ "index": 0, "id": "66f1c2a4e8b7d90012ab34cd", "status": "queued", "to": "+2290160000000", "units": 1 },
{ "index": 1, "id": "66f1c2a4e8b7d90012ab34ce", "status": "queued", "to": "+2290161000001", "units": 1 }
],
"errors": [
{
"index": 2,
"code": "invalid_number",
"message": "The recipient number is not valid.",
"param": "messages[2].to",
"to": "2296"
}
]
}data carries the full message resource of each accepted line, plus its index, its position (zero-based) in messages. accepted + rejected always equals total. A report says what was accepted, not what was delivered.
Refused as a whole or per line
| Scope | Response | Causes |
|---|---|---|
| Whole batch | 400 | Malformed body, messages absent or empty, more than 500 lines (batch_too_large), from or content missing for a line, unreadable date or URL. Nothing is sent. |
| Whole batch | 402 | Balance at zero. |
| Whole batch | 403 | Batch from unknown or not approved. |
| Whole batch | 409 | Account with no default price (account_not_configured). |
| Line | 200, in errors | Unreadable number or unserved destination, empty content, line from refused, recipient opted out, country closed to the account, balance no longer covering this line. |
Read a message
Returns the message resource, in the shape that sending returns. The identifier is enough: it is looked up on both SMS and email. For an SMS sent before the migration, {id} can also be the uuid returned by the former platform. An identifier that is unknown or belongs to another account gives the same 404 message_not_found.
curl https://api.fastermessage.com/v2/messages/66f1c2a4e8b7d90012ab34cd \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY"
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/messages/66f1c2a4e8b7d90012ab34cd', { method: 'GET', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, }, }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/messages/66f1c2a4e8b7d90012ab34cd'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), ], ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.get( "https://api.fastermessage.com/v2/messages/66f1c2a4e8b7d90012ab34cd", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, timeout=15, ) print(response.status_code, response.json())
{
"id": "66f1c2a4e8b7d90012ab34cd",
"channel": "sms",
"status": "delivered",
"to": "+2290160000000",
"from": "FASTERMSG",
"units": 1,
"price": 12,
"currency": "XOF",
"refund": null,
"client_reference": "cmd-42",
"fallback_of": null,
"error": null,
"created_at": "2026-11-04T10:00:00.000Z",
"scheduled_at": null,
"sent_at": "2026-11-04T10:00:01.420Z",
"delivered_at": "2026-11-04T10:00:06.900Z"
}List messages
Query parameters
| Field | Type | Description |
|---|---|---|
| channeloptional | string | sms (default), email or whatsapp. Without this filter, only SMS are returned: for your emails, ask for channel=email, for your WhatsApp messages channel=whatsapp. voice: 501. |
| statusoptional | string | One of the six statuses. scheduled and queued return the same lines, as do undelivered and failed: read status on each line to tell them apart. |
| client_referenceoptional | string | Your reference, exact: client_reference in v2, messageId in v1, history from before the migration included. |
| limit, cursoroptional | integer, string | See Pagination. |
curl https://api.fastermessage.com/v2/messages?channel=email&status=delivered&limit=100 \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY"
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/messages?channel=email&status=delivered&limit=100', { method: 'GET', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, }, }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/messages?channel=email&status=delivered&limit=100'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), ], ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.get( "https://api.fastermessage.com/v2/messages?channel=email&status=delivered&limit=100", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, timeout=15, ) print(response.status_code, response.json())
Message resource
| Field | Type | Description |
|---|---|---|
| idrequired | string | Our message identifier. |
| channelrequired | string | sms or email. |
| statusrequired | string | See the table below. |
| torequired | string | Normalised recipient. |
| fromrequired | string | Sender used, as it goes out. |
| unitsrequired | integer | Units charged: segments for SMS, 1 for email. |
| pricerequired | number | null | Cost charged. null when not settled, when zero, in test, and in the send response. |
| currencyrequired | string | Currency of the charge. May be empty: always at sending and in test, and on email. Balance and movements carry the currency reliably. |
| refundrequired | object | null | { amount, currency, refunded_at } when the message was refunded. Filled in for SMS. |
| client_referencerequired | string | null | Your reference. |
| fallback_ofrequired | string | null | Always null to date. |
| fallbackoptional | object | null | Single-send response only. See Fallback. |
| errorrequired | object | null | { code, message, provider_code } when the message failed. See Failure reasons. |
| created_atrequired | string | Request received. |
| scheduled_atrequired | string | null | Scheduled date. |
| sent_atrequired | string | null | Handed to the network. |
| delivered_atrequired | string | null | Delivered to the recipient. |
| read_atoptional | string | null | Read by the recipient — WhatsApp only, absent from the other channels. |
Statuses
| Status | Terminal | Meaning |
|---|---|---|
| scheduled | no | Scheduled: waiting for its date. |
| queued | no | Accepted and queued: waiting for its turn. |
| sent | no | Handed to the network, final receipt not received. |
| delivered | yes | Delivered to the recipient. |
| undelivered | yes | Presented, but not delivered: failure reported by the carrier or the mail server. |
| failed | yes | Never left, or refused before the network: balance, sender, incident. |
Webhooks
Rather than polling GET /v2/messages/{id}, receive the outcome of your messages on your server. A test key calls no webhook: try this point with a real send.
Configure
- URL: on the account (back office, Integration & API), or per message with
callback_url, which then takes precedence. A sub-account with no URL inherits its affiliator’s, along with its events, verb and secret. - Events:
deliveredandfailedby default,sentoptional (SMS). This setting also applies tocallback_url. An empty selection suspends callbacks.scheduledandqueuedare never notified. - Verb:
POSTby default. WithGETon the account, no body is sent: onlyuuidandlevelarrive, for SMS, in the query. - Address: a URL resolving to an internal or private address is never called, with no error on your side. Serve it over HTTPS.
- Fallback: requesting a fallback is enough to receive its outcome, whatever events are ticked, always as
POST. Only an empty selection suspends it too.
Payload received: SMS
{
"uuid": "66f1c2a4e8b7d90012ab34cd",
"level": 2,
"status": "Delivered",
"receivedAt": "2026-11-04T10:00:06.900Z",
"messageId": "cmd-42",
"from": "FASTERMSG",
"to": "+2290160000000",
"text": "Votre commande cmd-42 est prete.",
"smsCount": 1,
"sentAt": "2026-11-04T10:00:01.420Z",
"messageStatusCode": "",
"messageStatus": "Delivered",
"description": "",
"reference": "",
"batchuuid": ""
}SMS status mapping
| Callback status | Resource status | Event |
|---|---|---|
| Sended | sent | sent |
| Delivered | delivered | delivered |
| Undelivered | undelivered | failed |
| Rejected | failed | failed |
messageId is your client_reference. messageStatusCode carries the carrier code on failure, description a reason in French. reference and batchuuid are empty. level is 1 for a response at submission, 2 for a delivery receipt.
Payload received: email
{
"id": "66f1c2a4e8b7d90012ab34cd",
"channel": "email",
"status": "failed",
"to": "[email protected]",
"from": "[email protected]",
"subject": "Votre facture de novembre",
"client_reference": "facture-1187",
"provider_message_id": null,
"sent_at": "2026-11-04T10:00:01.420Z",
"event_at": "2026-11-04T10:00:03.100Z",
"error": {
"code": "hard_bounce",
"message": "The address does not exist or was permanently rejected."
}
}status here is only delivered or failed. A delivery failure notified as failed reads as undelivered on the resource. provider_message_id is always null.
Payload received: fallback
{
"event": "fallback",
"id": "66f1c2a4e8b7d90012ab34cd",
"kind": "message",
"channel": "sms",
"client_reference": "cmd-42",
"fallback": {
"will_run": true,
"state": "triggered",
"steps": [
{ "channel": "email", "will_run": true, "reason": null, "message_id": "66f1c3b7e8b7d90012ab35e4" }
]
},
"event_at": "2026-11-04T10:00:08.200Z"
}Recognise this callback by event, which is fallback. id is the one returned at sending: the primary message, or the code request when kind is otp. fallback has the shape of the resource. state is triggered (the fallback ran, message_id names it) or failed (no step could run, reason says why). No callback when the fallback was not needed. The URL is the request’s (callback_url), otherwise the account’s.
Verify the signature
Every POST callback carries the X-Fastermessage-Signature: sha256=… header: the HMAC-SHA256 of the body, in hexadecimal. The secret is generated in Integration & API and applies to both SMS and email. Compare on the raw body, before any JSON parsing.
import { createHmac, timingSafeEqual } from 'node:crypto'; function isGenuine(rawBody, header, secret) { const expected = 'sha256=' + createHmac('sha256', secret).update(rawBody).digest('hex'); const a = Buffer.from(expected); const b = Buffer.from(header ?? ''); return a.length === b.length && timingSafeEqual(a, b); }
Delivery and retries
- Answer
2xxin under 10 seconds. Any other response, even a4xx, or an overrun counts as a failure. Answer on receipt, process afterwards. - A failure is replayed after 1 min, 5 min, 30 min then 2 h, making 5 attempts in total. Beyond that, the callback is abandoned. Longer downtime on your server can therefore lose some: plan a periodic catch-up through
GET /v2/messages. - At most three redirects are followed. A
301or302on aPOSTbecomes aGETwith no body: declare the final URL. - Order is not guaranteed: a
Sendedcan follow aDelivered. The same event may arrive twice: deduplicate onuuid+status(SMS),id+status(email).
Verification codes (OTP)
Two calls: the platform generates the code and sends it by SMS or WhatsApp, then you submit what the user typed. The code is never returned to your server. The send is an ordinary API message of that channel: same checks, same charge. By WhatsApp, it goes through your approved authentication template, at that category’s rate.
Request body
| Field | Type | Description |
|---|---|---|
| torequired | string | Recipient number. |
| channeloptional | string | sms (default) or whatsapp. Voice answers 501. |
| fromoptional | string | SMS: Sender ID, optional when the account has only one approved, mandatory otherwise (400 sender_required). WhatsApp: number connected to the account, mandatory. |
| lengthoptional | integer | 4 or 6 digits. Otherwise, the account setting (6). |
| ttl_secondsoptional | integer | Validity, from 30 to 3600 seconds. Otherwise, the account setting (300). |
| templateoptional | string | SMS: message text, which must contain {code} (400 invalid_template otherwise); absent, a standard text in French. WhatsApp: name of the approved authentication template, optional when the account has only one; the code goes into it, with the “Copy code” button. |
| languageoptional | string | WhatsApp: language of the authentication template, when there are several. |
| client_referenceoptional | string | Your reference. |
| fallbackoptional | array | Fallback to another channel (SMS, email, WhatsApp): runs at once if the first send fails, otherwise if the code is not validated by the end of the delay set on the account. A custom content must contain {code}. See Fallback. |
| callback_urloptional | string | http(s) URL of the callback announcing the fallback outcome. Takes precedence over the account’s. |
| test_outcomeoptional | string | Test key only: failed makes the simulated SMS fail, to try the fallback. |
curl -X POST https://api.fastermessage.com/v2/otp \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": "+2290160000000", "channel": "sms", "from": "FASTERMSG", "length": 6, "ttl_seconds": 300, "template": "Your code is {code}. It expires in 5 minutes." }'
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/otp', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "to": "+2290160000000", "channel": "sms", "from": "FASTERMSG", "length": 6, "ttl_seconds": 300, "template": "Your code is {code}. It expires in 5 minutes." }), }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/otp'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'to' => '+2290160000000', 'channel' => 'sms', 'from' => 'FASTERMSG', 'length' => 6, 'ttl_seconds' => 300, 'template' => 'Your code is {code}. It expires in 5 minutes.', ]), ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.post( "https://api.fastermessage.com/v2/otp", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, json={ "to": "+2290160000000", "channel": "sms", "from": "FASTERMSG", "length": 6, "ttl_seconds": 300, "template": "Your code is {code}. It expires in 5 minutes.", }, timeout=15, ) print(response.status_code, response.json())
{
"id": "66f1c3b7e8b7d90012ab35de",
"to": "+2290160000000",
"channel": "sms",
"status": "pending",
"expires_at": "2026-11-04T10:05:00.000Z",
"attempts_remaining": 3,
"fallback": null,
"created_at": "2026-11-04T10:00:00.000Z"
}Keep id: the fallback callback carries it. fallback is null when no fallback was requested, otherwise it has the shape described in Fallback. pending says the SMS is queued, not that it was delivered. Refusals specific to this route: 403 otp_blocked (number excluded by your anti-fraud rules) and 429 rate_limit_exceeded (per-number cap, 5 requests per hour by default, adjustable in the back office), with no Retry-After.
curl -X POST https://api.fastermessage.com/v2/otp/verify \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "id": "66f1c3b7e8b7d90012ab35de", "code": "480912" }'
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/otp/verify', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "id": "66f1c3b7e8b7d90012ab35de", "code": "480912" }), }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/otp/verify'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'id' => '66f1c3b7e8b7d90012ab35de', 'code' => '480912', ]), ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.post( "https://api.fastermessage.com/v2/otp/verify", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, json={ "id": "66f1c3b7e8b7d90012ab35de", "code": "480912", }, timeout=15, ) print(response.status_code, response.json())
{
"id": "66f1c3b7e8b7d90012ab35de",
"status": "rejected",
"attempts_remaining": 2
}Verification outcomes
| status | Meaning | What to do |
|---|---|---|
| approved | Correct code. | Let the user through. The request is closed. |
| rejected | Wrong code, attempts remain. | Offer to retype. |
| expired | Request expired, already validated, or attempts exhausted. | Request a new code through POST /v2/otp. |
Contact groups
The address book is the same as in the back office, on the key’s account. These routes charge nothing. A contact belongs to one group only, and the group carries the labels of the 5 personalisation fields.
| Route | Effect | Success |
|---|---|---|
| POST /v2/contact-groups | Create. Body: name (mandatory), fields. Name already taken: 409 contact_group_exists. | 201 |
| GET /v2/contact-groups | List, with limit and cursor. | 200 |
| GET /v2/contact-groups/{id} | Read. | 200 |
| PATCH /v2/contact-groups/{id} | Partial update. Empty body: 400 empty_update. | 200 |
| DELETE /v2/contact-groups/{id} | Delete an empty group. Otherwise: 409 contact_group_not_empty. | 204 |
curl -X POST https://api.fastermessage.com/v2/contact-groups \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "VIP customers", "fields": [ "Last name", "First name", "City", "Segment", "Birthday" ] }'
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/contact-groups', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "name": "VIP customers", "fields": [ "Last name", "First name", "City", "Segment", "Birthday" ] }), }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/contact-groups'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'name' => 'VIP customers', 'fields' => [ 'Last name', 'First name', 'City', 'Segment', 'Birthday', ], ]), ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.post( "https://api.fastermessage.com/v2/contact-groups", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, json={ "name": "VIP customers", "fields": [ "Last name", "First name", "City", "Segment", "Birthday", ], }, timeout=15, ) print(response.status_code, response.json())
{
"id": "66b0f2a1c4d5e6f708192a3b",
"name": "Clients VIP",
"fields": ["Nom", "Prénom", "Ville", "Segment", "Anniversaire"],
"contacts_count": 0,
"created_at": "2026-11-04T10:00:00.000Z",
"updated_at": "2026-11-04T10:00:00.000Z"
}fields always has 5 entries in the response, an empty label meaning “unused field”. More than 5 entries on input are refused, because the position carries the meaning.
Contacts
| Route | Effect | Success |
|---|---|---|
| POST /v2/contacts | Create a contact. No uniqueness enforced: the same number can be created twice. | 201 |
| POST /v2/contacts/batch | Create up to 500 contacts in one group, with duplicate handling and a report. | 200 |
| GET /v2/contacts | List: group_id, consent, search (number or email), limit, cursor. | 200 |
| GET /v2/contacts/{id} | Read. | 200 |
| PATCH /v2/contacts/{id} | Partial update. email: null erases the address, group_id moves the contact. | 200 |
| DELETE /v2/contacts/{id} | Delete for good. This is not an unsubscription: a deleted contact comes back at the next import. For a lasting refusal, consent: out. | 204 |
Contact fields
| Field | Type | Description |
|---|---|---|
| group_idrequired | string | Group of the account. Unknown: 400 invalid_parameter. |
| phone_numberrequired | string | 8 to 15 digits, + optional. Returned normalised. Invalid: 400 invalid_phone_number. |
| emailoptional | string | Address. Invalid: 400 invalid_email. |
| whatsappoptional | boolean | Declarative: reachable on WhatsApp. false by default. |
| consentoptional | string | in (default) or out, unsubscribed. Send it if your system handles unsubscriptions, otherwise every sync would resubscribe those who said STOP. |
| fieldsoptional | array | Up to 5 values, positional: value i answers label i of the group. |
curl -X POST https://api.fastermessage.com/v2/contacts/batch \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "group_id": "66b0f2a1c4d5e6f708192a3b", "on_duplicate": "update", "contacts": [ { "phone_number": "+2290160000000", "email": "[email protected]", "fields": [ "Traoré", "Awa" ] }, { "phone_number": "2290161000001", "whatsapp": true }, { "phone_number": "inconnu" } ] }'
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/contacts/batch', { method: 'POST', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "group_id": "66b0f2a1c4d5e6f708192a3b", "on_duplicate": "update", "contacts": [ { "phone_number": "+2290160000000", "email": "[email protected]", "fields": [ "Traoré", "Awa" ] }, { "phone_number": "2290161000001", "whatsapp": true }, { "phone_number": "inconnu" } ] }), }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/contacts/batch'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'group_id' => '66b0f2a1c4d5e6f708192a3b', 'on_duplicate' => 'update', 'contacts' => [ [ 'phone_number' => '+2290160000000', 'email' => '[email protected]', 'fields' => [ 'Traoré', 'Awa', ], ], [ 'phone_number' => '2290161000001', 'whatsapp' => true, ], [ 'phone_number' => 'inconnu', ], ], ]), ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.post( "https://api.fastermessage.com/v2/contacts/batch", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, json={ "group_id": "66b0f2a1c4d5e6f708192a3b", "on_duplicate": "update", "contacts": [ { "phone_number": "+2290160000000", "email": "[email protected]", "fields": [ "Traoré", "Awa", ], }, { "phone_number": "2290161000001", "whatsapp": True, }, { "phone_number": "inconnu", }, ], }, timeout=15, ) print(response.status_code, response.json())
{
"total": 3,
"created": 1,
"updated": 1,
"skipped": 0,
"invalid": 1,
"data": [ ... ],
"errors": [
{
"index": 2,
"code": "invalid_phone_number",
"message": "Expected 8 to 15 digits, optionally prefixed with \"+\".",
"param": "contacts[2].phone_number"
}
]
}on_duplicate: number already in the group
| Value | Effect |
|---|---|
| skip | Default. The existing one stays as is. |
| update | The existing one is updated. |
| create | A second record is created. Without Idempotency-Key, a replay would duplicate the whole batch. |
created + updated + skipped + invalid always equals total. A malformed body, an unknown consent or more than 500 lines refuse the whole batch with 400. A contact that is unknown or from another account answers 404 contact_not_found.
Balance
Returns the balance of the charged account, channel by channel, in its brand’s currency. Every channel is returned, including at zero. For a sub-account, this is therefore its affiliator’s balance: the one it consumes.
curl https://api.fastermessage.com/v2/balance \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY"
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/balance', { method: 'GET', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, }, }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/balance'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), ], ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.get( "https://api.fastermessage.com/v2/balance", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, timeout=15, ) print(response.status_code, response.json())
{
"balances": [
{ "channel": "sms", "amount": 289009, "currency": "XOF" },
{ "channel": "whatsapp", "amount": 0, "currency": "XOF" },
{ "channel": "email", "amount": 100, "currency": "XOF" },
{ "channel": "voice", "amount": 0, "currency": "XOF" }
]
}Credit movements
The charged account’s log, newest first. amount is signed: balance_before + amount always equals balance_after.
Query parameters
| Field | Type | Description |
|---|---|---|
| fromoptional | string | Start of period, ISO 8601. |
| tooptional | string | End of period. Without a time, the whole UTC day is included. Before from: 400. |
| typeoptional | string | credit (balance in), debit (balance out) or refund (return with no purchase). |
| limit, cursoroptional | integer, string | See Pagination. |
{
"id": "66f1c2a4e8b7d90012ab34f1",
"type": "debit",
"channel": "sms",
"amount": -12,
"currency": "XOF",
"balance_before": 289021,
"balance_after": 289009,
"reason": "message_send",
"message_id": "66f1c2a4e8b7d90012ab34cd",
"created_at": "2026-11-04T10:00:00.000Z"
}Reasons
| reason | Meaning |
|---|---|
| recharge | Balance top-up. |
| message_send | Charge for a send. |
| system_failure_refund | Refund of a failure. |
| hold_release | Hold returned. |
| adjustment | Correction or transfer: the sign of amount gives the direction. |
Account resources
Four reads to offer your users what can be sent, instead of having them copy a number or a template name from the back office. They only return what is validated, usable and confirmed in the back office: nothing that is a draft, pending, rejected or disabled. Each applies the rule of the send it prepares: a listed item is not refused later because of its state.
| Route | Returns | Used for |
|---|---|---|
| GET /v2/whatsapp/numbers | WhatsApp numbers able to send a template now. | from of /v2/whatsapp/send. |
| GET /v2/whatsapp/templates | Templates approved by Meta, without a media header, with their variables. | content.template, language and variables. |
| GET /v2/email/senders | Validated sender addresses, with their domain. | from of /v2/email/send. |
| GET /v2/email/templates | Published email templates. | content.subject and content.html. |
- These routes charge nothing. They read the resources of the key’s account — the ones used when sending.
- Cursor pages, like every list:
limitandcursor, see Pagination. - With a test key, these are the account’s real resources: a simulated send requires the same numbers, templates and addresses as a real one.
- Declaring, validating and submitting to Meta stay in the back office.
WhatsApp numbers
A number is listed when it is validated by the platform, ready at Meta and not restricted. A pending, disconnected, not-yet-ready or restricted number is not listed — even if it can still reply in an open conversation. quality is high, medium, low or unknown: a low quality does not prevent sending.
curl https://api.fastermessage.com/v2/whatsapp/numbers \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY"
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/whatsapp/numbers', { method: 'GET', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, }, }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/whatsapp/numbers'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), ], ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.get( "https://api.fastermessage.com/v2/whatsapp/numbers", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, timeout=15, ) print(response.status_code, response.json())
{
"data": [
{
"number": "+2290161000000",
"display_name": "Boutique Awa",
"label": "Service client",
"quality": "high",
"is_default": true
}
],
"has_more": false,
"next_cursor": null
}Fields
| Field | Type | Description |
|---|---|---|
| numberoptional | string | E.164 — the value to pass as from. |
| display_nameoptional | string | null | Name verified by Meta, seen by the recipient. null until Meta returns it. |
| labeloptional | string | Internal label of the number in the back office. |
| is_defaultoptional | boolean | Default number in the back office. Informative: the API never picks one for you. |
WhatsApp templates
Templates approved by Meta, without a media header (image, video, document: not open to the API yet). Drafts, templates under review, rejected, paused or disabled are not listed. variables gives the exact content.variables keys the send requires, in the vocabulary of WhatsApp: header, 1, 2…, button_1…
curl https://api.fastermessage.com/v2/whatsapp/templates \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY"
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/whatsapp/templates', { method: 'GET', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, }, }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/whatsapp/templates'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), ], ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.get( "https://api.fastermessage.com/v2/whatsapp/templates", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, timeout=15, ) print(response.status_code, response.json())
{
"data": [
{
"id": "66f1c2a4e8b7d90012ab34aa",
"name": "order_confirmation",
"language": "en",
"category": "utility",
"header_text": "Order {{1}}",
"body": "Hello {{1}}, your order will be delivered on {{2}}.",
"footer": null,
"variables": ["header", "1", "2"],
"number": "+2290161000000"
},
{
"id": "66f1c2a4e8b7d90012ab34ab",
"name": "verification_code",
"language": "en",
"category": "authentication",
"header_text": null,
"body": "*{{1}}* is your verification code.",
"footer": null,
"variables": [],
"number": "+2290161000000"
}
],
"has_more": false,
"next_cursor": null
}- Category:
marketingandutilitygo through/v2/whatsapp/send. Anauthenticationtemplate only servesPOST /v2/otp, which supplies the code: itsvariablesare therefore empty. - number: the number the template was submitted under, or
null. Meta refuses a template from another WhatsApp Business account than thefrom: send from this number, or another one of the same WhatsApp Business account. - A template is identified by the
name+languagepair: the same name can appear in several languages.
Sender addresses
The account’s active addresses, whose domain is authenticated, and — at the top of the first page — your brand’s default address if your account is allowed to borrow it (brand_default: true). It is never used by default: name it in from.
curl https://api.fastermessage.com/v2/email/senders \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY"
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/email/senders', { method: 'GET', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, }, }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/email/senders'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), ], ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.get( "https://api.fastermessage.com/v2/email/senders", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, timeout=15, ) print(response.status_code, response.json())
{
"data": [
{
"address": "[email protected]",
"name": "Boutique Awa",
"domain": "exemple.bj",
"brand_default": false
}
],
"has_more": false,
"next_cursor": null
}Email templates
The account’s published templates; drafts are not listed. from_email is null when the account can no longer send under the template’s address (domain no longer authenticated, address removed): then pick an address from GET /v2/email/senders.
curl https://api.fastermessage.com/v2/email/templates \ -u "$FM_API_USER:$FM_API_SECRET" \ -H "X-Api-Key: $FM_API_KEY"
const auth = Buffer.from(`${process.env.FM_API_USER}:${process.env.FM_API_SECRET}`).toString('base64'); const response = await fetch('https://api.fastermessage.com/v2/email/templates', { method: 'GET', headers: { Authorization: `Basic ${auth}`, 'X-Api-Key': process.env.FM_API_KEY, }, }); const data = await response.json(); console.log(response.status, data);
<?php $ch = curl_init('https://api.fastermessage.com/v2/email/templates'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_USERPWD => getenv('FM_API_USER') . ':' . getenv('FM_API_SECRET'), CURLOPT_HTTPHEADER => [ 'X-Api-Key: ' . getenv('FM_API_KEY'), ], ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status . PHP_EOL . $response . PHP_EOL;
import os import requests response = requests.get( "https://api.fastermessage.com/v2/email/templates", auth=(os.environ["FM_API_USER"], os.environ["FM_API_SECRET"]), headers={"X-Api-Key": os.environ["FM_API_KEY"]}, timeout=15, ) print(response.status_code, response.json())
{
"data": [
{
"id": "66f1c2a4e8b7d90012ab34bb",
"name": "Welcome",
"subject": "Welcome aboard",
"html": "<h1>Welcome</h1><p>Thank you for signing up.</p>",
"from_email": "[email protected]",
"from_name": "Awa Shop",
"reply_to": "[email protected]"
}
],
"has_more": false,
"next_cursor": null
}Senders
Senders are declared and tracked from the back office. The usable ones can be read through the API: email addresses with GET /v2/email/senders, WhatsApp numbers with GET /v2/whatsapp/numbers (see Account resources); SMS Sender IDs are not exposed. What the API imposes, on every send:
| Situation | SMS | |
|---|---|---|
from absent | Refused with 400 missing_parameter: no account default. | Oldest active address of the account, otherwise 400 sender_required. |
from unknown or not approved | Refused with 403 sender_not_approved. Nothing is charged. | Refused with 403 sender_not_approved. Nothing is charged. |
| Borrowing from the brand | The brand’s default Sender ID, when the account is allowed to and the record carrying it is active. The send is real and charged. | The brand’s default address, when the account is allowed to, provided it is requested in from. |
| Test key | Same rules. | Same rules. |
How to declare one is set out in the back-office documentation.
All routes
| Method | Path | Purpose |
|---|---|---|
| GET | /v2 | Contract discovery, without credentials: name, contract_version, build, status, documentation_url. |
| GET | /v2/ping | Connectivity test, without credentials: { "data": "PONG", "timestamp": "…" }. |
| POST | /v2/sms/send | Send an SMS. |
| POST | /v2/sms/batch | Send SMS in a batch. |
| POST | /v2/email/send | Send an email. |
| POST | /v2/messages | Unified sending. |
| POST | /v2/whatsapp/send | Send a WhatsApp message. |
| POST | /v2/voice/send | Declared: 501. |
| GET | /v2/messages | List messages. |
| GET | /v2/messages/{id} | Read a message. |
| POST | /v2/otp | Issue a code. |
| POST | /v2/otp/verify | Verify a code. |
| * | /v2/contact-groups | Contact groups. |
| * | /v2/contacts | Contacts. |
| GET | /v2/balance | Balance. |
| GET | /v2/credits | Credit movements. |
| GET | /v2/whatsapp/numbers | Usable WhatsApp numbers. |
| GET | /v2/whatsapp/templates | Sendable WhatsApp templates. |
| GET | /v2/email/senders | Usable sender addresses. |
| GET | /v2/email/templates | Published email templates. |
| GET | /v2/campaigns | Declared: 501. |
| GET | /v2/campaigns/{id} | Declared: 501. |
A route outside the contract answers 404 resource_not_found, in the same error format.
Error codes
Every error follows the same shape, whatever the route: a single object under error. param only appears when a field is at fault.
{
"error": {
"type": "invalid_request",
"code": "missing_parameter",
"message": "A recipient is required.",
"param": "to",
"request_id": "2f1c9d4e-8a6b-4c1e-9f2a-7d3b5e0c1a84"
}
}Test code, which is stable. Never test message, written in English for developers and liable to be rephrased.
Should you retry?
| HTTP | What to do |
|---|---|
| 400, 404 | Fix the call. Do not replay it unchanged. |
| 401 | Check both credentials, the key and the domain called. |
| 402 | Top up the charged account. |
| 403 | Refusal on the merits: fix the sender, request the country, or stop contacting this recipient. |
| 409 | Read code: depending on the case, wait, change the key or contact the provider. |
| 429 | Wait for Retry-After, then replay. |
| 501 | Do not replay: feature not served. |
| 500, 503, network timeout | Replay with a growing delay and the same Idempotency-Key. |
Families (type)
| type | HTTP | Meaning |
|---|---|---|
| invalid_request | 400 · 404 · 409 | The request cannot succeed as it stands. |
| authentication_error | 401 | Credentials refused. |
| permission_error | 403 | This account cannot do that: sender, country, OTP blocked. |
| business_error | 402 · 403 | Business rule: balance, recipient opted out. |
| rate_limit_error | 429 | Cap reached. |
| api_error | 500 · 501 · 503 | A failure on our side, or a feature not served. |
All codes
| code | HTTP | Cause |
|---|---|---|
| missing_parameter | 400 | Mandatory field absent; param names it. |
| invalid_parameter | 400 | Unreadable field: date, URL, number, value outside the list, unknown group. |
| invalid_channel | 400 | Unknown channel. |
| channel_mismatch | 400 | channel contradicts the route. |
| invalid_content | 400 | Empty content, or a shape unsuited to the channel. |
| invalid_fallback | 400 | Malformed fallback. |
| invalid_number | 400 | Unreadable number. |
| invalid_recipient | 400 | Invalid recipient email address. |
| unsupported_destination | 400 | Country not served. Nothing is created or charged. |
| sender_required | 400 | No usable sender (email, OTP). |
| invalid_schedule | 400 | Unusable scheduled date. |
| invalid_cursor | 400 | Tampered cursor. |
| batch_too_large | 400 | More than 500 lines. |
| empty_update | 400 | PATCH with no field to change. |
| invalid_phone_number | 400 | Invalid contact number. |
| invalid_email | 400 | Invalid contact address. |
| invalid_template | 400 | OTP template without {code}. |
| unauthenticated | 401 | See Authentication. |
| insufficient_balance | 402 | Balance too low on the charged account. |
| sender_not_approved | 403 | Sender unknown or not approved. |
| destination_not_priced | 403 | Country served, but closed to this account. |
| recipient_opted_out | 403 | Recipient on the channel’s “Do not contact” list. |
| otp_blocked | 403 | Number excluded by the account’s anti-fraud rules. |
| resource_not_found | 404 | Unknown route. |
| message_not_found | 404 | Message unknown to the account. |
| contact_not_found | 404 | Contact unknown to the account. |
| contact_group_not_found | 404 | Group unknown to the account. |
| otp_not_found | 404 | OTP request unknown to the account. |
| idempotency_key_reuse | 409 | Key already used for another payload. |
| idempotency_key_in_flight | 409 | A request carrying this key is still in flight. |
| account_not_configured | 409 | Account with no price on this channel. Topping up changes nothing. |
| contact_group_exists | 409 | Group name already taken. |
| contact_group_not_empty | 409 | The group still holds contacts. |
| rate_limit_exceeded | 429 | Rate cap, or per-number OTP cap. |
| internal_error | 500 | Unexpected failure. Quote the request_id. |
| not_implemented | 501 | Feature declared, not served. |
| service_unavailable | 503 | Temporary unavailability: nothing was queued. |
Message failure reasons
Not to be confused with HTTP errors: an accepted message can fail later. The reason is read in the resource’s error. code is stable, message is in English, and provider_code carries, when there is one, the carrier’s code (001, ESME_RINVDSTADR…), otherwise null.
| error.code | Meaning |
|---|---|
| insufficient_balance | Balance too low at sending time. |
| recipient_opted_out | Recipient added to “Do not contact” in the meantime. |
| unsupported_destination | Destination not served. |
| channel_not_priced | No price for this channel on this account. |
| destination_not_priced | No price for this country on this account. |
| invalid_content | Invalid content. |
| account_not_configured | Account not configured for sending. |
| invalid_number | Number refused by the network. |
| sender_not_approved | Sender rejected by the carrier. |
| recipient_unreachable | Recipient unreachable. |
| operator_blocked | Blocked by the carrier: filtering, blacklist, do-not-disturb. |
| operator_error | Failure on the carrier’s network. |
| provider_rejected | Send rejected. |
| platform_error | Technical incident on the platform. |
| network_error | Network temporarily unavailable. |
| postpone_expired | Abandoned after several attempts. |
| cancelled | Cancelled before departure. |
| no-dlr | No receipt received: message closed. |
| hard_bounce | Email: address does not exist or was permanently rejected. |
| soft_bounce, deferred | Email: delivery deferred by the recipient’s server. |
| blocked | Email: recipient blocked. |
| invalid_email | Email: invalid address. |
| spam | Email: reported as spam. |
| unsubscribed | Email: recipient unsubscribed. |
| error | Email: delivery failed. |
| send_failed | Failure with no more specific reason. |
Other codes may be added: plan a default case, and treat an unknown code as a failure.
Limits
Throughput is capped per calling account, over a fixed window: 600 requests per minute by default, can be raised on request. Every authenticated request counts, including those that fail. GET /v2 and GET /v2/ping do not count. The cap applied to you is what X-RateLimit-Limit says.
Response headers
| Header | Content |
|---|---|
| X-RateLimit-Limit | Cap for the window. |
| X-RateLimit-Remaining | Calls left before refusal. Present even when the request passes. |
| X-RateLimit-Reset | Unix timestamp (seconds) of the end of the window. |
| Retry-After | Seconds to wait, on a rate 429. |
Pace yourself on X-RateLimit-Remaining rather than waiting for the refusal. A fixed window resets all at once: spread your retries to avoid a burst when it reopens.
Other caps
| Topic | Value |
|---|---|
| SMS batch, contact batch | 500 lines |
| Result page | 200 lines, 50 by default |
| Idempotency-Key retention | 24 h |
| Webhook response | 10 s |
| Webhook attempts | 5, over about 2 h 36 |
| OTP validity | 30 to 3600 s, 300 by default |
| Tries on an OTP | 3 by default |
| OTP requests per number | 5 per hour by default |
| Test send retention | 30 days |
Migrating from v1
| Topic | API v1 | API v2 |
|---|---|---|
| Credentials | Several forms, including in the request | Authorization: Basic and X-Api-Key, in headers only |
| Key | Optional prefix | fm_live_… or fm_test_… required, otherwise 401 |
| Body | Query, form or JSON | JSON |
| Text | text | content |
| Accents | accents | content.unicode, strict boolean |
| Reference | messageId | client_reference |
| Scheduling | Local time, historical formats | scheduled_at, ISO 8601 |
| Callback URL | dlr_url | callback_url |
| Response | {status, code, description} wrapper | Bare resource, semantic HTTP code |
| SMS callback | v1 format | Same format: no receiver to rewrite |
| History | Readable in v2 by the original uuid or reference |