SMS API Documentation
Send Philippine SMS through BlockOut’s SMS gateway. Your API and workspace use the same prepaid credits.
https://blockoutmediaph.com/apiQuick start
Create a key with Read & send SMS access in SMS → API & webhooks. Your account needs an active prepaid package and enough SMS credits.
curl -X POST 'https://blockoutmediaph.com/api/sms' \
-u 'YOUR_API_KEY:' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: appointment-123-v1' \
-d '{"recipient":"+639171234567","content":"Your appointment is confirmed.","consent":true}'
Use a new idempotency key for each new request. Reuse it only when retrying the same request.
Using Postman
Import the downloaded JSON collection. Set apiKey to your BlockOut key. The baseUrl is already set to our API. Replace sample recipients and content before sending; confirm recipient consent. Keep the same idempotency key for a retry and change it for a new submission. Requests reserve real credits when run against production.
Authentication
Use HTTP Basic authentication: API key as the username, empty password.
Authorization: Basic Base64Encode(YOUR_API_KEY:)
Bearer authentication is also supported:
Authorization: Bearer YOUR_API_KEY
Read-only keys can check statuses and credits. Send requests from your backend over HTTPS; keep keys out of browser code, APKs, URLs and public repositories.
/sms
Send SMS
Optional split_mode: auto (default) or two to send exactly two separate messages. Automatic sends the complete text for one credit per recipient, up to 1,000 characters. Split into 2 uses two credits per recipient and preserves complete links, including bare domains without www or https. A URL-only message that cannot be split safely is rejected.
Submit one recipient and one message. New accepted requests enter the automatic sending queue. Sending progress is available in your workspace and status responses.
{
"recipient": "+639171234567",
"content": "Your order is ready.",
"consent": true,
"metadata": {"order_id": "12345"}
}
| Field | Type | Required | Description |
|---|---|---|---|
recipient | string | Yes | Philippine mobile number: +639… or 09…. |
content | string | Yes | One text line, up to 1,000 characters. Segment use depends on length and encoding. |
consent | boolean | Yes | Must be true for recipients who agreed to receive the message. |
metadata | object | No | Your batch-level tracking data, up to 8 KiB. |
sender_id | string | No | Omit or use "default". Custom sender names are unavailable. |
Example response · 201 Created
{
"message": {
"reference_id": "msg_example",
"status": "queued",
"recipient_count": 1,
"segments": 1,
"credits_reserved": 1,
"credits_refunded": 0,
"created_at": "2026-10-14T00:00:00+00:00",
"updated_at": "2026-10-14T00:00:00+00:00",
"counts": {},
"metadata": {"order_id": "12345"},
"delivery_confirmed": false,
"messages": [{
"index": 0,
"recipient": "09171234567",
"content": "Your order is ready.",
"status": "queued"
}]
}
}
Save message.reference_id for tracking. The reference identifies the request, including all rows in a batch.
/blast
Blast SMS
One message to multiple recipients.
{
"recipients": ["+639171234567", "+639181234567"],
"content": "Our opening hours have changed.",
"consent": true,
"metadata": {"campaign": "opening-hours"}
}
recipients is a required array of 1–1,000 numbers. content and consent are required; top-level metadata is optional. Returns the same message envelope as Send SMS, with recipient_count and an indexed messages array.
The whole request is validated before reserving credits. Invalid recipients or insufficient credits reject the request; nothing is silently skipped. Repeated number lines are separate sends.
/bulk
Bulk SMS
Different messages for different recipients.
{
"messages": [
{"recipient": "+639171234567", "content": "Hi Ana, your order is ready."},
{"recipient": "+639181234567", "content": "Hi Ben, your appointment is confirmed."}
],
"consent": true,
"metadata": {"batch_id": "customer-updates-123"}
}
messages is a required array of 1–1,000 objects, each with recipient and content. Consent and metadata belong at the top level. Per-message metadata is not supported. Returns the same envelope as Send SMS. Use its message.reference_id to track the entire request.
Get status
/sms/{reference_id}
/blast/{reference_id}
/bulk/{reference_id}
Replace {reference_id} with the returned message.reference_id. All three paths return the same status format; they are aliases. Only your account’s requests can be read.
curl 'https://blockoutmediaph.com/api/sms/msg_example' \
-u 'YOUR_API_KEY:'
The response is the Send SMS envelope with updated status, counts, timestamps and row states. credits_reserved is the original reservation; credits_refunded tracks credits restored.
| Status | Meaning |
|---|---|
awaiting_review | Waiting for staff approval. |
queued | Accepted for sending. |
processing | Sending is in progress. |
sent | All recipients handed off to the mobile network. |
needs_review | Partial, failed or uncertain sends need staff review. |
failed | Submission failed before an accepted gateway batch. |
rejected | Rejected by staff. |
refunded | Credits restored by the refund workflow. |
Sent is network handoff, not confirmed recipient delivery or a read receipt. An individual row can show unknown when its outcome needs review.
/account
Account & credits
Check active package credits and expiry before submitting.
{
"status": "active",
"sms_credits": 100,
"sender": "default",
"limits": {"recipients": 1000, "segments": 2000},
"packages": [{
"code": "starter",
"expires_at": "2027-01-14T00:00:00+00:00",
"credits_remaining": 100
}]
}
sms_credits is the available balance across active packages. One complete message uses one credit per recipient, up to 1,000 characters, including long and Unicode text. Manual Split into 2 uses two credits per recipient. Internal network segments do not add BlockOut credits. For On the Go packages, expires_at is null because credits have no expiry.
Responses & limits
Every POST requires JSON and an Idempotency-Key of 8–128 letters, numbers, dots, underscores, colons or dashes. An identical retry returns 200 and the same reference without a second debit; different content under the same key returns 409.
| Code | Meaning |
|---|---|
| 200 | Status/account read or identical submission retry. |
| 201 | New request created. |
| 401 | Missing, invalid or revoked key. |
| 402 | Insufficient active prepaid credits. |
| 403 | Key scope or account access denied. |
| 404 | Unknown reference or request belongs to another account. |
| 409 | Idempotency conflict or account/credits changed. |
| 413 | Body exceeds 16 MiB or length is unknown. |
| 415 | Content-Type must be application/json. |
| 422 | Invalid payload or missing consent/idempotency key. |
| 429 | Rate limit or account queue limit reached. Follow Retry-After. |
| 503 | Global queue is full. |
Error format
{"error":{"message":"Invalid or revoked SMS API key","status":401}}
Rate limits
- 120 requests per minute per API key.
- 60 new submissions per minute per account.
- At least two seconds between new blast/bulk submissions.
- Up to 1,000 recipients and 1,000 characters per message. Manual Split into 2 creates two outgoing messages per recipient.
HTTP/1.1 429 Too Many Requests
Retry-After: 60
Credits are reserved atomically before queueing. A definite pre-submission failure restores credits. Uncertain or partial sends require review; never resubmit with a new key merely because a status request failed.
Webhooks
Receive status updates on your own server instead of polling.
Your webhook URL
In SMS → API & webhooks, save your public HTTPS callback, such as https://your-site.com/sms-events. This is your receiving URL, separate from BlockOut’s API Base URL. It must accept POST on port 443; internal addresses and redirects are blocked.
The workspace displays your webhook signing secret once. Saving again rotates it.
Events
Events use message.{status}, for example message.queued, message.processing, message.sent, message.needs_review, message.failed, message.rejected and message.refunded. Gateway retry attempts are not a separate message.retrying webhook.
Request headers
Content-Type: application/json
X-BlockOut-Event: evt_example
X-BlockOut-Timestamp: 1791936000
X-BlockOut-Signature: sha256=SIGNATURE
Example payload
{
"id": "evt_example",
"event": "message.sent",
"created_at": "2026-10-14T00:00:00+00:00",
"message": {
"reference_id": "msg_example",
"status": "sent",
"recipient_count": 1,
"segments": 1,
"credits_reserved": 1,
"credits_refunded": 0,
"created_at": "2026-10-14T00:00:00+00:00",
"updated_at": "2026-10-14T00:00:00+00:00",
"counts": {"sent": 1},
"metadata": {"order_id": "12345"},
"delivery_confirmed": false
}
}
Webhook payloads omit recipient numbers and message text. Events can arrive more than once, with up to eight delivery attempts.
Verify the signature
HMAC-SHA256(secret, timestamp + "." + raw_request_body)Compare with X-BlockOut-Signature using a constant-time comparison. Accept a timestamp within five minutes and deduplicate by event ID. The timestamp changes for each delivery attempt. Return 2xx after durably saving the event. The secret itself is never sent as a header.
Sample code
These examples use Basic authentication. Replace placeholders on your server; no SDK is required.
Node.js · built-in fetch
const response = await fetch('https://blockoutmediaph.com/api/sms', {
method: 'POST',
headers: {
Authorization: 'Basic ' + Buffer.from(process.env.BLOCKOUT_API_KEY + ':').toString('base64'),
'Content-Type': 'application/json',
'Idempotency-Key': 'order-123-v1'
},
body: JSON.stringify({
recipient: '+639171234567', content: 'Your order is ready.', consent: true
})
});
console.log(response.status, await response.json());Python · requests
import os
import requests
response = requests.post(
'https://blockoutmediaph.com/api/sms',
auth=(os.environ['BLOCKOUT_API_KEY'], ''),
headers={'Idempotency-Key': 'order-123-v1'},
json={'recipient': '+639171234567', 'content': 'Your order is ready.', 'consent': True},
timeout=20,
)
print(response.status_code, response.json())PHP · cURL
<?php
$ch = curl_init('https://blockoutmediaph.com/api/sms');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 20,
CURLOPT_USERPWD => getenv('BLOCKOUT_API_KEY') . ':',
CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Idempotency-Key: order-123-v1'],
CURLOPT_POSTFIELDS => json_encode([
'recipient' => '+639171234567', 'content' => 'Your order is ready.', 'consent' => true
]),
]);
$result = curl_exec($ch);
if ($result === false) { throw new RuntimeException(curl_error($ch)); }
echo $result;
curl_close($ch);