POST
/
cloud
/
v1
/
usage_report
Get usage statistics report
curl --request POST \
  --url https://api.gcore.com/cloud/v1/usage_report \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "limit": 50,
  "offset": 0,
  "projects": [
    16,
    17,
    18,
    19,
    20
  ],
  "regions": [
    4,
    5
  ],
  "schema_filter": {
    "field": "flavor",
    "type": "instance",
    "values": [
      "g1-standard-1-2"
    ]
  },
  "sorting": [
    {
      "project": "desc"
    }
  ],
  "tags": {
    "condition_type": "OR",
    "conditions": [
      {
        "key": "os_version",
        "strict": true,
        "value": "22.04"
      },
      {
        "key": "os_version",
        "strict": true,
        "value": "23.04"
      }
    ]
  },
  "time_from": "2019-08-01T00:00:00",
  "time_to": "2019-09-15T00:00:00",
  "types": [
    "egress_traffic",
    "instance"
  ]
}'
{
  "count": 1,
  "resources": [
    {
      "billing_metric_name": "bm3-ai-1xlarge-h100-80-8_min",
      "billing_value": 1000,
      "billing_value_unit": "minutes",
      "first_seen": "2024-07-01T00:00:30Z",
      "flavor": "bm3-ai-1xlarge-h100-80-8",
      "last_name": "ai_cluster_name",
      "last_seen": "2024-07-30T23:59:30Z",
      "project_id": 10,
      "region": 76,
      "region_id": 76,
      "tags": [
        {
          "os_distro": "ubuntu"
        },
        {
          "os_version": "22.04"
        }
      ],
      "type": "<string>",
      "uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    }
  ],
  "totals": [
    {
      "billing_metric_name": "bm3-ai-1xlarge-h100-80-8_min",
      "billing_value": 1000,
      "billing_value_unit": "minutes",
      "flavor": "bm3-ai-1xlarge-h100-80-8",
      "region": 76,
      "region_id": 76,
      "type": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Body

application/json
time_from
string<date-time>
required

The start date of the report period (ISO 8601). The report starts from the beginning of this day.

Examples:

"2023-01-01T00:00:00Z"

time_to
string<date-time>
required

The end date of the report period (ISO 8601). The report ends just before the beginning of this day.

Examples:

"2023-02-01T00:00:00Z"

enable_last_day
boolean
default:false

Expenses for the last specified day are taken into account. As the default, False.

Examples:

false

limit
integer
default:10

The response resources limit. Defaults to 10.

Required range: x > 0
Examples:

10

offset
integer
default:0

The response resources offset.

Required range: x >= 0
Examples:

0

projects
integer[] | null

List of project IDs

Examples:
[16, 17, 18, 19, 20]
regions
integer[]

List of region IDs.

Examples:
[1, 2, 3]
schema_filter
object

Extended filter for field filtering.

Examples:
{
"field": "flavor",
"type": "instance",
"values": ["g1-standard-1-2"]
}
sorting
UsageReportSortingRequestSerializer · object[]

List of sorting filters (JSON objects) fields: project. directions: asc, desc.

tags
object

Filter by tags

types
enum<string>[]

List of resource types to be filtered in the report.

Examples:
["egress_traffic", "instance"]

Response

200 - application/json

OK

count
integer
required

Total count of the resources

Required range: x >= 0
Examples:

1

resources
Resources · array
required
totals
Totals · array
required