Skip to content
WP Engine |Hosting Platform API

Get account usage metrics

GET
/accounts/{account_id}/usage

Get usage metrics for all environments in an account. If the optional first_date and last_date arguments are omitted, the response will include metrics for the last 30 days.

account_id
required
string format: uuid

ID of account

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.

A successful response.

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.

object
date

The date (ISO 8601).

string
visit_count

Total visits.

string format: int64
network_origin_bytes

Data served over HTTP by the origin server.

This does not include cached data served from a CDN.

string format: int64
storage_file_bytes

Storage used by this environment’s files.

This includes all files in the web root directory.

string format: int64
storage_database_bytes

Storage used by this environment’s database.

string format: int64
billable_visits

Billable visits.

string format: int64
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
network_cdn_bytes

The data served by the CDN.

string format: int64
storage_update_time

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

string format: date-time
network_total_bytes

The sum of CDN and origin network bytes.

string format: int64
traffic_metrics_source

The source of the traffic metrics.

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
database_sql_bytes

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

string format: int64
autoloaded_bytes

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

string format: int64
largest_files

The largest files in the install in bytes, received as a tab-separated list of file paths and sizes.

Array<string>
metrics_rollup

Rollup of the usage metrics for this environment

object
visit_count

A rollup of total visits.

The average field represents the average total visits per day on all installs. The sum field represents the sum of all the total visits on all installs. The latest field is not applicable to the total visits and will be empty.

object
average

The average value of the metric.

string format: int64
sum

The total sum value of the metric.

string format: int64
latest

The latest value of the metric.

object
date

The date (ISO 8601).

string
value

The value.

string format: int64
network_origin_bytes

A Rollup of data transfer metrics.

The average field represents the average data transfer metrics per day on all installs. The sum field represents the sum of all the data transfer metrics on all installs. The latest field is not applicable to the data transfer metrics and will be empty.

object
average

The average value of the metric.

string format: int64
sum

The total sum value of the metric.

string format: int64
latest

The latest value of the metric.

object
date

The date (ISO 8601).

string
value

The value.

string format: int64
storage_file_bytes

A rollup of file storage metrics.

The latest field represents the sum of all the latest metrics for file storage on all installs. The average and sum fields will be empty.

object
average

The average value of the metric.

string format: int64
sum

The total sum value of the metric.

string format: int64
latest

The latest value of the metric.

object
date

The date (ISO 8601).

string
value

The value.

string format: int64
storage_database_bytes

A rollup of database storage metrics.

The latest field represents the sum of all the latest metrics for database storage on all installs. The average and sum fields will be empty.

object
average

The average value of the metric.

string format: int64
sum

The total sum value of the metric.

string format: int64
latest

The latest value of the metric.

object
date

The date (ISO 8601).

string
value

The value.

string format: int64
billable_visits

A rollup of billable visits.

The average field represents the average billable visits per day on all installs. The sum field represents the sum of all the billable visits on all installs. The latest field is not applicable to the billable visits and will be empty.

object
average

The average value of the metric.

string format: int64
sum

The total sum value of the metric.

string format: int64
latest

The latest value of the metric.

object
date

The date (ISO 8601).

string
value

The value.

string format: int64
request_origin_count

A rollup of total number of requests.

The average field represents the average requests per day on all installs. The sum field represents the sum of all requests on all installs. The latest field is not applicable to the requests and will be empty.

object
average

The average value of the metric.

string format: int64
sum

The total sum value of the metric.

string format: int64
latest

The latest value of the metric.

object
date

The date (ISO 8601).

string
value

The value.

string format: int64
network_cdn_bytes

A rollup of total number of bytes served by CDN.

The average field represents the average bytes per day on all installs. The sum field represents the sum of all bytes on all installs. The latest field is not applicable to the bytes and will be empty.

object
average

The average value of the metric.

string format: int64
sum

The total sum value of the metric.

string format: int64
latest

The latest value of the metric.

object
date

The date (ISO 8601).

string
value

The value.

string format: int64
network_total_bytes

A rollup of total number of bytes served by CDN and origin.

The average field represents the average bytes per day on all installs. The sum field represents the sum of all network bytes on all installs. The latest field is not applicable to the bytes and will be empty.

object
average

The average value of the metric.

string format: int64
sum

The total sum value of the metric.

string format: int64
latest

The latest value of the metric.

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
total_size

Total number of environments

integer
next_page_token

Token for the next page of results

string
all_environments_included

Whether all environments can be returned based on account permissions

boolean
last_account_storage_refresh_time

The time when the account storage was last refreshed

string format: date-time
account_storage_refresh_expected_time

The expected time when the account storage refresh will complete

string format: date-time

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

object
message
required

A message explaining the error.

string
Example
Must provide or omit both first_date and last_date.

Authentication Error

object
message
required

A message regarding the error that occurred on the server

string
Example
Bad Credentials
documentation_url

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

string

Not Authorized

object
message
required

A message regarding the error that occurred on the server

string
Example
You don't have permission to perform that action
documentation_url

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

string

Not Found. The requested account id does not exist.

object
message
required

A message regarding the error that occurred on the server

string
Example
Not Found
documentation_url

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

string

Too many requests

An unexpected error response.

object
message
required

A message regarding the error that occurred on the server

string
Example
An unexpected error occurred, please try again in a few minutes