Get User Billing Statistics

To view billing statistics for a particular user, use the following method:

GET /users/:user_id/vm_stats.xml
GET /users/:user_id/vm_stats.json

To get a shorter statistics output, add an id parameter in the URL:

GET /users/:user_id/vm_stats/:vm_stats_id.xml
GET /users/:user_id/vm_stats/:vm_stats_id.json


If the account was created less than three months ago, the statistics are generated for the entire period of operation of the account. You can also define a shorter period by setting Start and End time in the API call:

GET /users/:user_id/vm_stats.xml?period[startdate]=YYYY-MM-DD+hh%3Amm%3Ass&period[enddate]=YYYY-MM-DD+hh%3Amm%3Ass
GET /users/:user_id/vm_stats.json?period[startdate]=YYYY-MM-DD+hh%3Amm%3Ass&period[enddate]=YYYY-MM-DD+hh%3Amm%3Ass



XML Output example

<vm_stats type="array">
    <vm_hourly_stat>
        <created_at type="datetime">2013-05-01T00:00:28Z</created_at>
        <currency_code>USD</currency_code>
        <id type="integer">13888</id>
        <stat_time type="datetime">2013-05-01T00:00:00Z</stat_time>
        <updated_at type="datetime">2013-05-01T00:00:28Z</updated_at>
        <user_id type="integer">239</user_id>
        <virtual_machine_id nil="true"/>
        <vm_billing_stat_id type="integer">7246</vm_billing_stat_id>
        <total_cost type="float">0.0</total_cost>
        <vm_resources_cost type="float">0.0</vm_resources_cost>
        <usage_cost type="float">0.0</usage_cost>
    </vm_hourly_stat>
    <vm_hourly_stat>
        <created_at type="datetime">2013-05-01T01:00:27Z</created_at>
        <currency_code>USD</currency_code>
        <id type="integer">13937</id>
        <stat_time type="datetime">2013-05-01T01:00:00Z</stat_time>
        <updated_at type="datetime">2013-05-01T01:00:27Z</updated_at>
        <user_id type="integer">239</user_id>
        <virtual_machine_id nil="true"/>
        <vm_billing_stat_id type="integer">7246</vm_billing_stat_id>
        <total_cost type="float">0.0</total_cost>
        <vm_resources_cost type="float">0.0</vm_resources_cost>
        <usage_cost type="float">0.0</usage_cost>
    </vm_hourly_stat>
<vm_stats type="array">

Where:

created_at – the timestamp in DB when this record was created

updated_at – the time stamp in DB when this record was updated

currency_code - currency in which this virtual server is charged within the bucket

id – the ID of the server hourly statistics. You can add this parameter to the request URL to get a shorter statistics output.

stat_time – the particular hour for which these statistics were generated

user_id - the ID of VS owner

virtual_machine_id - ID of a virtual server

virtual_machine_billing_statistics_id -ID of a virtual server billing statistics

billing_stats - an array of billing details for the resources used by this VS:


The generated billing statistics will show the billing details for all virtual servers, load balancers,  edge servers and storage servers owned by this particular user. For the output examples and the explanation of the fields returned, refer to corresponding sections: