Introducing the /account/usage API endpoint


#1

As part of an effort to make DataSift’s Stream platform billing and usage more transparent, we have introduced a new billing API endpoint; /account/usage.

This endpoint exposes aggregated details about the number of interactions or DPUs consumed for given sources, and the real dollar cost associated with that usage, over an hourly, daily or monthly period, looking back as far as October 1st, 2015.

For example, I want to take a look at my usage from last quarter on a monthly basis:

$ curl -X GET 'https://api.datasift.com/v1.3/account/usage?period=monthly&start=1467331200&end=1475280000' -H 'Auth: USERNAME:API_KEY'
{
  "usage": [
    {
      "quantity": 331.23701,
      "cost": 0,
      "category": "realtime",
      "unit": "dpu",
      "source": "",
      "timestamp": 1467331200
    },
    {
      "quantity": 45.6331,
      "cost": 0,
      "category": "managed_sources",
      "unit": "dpu",
      "source": "instagram",
      "timestamp": 1467331200
    },
    {
      "quantity": 122.86374,
      "cost": 0,
      "category": "realtime",
      "unit": "dpu",
      "source": "",
      "timestamp": 1470009600
    },
    {
      "quantity": 225.46624,
      "cost": 0,
      "category": "managed_sources",
      "unit": "dpu",
      "source": "instagram",
      "timestamp": 1470009600
    },
    {
      "quantity": 364.17849,
      "cost": 0,
      "category": "realtime",
      "unit": "dpu",
      "source": "",
      "timestamp": 1472688000
    },
    {
      "quantity": 2792.78618,
      "cost": 158.56,
      "category": "managed_sources",
      "unit": "dpu",
      "source": "instagram",
      "timestamp": 1472688000
    }
  ]
}

We can see here that each month I’ve consumed Instagram Managed Sources, and realtime DPUs (the cost of running my Push subscriptions). The cost in most cases is zero, apart from during September, where my Managed Sources usage slightly exceeded my platform allowance, and was charged DPU overages.

Full documentation is available on the /account/usage API endpoint documentation page. Usage of this endpoint is supported in the latest versions of all our official client libraries.