Getting Started
Before you begin, please make sure you already have a Ducksms API Token, or .
Using your Ducksms API TOKEN
, available from the page, you can now send an SMS message using the available API Methods with a simple code.
Example using codes below to get a credit balance:
curl --request GET
--url https://ducksms.com/api/v1/credits/balance
--header 'Authorization: Bearer {API TOKEN}'
--header 'Content-Type: application/json'
--header 'accept: application/json'
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://ducksms.com/api/v1/credits/balance', [
'headers' => [
'accept' => 'application/json',
'content-type' => 'application/x-www-form-urlencoded',
'Authorization' => 'Bearer {API TOKEN}'
],
]);
echo $response->getBody();
const request = require('request');
request({
url: 'https://ducksms.com/api/v1/credits/balance',
headers: {
'accept': 'application/json',
'content-type': 'application/x-www-form-urlencoded',
'Authorization': 'Bearer {API TOKEN}'
},
rejectUnauthorized: false
}, function(err, res) {
if(err) {
console.error(err);
} else {
console.log(res.body);
}
});
import requests
url = "https://ducksms.com/api/v1/credits/balance"
payload = "api_key=xxx"
headers = {
"accept": "application/json",
"content-type": "application/x-www-form-urlencoded",
"Authorization": "Bearer {API TOKEN}"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://ducksms.com/api/v1/credits/balance")
.post(body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/x-www-form-urlencoded")
.addHeader("Authorization", "Bearer {API_TOKEN}")
.build()
Response response = client.newCall(request).execute();