Usage Statistics¶
The UsageStatistic resource¶
Key path
Description
type* (string)
Available values:usage-statistics
id (string)
attributes.breakdown-id (string)
The identifier of a resource by which the usage is broken down
attributes.breakdown-name (string)
The name of a resource by which the usage is broken down
attributes.date (string)
The date when usage has been recorded
attributes.runs-count (integer)
The count of runs finished within the date
attributes.runs-seconds (integer)
The duration of runs in seconds within the date
relationships.account (object)
The account id usage is reported for
relationships.account.data.type* (string)
Available values:accounts
relationships.account.data.id* (string)
links (object)
List Scalr Usage Statistics¶
-
GET
/api/iacp/v3/usage-statistics
¶ This endpoint returns billing usage statistics for an account within a period of time.
Required permission: accounts:billing
- Query Parameters
filter[date] (string) – The date filter. Example:
filter[date]=between:2022-01-01T00:00:00Z,2022-02-01T00:00:00Z
(Required)filter[account] (string) – The account filter. Example:
filter[account]=acc-ttpu7uslju6igv8
(Required)breakdown_by (string) – Breakdown by environment or workspace. Examples:
breakdown_by=environment
orbreakdown_by=workspace
Example Request:
GET /api/iacp/v3/usage-statistics?filter%5Bdate%5D=string&filter%5Baccount%5D=string HTTP/1.1 Host: my.scalr.io Prefer: profile=preview
- Status Codes
200 OK –
Success.
Example Respone:
HTTP/1.1 200 OK Content-Type: application/vnd.api+json Preference-Applied: profile=preview { "data": [ { "attributes": { "breakdown-id": null, "breakdown-name": null, "date": "2022-01-06", "runs-count": 4, "runs-seconds": 82 }, "id": "0209139b4a4f7068241f79e13e362a2bac0638aefc1fb2ea3caa136d0d47dca1", "links": null, "relationships": { "account": { "data": { "id": "acc-ttpu7uslju6igv8", "type": "accounts" } } }, "type": "usage-statistics" } ], "included": null, "links": { "first": "https://my.scalr.io/api/iacp/v3/usage-statistics?filter%5Bdate%5D=between%3A2022-01-01T00%3A00%3A00Z%2C2022-02-01T00%3A00%3A00Z&filter%5Baccount%5D=acc-abcdef&page%5Bnumber%5D=1&page%5Bsize%5D=20", "last": "https://my.scalr.io/api/iacp/v3/usage-statistics?filter%5Bdate%5D=between%3A2022-01-01T00%3A00%3A00Z%2C2022-02-01T00%3A00%3A00Z&filter%5Baccount%5D=acc-abcdef&page%5Bnumber%5D=1&page%5Bsize%5D=20", "next": null, "prev": null, "self": "https://my.scalr.io/api/iacp/v3/usage-statistics?filter%5Bdate%5D=between%3A2022-01-01T00%3A00%3A00Z%2C2022-02-01T00%3A00%3A00Z&filter%5Baccount%5D=acc-abcdef&page%5Bnumber%5D=1&page%5Bsize%5D=20" }, "meta": { "pagination": { "current-page": 1, "next-page": null, "prev-page": null, "total-count": 0, "total-pages": 1 } } }
403 Forbidden – User unauthorized to perform the action.
404 Not Found – Account or environment not found.
4XX – Client error.
5XX – Server error.