Sending Statistics

This request is used to retrieve sending statistics over a specific period. It returns the number of SMS sent and the associated cost.

URL

GET https://api.smspartner.fr/v1/statistics/cost-resume?apiKey=API_KEY&interval=custom&from=21-10-2022&to=21-10-2022

Limit of 5 requests per minute.

Required Parameters

Name
Value

interval

  • last_month → Previous month

  • last_twelve_months → Last 12 months

  • custom → Add &from=DD-MM-YYYY&to=DD-MM-YYYY for custom date range

Requests

<?php
$apiKey = 'YOUR_API_KEY';
$url = 'https://api.smspartner.fr/v1/statistics/cost-resume?apiKey=' . $apiKey . '&interval=last_twelve_months'; 

// Initialise cURL session
$ch = curl_init($url);

// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute cURL session and fetch the result
$response = curl_exec($ch);

// Handle errors
if (curl_errno($ch)) {
    echo 'Erreur: ' . curl_error($ch);
} else {
    // Decode the result
    $data = json_decode($response, true);
    print_r($data);
}

// Close cURL session
curl_close($ch);
?>

Response

{
    "success": true,
    "datas": [
        {
            "month": "october",
            "year": "2021",
            "m": "10",
            "date": 1633039200,
            "type": "month",
            "cost": "49.174",
            "nb_send": "1210"
        },
        {
            "month": "november",
            "year": "2021",
            "m": "11",
            "date": 1635721200,
            "type": "month",
            "cost": "67.674",
            "nb_send": "1409"
        }
    ]
}

Last updated