Costs

Returns costs data per CDN zone for the selected period. 

Endpoint

https://www.pushrcdn.com/api/v3/zones/costs

Methods

POST

Parameters

ParameterTypeValuesDescription
zone_idinteger CDN zone id
startint, optional Start time, in Unix epoch format
endint, optional End time, in Unix epoch format

Note:  When start and end timestamps are omitted, all available data is being returned. When only start timestamp is provided, the returned values are the costs from the start timestamp to the last available record.

Headers

FieldTypeDescription
APIKEYstringYour account API key

Example - Get costs for specific period

Get aggregate data for CDN zone with ID 127642

curl -d "zone_id=127642" \
-d "start=1637385300" \
-d "end=1641230105" \
-H "Accept: application/json" \
-H "APIKEY: c45ed960ac1c3d12c1d570a869df8c9c473055stgr" \
-X POST "https://www.pushrcdn.com/api/v3/zones/costs"

Response

The costs JSON object is returned:

{
    "costs": [
        {
            "zone_id": "127642",
            "service_name": "Traffic Usage [Balanced Network]",
            "total_quantity": "81.38",
            "total_cost": "0.813800000"
        },
        {
            "zone_id": "127642",
            "service_name": "Traffic Usage [Extended Network]",
            "total_quantity": "0.04",
            "total_cost": "0.001600000"
        }
    ]
}

• service_name is the item accounted for. 

• total_quantity is the unit of accounting. For traffic and storage services, this unit is Gigabytes. For live streams, this unit represents the number of billed stream hours.

• total_cost is the sum of the costs for the item.

The cost of the entire CDN zone is equal to the sum of the total_cost of all services.