Is it possible to view cost of bandwidth for each domain?


#1

Is it possible to view cost of bandwidth for each domain using the billing api?


#2

You can only see a billing breakdown per domain if you have 1 domain per service.
This post outlines how you can so that: Is there a way to view billing by services?


#3

HI Justin thanks for your reply, what I’m actually looking for is a way get the total bandwidth of a service per month and then to use that to work out the cost per service.


#4

See https://docs.fastly.com/api/account#billing_bd3ea2cbea58ddbb82bbde0c1981fd8b. It splits out the bandwidth and requests per service. Here’s the relevant part of the example response:

  "services": {
      "2LrVBc3muQ92X2a0ZT083Z": {
          "asia": {
              "bandwidth": 0.0,
              "requests": 0.0,
              "ssl_requests": 0.0
          },
          "australia": {
              "bandwidth": 0.0,
              "requests": 0.0,
              "ssl_requests": 0.0
          },
          "europe": {
              "bandwidth": 5.448237061500549e-06,
              "requests": 6.0,
              "ssl_requests": 0.0
          },
          "latam": {
              "bandwidth": 0.0,
              "requests": 0.0,
              "ssl_requests": 0.0
          },
          "name": "Example Service Name",
          "usa": {
              "bandwidth": 4.7101639211177826e-05,
              "requests": 52.0,
              "ssl_requests": 0.0
          }
      },
  },