Belangrijke tip:
We raden aan om onze POSTMAN-voorbeelden te gebruiken om te beginnen met programmeren.
1
Download onze postman-collectie om te beginnen met programmeren (download POSTMAN),
we hebben codevoorbeelden beschikbaar voor al onze API's.
https://api.smsbox.eu/v<VERSION>/<API>
https://bapi.smsbox.eu/v<VERSION>/<API>
Verifieer uzelf met uw applicatie-ID en applicatiegeheim.
Onze API's zijn geauthenticeerd met oAUTH2.0-verificatie.
v<VERSION>/AUTH
# | JSON Parameter | Values | Type | Example |
---|---|---|---|---|
1 | type | access_token / refresh_token | string | access_token |
2 | application_id | string | 123-456-789-123-456-789 | |
3 | application_secret | string | 12345678901234567890 |
Krijg uw rekeningsaldo en applicatielijst.
v<VERSION>/account/profile
# | HEADER Parameter | Values | Type | Example |
---|---|---|---|---|
1 | authorization | bearer token | string | bearer df545dfsf54dsfqdsqdfkdfq7qds87t7j78b7zahgjy4y54hggfsg |
Verstuur tekst berichten
v<VERSION>/message/sms/send
# | HEADER Parameter | Values | Type | Example |
---|---|---|---|---|
1 | authorization | bearer token | string | bearer df545dfsf54dsfqdsqdfkdfq7qds87t7j78b7zahgjy4y54hggfsg |
# | JSON Parameter | Values | Type | Example |
---|---|---|---|---|
1 | to | mobile number in international format | string | 32498765432 |
2 | body | text message | string | Hi, this is my first message. |
3 | from | recipient | string | default: smsbox.eu |
4 | client_reference (optional) | 13245 | string | Your own reference |
5 | delivery_report (optional) | true/false | string | set true to receive delivery reports |
5 | max_message_parts (optional) | 1-6 | integer | set maximum message parts. If the message length if longer, the message will be refused. |
We raden aan om onze POSTMAN-voorbeelden te gebruiken om te beginnen met programmeren.
<?php
$data = array(
"type"=> "refresh_token",
"application_id"=> "",
"application_secret"=> ""
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, "https://api.smsbox.eu/v1/auth");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_FORBID_REUSE, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_HEADER, 1); // Set to 0 to remove the headers from response
$response = curl_exec($ch);
return $response;
?>
<?php
$headers = array(
"authorization: bearer f2qv234f54f54f4vqfe8f8eyuyiuo7u8jh5f4he",
"Content-Type: application/json"
);
$data = array(
"to"=> "32498765432",
"body"=> "Hi, this is a test message.",
"from"=> "testfrom",
"client_reference"=> "123",
"delivery_report" true
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, "https://api.smsbox.eu/v1/message/sms/send");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_FORBID_REUSE, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_HEADER, 1); // Set to 0 to remove the headers from response
$response = curl_exec($ch);
return $response;
?>
response Authorization (JSON)
{
"status_code": 201,
"status_message": "Authenticated",
"payload": {
"refresh_token": "089a78787887d8b52274c8e38b9bcadfq5d0284b2jkdqfkjqdkdeaf85d7d",
"access_token": "2b524dbe5ddce95bjqfdkmjqfjdie8d85s5d8ds5f784e082d09aa343f82358",
"validity_period": 3600
},
"datetime": "2023-01-30 13:14:03"
}
response Send Message (JSON)
{
"status_code": 201,
"status_message": "Created",
"payload": {
"current_balance": -18.72,
"messages": [
{
"message_id": "9ssd4de55-d8825-13ed-d78a-4e1742ad4d5e819",
"application_id": "82d4b2sfd-709e-1eee-9785-4e1742a5d8d519",
"to": "32498765432",
"cost": 0.065,
"country": "BE",
"network_code": 206,
"message": "hi, this is my first message.",
"client_reference": "123",
"message_len": 29,
"message_parts": 1,
"charset": "GSM7",
"delivery_report": 1,
"test": false,
"max_message_parts": 1
}
]
},
"datetime": "2023-01-30 13:14:18",
"request_id": "9ef4d695-d8857-kked-a145-4e1742a772225"
}