---
title: Retrieve account metrics
url: https://developers.wpengine.com/docs/managed-hosting-platform/api/reference/operations/getaccountusagemetrics/
image: https://developers.wpengine.com/og/docs/managed-hosting-platform/api/reference/operations/getaccountusagemetrics.png
---

# Retrieve account metrics

GET

/accounts/{account_id}/usage

Select code sample

```sh
curl --request GET \
  --url 'https://api.wpengineapi.com/v1/accounts/eeda3227-9a39-46ae-9e14-20958bb4e6c9/usage?limit=100' \
  --header 'Authorization: Basic <credentials>'
```

-

Returns usage metrics for all environments in an account. Results are paginated using `limit` and `offset`, where `offset` is the `next_page_token` from the previous response.

## Limitations & Warnings

- If `first_date` and `last_date` are omitted, the response covers the last 30 days.
- `first_date` and `last_date` must be provided together, and `first_date` cannot be older than 13 months.

## Authorizations

- **[basicAuth](https://developers.wpengine.com/docs/managed-hosting-platform/api/reference/#basicauth)**

## Parameters

### Path Parameters

**account_id**

required

string format: uuid

ID of account

#### Example

```
eeda3227-9a39-46ae-9e14-20958bb4e6c9
```

### Query Parameters

**first_date**

string format: date

/^\d{4}-\d{2}-\d{2}$/

The start date for the requested metrics range (inclusive). Format: `YYYY-mm-dd`. Cannot be older than 13 months. If `first_date` is provided, `last_date` must also be provided.

**last_date**

string format: date

/^\d{4}-\d{2}-\d{2}$/

The end date for the requested metrics range (inclusive). Format: `YYYY-mm-dd`. If `last_date` is provided, `first_date` must also be provided.

**limit**

integer

default: 100 <= 1000

The maximum number of environments to return. A maximum of 1000 environments can be requested per page

**offset**

string

String-encoded offset for pagination. The next_page_token from the response can be used to paginate accordingly.

## Responses

### 200

Returns an `AccountUsageMetricsResponse` object.

Media typeapplication/json

object

**environment_metrics**

Usage metrics for each environment in the account

Array\<object>

object

**environment_name**

The name of the environment

string

**metrics**

Daily usage metrics for this environment

Array\<object>

Usage metrics collected over the period of one day.

In JSON format, the DailyUsageMetrics int64 values are encoded as a string rather than a number, following the [proto3 specification](https://developers.google.com/protocol-buffers/docs/proto3#json).

object

**date**

The date (ISO 8601).

string

**visit_count**

Total visits.

string format: int64

nullable

**network_origin_bytes**

Data served over HTTP by the origin server.

This does not include cached data served from a CDN.

string format: int64

nullable

**storage_file_bytes**

Storage used by this environment’s files.

This includes all files in the web root directory.

string format: int64

nullable

**storage_database_bytes**

Storage used by this environment’s database.

string format: int64

nullable

**billable_visits**

Billable visits.

string format: int64

nullable

**request_origin_count**

The total number of HTTP requests received by the origin server.

This does not include cached requests that were served from a CDN.

string format: int64

nullable

**network_cdn_bytes**

The data served by the CDN.

string format: int64

nullable

**storage_update_time**

The most recent storage usage measurement time (in UTC).

string format: date-time

nullable

**network_total_bytes**

The sum of CDN and origin network bytes.

string format: int64

nullable

**traffic_metrics_source**

The source of the traffic metrics.

- TRAFFIC_METRICS_SOURCE_UNSPECIFIED: The source of the traffic metrics is unknown.
- ONHOST: The traffic metrics is sourced from onhost logcrunch (legacy).
- BIGQUERY: The traffic metrics is sourced from BigQuery logcrunch.

string

default: TRAFFIC_METRICS_SOURCE_UNSPECIFIED

Allowed values: TRAFFIC_METRICS_SOURCE_UNSPECIFIED ONHOST BIGQUERY

**database_tables_count**

The number of tables in the install’s database.

string format: int64

nullable

**database_sql_bytes**

The sum of bytes of the database content in MySQL for an install.

string format: int64

nullable

**autoloaded_bytes**

The sum of bytes that is automatically loaded on each request to the install.

string format: int64

nullable

**metrics_rollup**

A rollup of usage metrics.

object

**visit_count**

A metric rollup.

object

**average**

The average value of the metric.

string format: int64

nullable

**sum**

The total sum value of the metric.

string format: int64

nullable

**latest**

The latest information.

object

**date**

The date (ISO 8601).

string

**value**

The value.

string format: int64

**network_origin_bytes**

A metric rollup.

object

**average**

The average value of the metric.

string format: int64

nullable

**sum**

The total sum value of the metric.

string format: int64

nullable

**latest**

The latest information.

object

**date**

The date (ISO 8601).

string

**value**

The value.

string format: int64

**storage_file_bytes**

A metric rollup.

object

**average**

The average value of the metric.

string format: int64

nullable

**sum**

The total sum value of the metric.

string format: int64

nullable

**latest**

The latest information.

object

**date**

The date (ISO 8601).

string

**value**

The value.

string format: int64

**storage_database_bytes**

A metric rollup.

object

**average**

The average value of the metric.

string format: int64

nullable

**sum**

The total sum value of the metric.

string format: int64

nullable

**latest**

The latest information.

object

**date**

The date (ISO 8601).

string

**value**

The value.

string format: int64

**billable_visits**

A metric rollup.

object

**average**

The average value of the metric.

string format: int64

nullable

**sum**

The total sum value of the metric.

string format: int64

nullable

**latest**

The latest information.

object

**date**

The date (ISO 8601).

string

**value**

The value.

string format: int64

**request_origin_count**

A metric rollup.

object

**average**

The average value of the metric.

string format: int64

nullable

**sum**

The total sum value of the metric.

string format: int64

nullable

**latest**

The latest information.

object

**date**

The date (ISO 8601).

string

**value**

The value.

string format: int64

**network_cdn_bytes**

A metric rollup.

object

**average**

The average value of the metric.

string format: int64

nullable

**sum**

The total sum value of the metric.

string format: int64

nullable

**latest**

The latest information.

object

**date**

The date (ISO 8601).

string

**value**

The value.

string format: int64

**network_total_bytes**

A metric rollup.

object

**average**

The average value of the metric.

string format: int64

nullable

**sum**

The total sum value of the metric.

string format: int64

nullable

**latest**

The latest information.

object

**date**

The date (ISO 8601).

string

**value**

The value.

string format: int64

**storage_refresh_expected_time**

The expected time when the storage refresh will complete for this environment

string format: date-time

nullable

**total_size**

Total number of environments

integer

**next_page_token**

Token for the next page of results

string

nullable

**all_environments_included**

Whether all environments can be returned based on account permissions

boolean

nullable

**last_account_storage_refresh_time**

The time when the account storage was last refreshed

string format: date-time

nullable

**account_storage_refresh_expected_time**

The expected time when the account storage refresh will complete

string format: date-time

nullable

#### Example

```json
{
  "environment_metrics": [
    {
      "metrics": [
        {
          "traffic_metrics_source": "TRAFFIC_METRICS_SOURCE_UNSPECIFIED"
        }
      ]
    }
  ]
}
```

### 400

Bad Request. The request was improperly formatted or contained invalid parameters.

Media typeapplication/json

object

**message**

required

A message explaining the error.

string

#### Example

```json
{
  "message": "Must provide or omit both first_date and last_date."
}
```

### 401

Authentication Error

Media typeapplication/json

object

**message**

required

A message regarding the error that occurred on the server

string

**documentation_url**

(Optional) A URL where documentation regarding this specific error can be found

string

#### Example

```json
{
  "message": "Bad Credentials"
}
```

### 403

Not Authorized

Media typeapplication/json

object

**message**

required

A message regarding the error that occurred on the server

string

**documentation_url**

(Optional) A URL where documentation regarding this specific error can be found

string

#### Example

```json
{
  "message": "You don't have permission to perform that action"
}
```

### 404

Not Found. The requested account id does not exist.

Media typeapplication/json

object

**message**

required

A message regarding the error that occurred on the server

string

**documentation_url**

(Optional) A URL where documentation regarding this specific error can be found

string

#### Example

```json
{
  "message": "Not Found"
}
```

### 429

Too many requests

### 500

Internal Server Error

Media typeapplication/json

object

**message**

required

A message regarding the error that occurred on the server

string

#### Example

```json
{
  "message": "An unexpected error occurred, please try again in a few minutes"
}
```

### 502

An invalid response was received from an upstream server

### 503

Service unavailable

### default

An unexpected error response.

Media typeapplication/json

object

**message**

required

A message regarding the error that occurred on the server

string

#### Example

```json
{
  "message": "An unexpected error occurred, please try again in a few minutes"
}
```

## Was this helpful?

Thanks for the feedback!

```json
{"@context":"https://schema.org","@graph":[{"@type":"WebSite","@id":"https://developers.wpengine.com/#website","name":"WP Engine Product Documentation","url":"https://developers.wpengine.com/","description":"Resources for developing, deploying, and scaling on WP Engine.","inLanguage":"en-US","keywords":["API documentation","product documentation","headless WordPress","managed WordPress hosting"],"publisher":{"@id":"https://wpengine.com/#organization"}}]}
```
