# Data usage service API

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdeveloper-portal%2Fapis%2Fdata-management%2Fdata-usage-service-api.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdeveloper-portal%2Fapis%2Fdata-management%2Fdata-usage-service-api.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[API reference](https://docs-docusaurus.kinsta.page/api-reference/v5/data-usage-service/.md)

Coralogix provides an API in support of our [Detailed Data Usage Report](https://docs-docusaurus.kinsta.page/user-guides/account-management/payment-and-billing/data-usage/.md), which presents you with all data sent, per policy, for either the current month or retroactively 30 or 90 days. The API allows you to query your data consumption in given a time period.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

* To use this API you need to [create](https://docs-docusaurus.kinsta.page/user-guides/account-management/api-keys/api-keys/.md) a personal or team API key. It’s recommended to use permission presets, as they are automatically updated with all relevant permissions. Alternatively, you can manually add individual permissions.

| Preset    | Action                                                         | Description                                                      |
| --------- | -------------------------------------------------------------- | ---------------------------------------------------------------- |
| DataUsage | data-usage<!-- -->:Read<!-- --><br />data-usage<!-- -->:Manage | Manage Team Data Usage Metrics<br />View Team Data Usage Metrics |

* Choose the
  <!-- -->
  api.:443
  <!-- -->
  endpoint that corresponds to your Coralogix [domain](https://docs-docusaurus.kinsta.page/user-guides/account-management/account-settings/coralogix-domain/.md) using the domain selector at the top of the page.

## Fetch detailed data usage group by Application and Subsystem name[​](#fetch-detailed-data-usage-group-by-application-and-subsystem-name "Direct link to Fetch detailed data usage group by Application and Subsystem name")

```
grpcurl -H "Authorization: Bearer <cx_api_key>" -d @ api.eu2.coralogix.com:443 com.coralogix.datausage.v2.DataUsageService/GetTeamDetailedDataUsage <<EOF

{

  "resolution": "6h",

  "date_range": {

    "from_date": "2023-03-20T01:30:15.01Z",

	  "to_date": "2023-03-21T01:30:15.01Z"

  }

}

EOF
```

### Request args[​](#request-args "Direct link to Request args")

| Field      | Description                                                                                                                                                                                                                                                                  |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Resolution | Describes the precision by which to group your data. In this example, the response contains the data usage per [Application and Subsystem](https://docs-docusaurus.kinsta.page/user-guides/account-management/account-settings/application-and-subsystem-names/.md) every 6h |
| Team Id    | ID of the team you are seeking                                                                                                                                                                                                                                               |
| Date Range | Date range of the requested data in ISO 8601 format                                                                                                                                                                                                                          |

### Response[​](#response "Direct link to Response")

The response will be a list of data, such as the following:

```
[{

  "timestamp": "2023-03-20T16:00:00Z",

  "sizeGb": 0.000011989847,

  "units": 0.000004795939,

  "dimensions": [

    {

      "tier": "TCO_TIER_HIGH"

    },

    {

      "genericDimension": {

        "key": "subsystem_name",

        "value": "vzmgr-server"

      }

    },

    {

      "pillar": "PILLAR_LOGS"

    },

    {

      "severity": "SEVERITY_CRITICAL"

    },

    {

      "genericDimension": {

        "key": "application_name",

        "value": "staging"

      }

    }

  ]

}]
```

| Field     | Description                                       | Field            | Description                                                                                                                                                     |
| --------- | ------------------------------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| timestamp | Date of the sample                                |                  |                                                                                                                                                                 |
| sizeGb    | Size in GB of the processed data                  |                  |                                                                                                                                                                 |
| units     | Amount in units                                   |                  |                                                                                                                                                                 |
| dimension | List of dimensions by which data has been grouped | genericDimension | Generic label of the data. Example: application\_name and subsystem\_name.                                                                                      |
|           |                                                   | tier             | Data priority label: TCO\_TIER\_HIGH, TCO\_TIER\_MEDIUM, TCO\_TIER\_LOW, TCO\_TIER\_BLOCKED                                                                     |
|           |                                                   | pillar           | Pillar information: PILLAR\_LOGS, PILLAR\_METRICS, PILLAR\_SPANS                                                                                                |
|           |                                                   | severity         | Severity just for PILLAR\_LOGS: SEVERITY\_UNSPECIFIED, SEVERITY\_DEBUG, SEVERITY\_VERBOSE, SEVERITY\_INFO, SEVERITY\_WARNING,SEVERITY\_ERROR,SEVERITY\_CRITICAL |

## Additional resources[​](#additional-resources "Direct link to Additional resources")

|                     |                                                                                                                     |
| ------------------- | ------------------------------------------------------------------------------------------------------------------- |
| Data Usage          | [Data Usage](https://docs-docusaurus.kinsta.page/user-guides/account-management/payment-and-billing/data-usage/.md) |
| Coralogix Endpoints | [Coralogix Endpoints](https://docs-docusaurus.kinsta.page/integrations/coralogix-endpoints/.md)                     |
