Skip to content
WP EngineDocumentation

Get account usage metrics

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

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

Example
eeda3227-9a39-46ae-9e14-20958bb4e6c9
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.

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.

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
{
"environment_metrics": [
{
"metrics": [
{
"traffic_metrics_source": "TRAFFIC_METRICS_SOURCE_UNSPECIFIED"
}
]
}
]
}

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

Media typeapplication/json
object
message
required

A message explaining the error.

string
Example
{
"message": "Must provide or omit both first_date and last_date."
}

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
{
"message": "Bad Credentials"
}

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
{
"message": "You don't have permission to perform that action"
}

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
{
"message": "Not Found"
}

Too many requests

An unexpected error response.

Media typeapplication/json
object
message
required

A message regarding the error that occurred on the server

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