Get campaigns

This method allows you to recover your consumption and that of your sub-accounts.

GET

/metrics/consumption

GET Parameters

date_start Add a filter to retrieve consumption of which send date is after this date. Date format must be as follow: Y-m-d
date_end Add a filter to retrieve consumption of which send date is before this date. Date format must be as follow: Y-m-d
country Add a filter to retrieve your consumption for specific country. You can retrieve the consumption for multiple countries separated by a comma. Countries must be provided in alpha2 format. country=FR,CH
sub_account_id Add a filter to retrieve the consumption of a specific sub account.

Examples


GET /metrics/consumption HTTP/1.1
Host: api.smsup.ch
Accept: application/json
Authorization: Bearer your.token
      
    

Result Format


{
    "status": 1,
    "message": "OK",
    "data": {
        "total": 100,
        "by_country": {
            "FR": 50,
            "CH": 30,
            "IT": 20,
        },
        "my_account": {
            "account_id": 1,
            "company": "My company",
            "conso": {
                "total": 80,
                "by_country": {
                    "FR": 50,
                    "CH": 30,
                }
            }
        },
        "by_sub_accounts": [
            {
                "account_id": 2,
                "company": "My sub account company",
                "conso": {
                    "total": 20,
                    "by_country": [
                        "IT" : 20
                    ]
                }
            }
        ]
    }
}
          
        

<?xml version="1.0" encoding="UTF-8" ?>
<response>
  <status>1</status>
  <message>OK</message>
  <data>
    <total>100</total>
    <by_country>
        <FR>50</FR>
        <CH>30</CH>
        <IT>20</IT>
    </by_country>
    <my_account>
        <account_id>1</account_id>
        <company>My company</company>
        <conso>
            <total>80</total>
            <by_country>
                <FR>50</FR>
                <CH>30</CH>
            </by_country>
        </conso>
    </my_account>
    <by_sub_accounts>
        <account_id>2</account_id>
        <company>My sub account company</company>
        <conso>
            <total>20</total>
            <by_country>
                <IT>20</IT>
            </by_country>
        </conso>
    </by_sub_accounts>
  </data>
</response>