Autoryzacja
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Endpointy (v2)
POST /api/v2/messages/send.phpGET /api/v2/messages/pending.php?limit=50POST /api/v2/messages/status.phpGET /api/v2/messages/get.php?id=123GET /api/v2/messages/get.php?external_id=ABC-123GET /api/v2/sender-id.phpPOST /api/v2/sender-id/update.phpGET /api/v2/auth.phpPrzykład: wysłanie SMS (v2)
POST /api/v2/messages/send.php
{
"to": "+48123456789",
"text": "Potwierdzenie wizyty o 14:30",
"sender": "client",
"external_id": "EXT-2026-001",
"message_prefix": ""
}
Authorization: Bearer YOUR_API_KEY Content-Type: application/json
{
"success": true,
"data": { }
}
{
"success": false,
"error": {
"code": "...",
"message": "...",
"details": { }
}
}
/api/v2/auth.php
/api/v2/account/balance.php
/api/v2/messages/send.php
/api/v2/messages/pending.php?limit=50
/api/v2/messages/status.php
/api/v2/messages/get.php?id=123
/api/v2/messages/get.php?external_id=ABC-123
/api/v2/sender-id.php
/api/v2/sender-id/update.php
/api/v2/api-keys/mark-scanned.php
/api/v2/api-keys/check-scanned.php
/api/v2/subscription/status.php
/api/v2/messages/send.php{
"to": "+48123456789",
"text": "Potwierdzenie wizyty o 14:30",
"sender": "client",
"external_id": "EXT-2026-001",
"message_prefix": ""
}
API_KEY w nagłówku Authorization<?php
$url = '/api/v2/messages/send.php';
$payload = [
'to' => '+48123456789',
'text' => 'Potwierdzenie wizyty o 14:30',
'sender' => 'client',
'external_id' => 'EXT-2026-001',
'message_prefix' => ''
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer YOUR_API_KEY'
],
CURLOPT_POSTFIELDS => json_encode($payload)
]);
$res = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "HTTP $code\n";
echo $res;
curl -X POST '/api/v2/messages/send.php' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"to":"+48123456789","text":"Potwierdzenie wizyty o 14:30","sender":"client","external_id":"EXT-2026-001","message_prefix":""}'
{
"to": "+48123456789",
"text": "Potwierdzenie wizyty o 14:30",
"sender": "client",
"external_id": "EXT-2026-001",
"message_prefix": ""
}
import requests
url = '/api/v2/messages/send.php'
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
payload = {
'to': '+48123456789',
'text': 'Potwierdzenie wizyty o 14:30',
'sender': 'client',
'external_id': 'EXT-2026-001',
'message_prefix': ''
}
r = requests.post(url, headers=headers, json=payload, timeout=30)
print(r.status_code)
print(r.text)
// Kotlin + OkHttp
val url = "/api/v2/messages/send.php"
val json = """{
\"to\": \"+48123456789\",
\"text\": \"Potwierdzenie wizyty o 14:30\",
\"sender\": \"client\",
\"external_id\": \"EXT-2026-001\",
\"message_prefix\": \"\"
}"""
val client = okhttp3.OkHttpClient()
val body = okhttp3.RequestBody.create(
"application/json; charset=utf-8".toMediaType(),
json
)
val request = okhttp3.Request.Builder()
.url(url)
.addHeader("Authorization", "Bearer YOUR_API_KEY")
.post(body)
.build()
client.newCall(request).enqueue(object : okhttp3.Callback {
override fun onFailure(call: okhttp3.Call, e: java.io.IOException) {
e.printStackTrace()
}
override fun onResponse(call: okhttp3.Call, response: okhttp3.Response) {
println(response.code)
println(response.body?.string())
}
})
/api/v2/messages/pending.php?limit=50{
"success": true,
"data": {
"count": 1,
"messages": [
{
"id": 1,
"target_phone": "+48123456789",
"message_text": "Wiadomość",
"external_id": "EXT-2025-001",
"status": "queued"
}
]
}
}
/api/v2/messages/status.php{
"message_id": 12345,
"status": "sms_sent",
"sender_id": "Sendit-ABCDEF12",
"details": {
"device": "android",
"error": null
}
}
/api/v2/messages/pending.php,
sprawdź czy w tabeli sms_messages istnieją kolumny: lease_until, attempts, last_error.