---
title: "POST /usage/statistics"
method: POST
path: "/usage/statistics"
---

# POST /usage/statistics

`POST /usage/statistics`

Retrieves (queries) quotas and aggregated usage data for one or more accounts.

## Query parameters

- `maxResults` string
- `nextToken` string

## Request body

- object
  - `filterBy` UsageStatisticsFilter[] — An array of objects, one for each condition to use to filter the query results. If you specify more than one condition, Amazon Macie uses an AND operator to join the conditions.
    - `comparator` 'GT' | 'GTE' | 'LT' | 'LTE' | 'EQ' | 'NE' | 'CONTAINS' — The operator to use in the condition. If the value for the key property is accountId, this value must be CONTAINS. If the value for the key property is any other supported field, this value can be EQ, GT, GTE, LT, LTE, or NE.
    - `key` 'accountId' | 'serviceLimit' | 'freeTrialStartDate' | 'total' — The field to use in the condition.
    - `values` String[] — <p>An array that lists values to use in the condition, based on the value for the field specified by the key property. If the value for the key property is accountId, this array can specify multiple values. Otherwise, this array can specify only one value.</p> <p>Valid values for each supported field are:</p> <ul><li><p>accountId - The unique identifier for an Amazon Web Services account.</p></li> <li><p>freeTrialStartDate - The date and time, in UTC and extended ISO 8601 format, when the Amazon Macie free trial started for an account.</p></li> <li><p>serviceLimit - A Boolean (true or false) value that indicates whether an account has reached its monthly quota.</p></li> <li><p>total - A string that represents the current estimated cost for an account.</p></li></ul>
  - `maxResults` integer — The maximum number of items to include in each page of the response.
  - `nextToken` string — The nextToken string that specifies which page of results to return in a paginated response.
  - `sortBy` object — Specifies criteria for sorting the results of a query for Amazon Macie account quotas and usage data.
    - `key` 'accountId' | 'total' | 'serviceLimitValue' | 'freeTrialStartDate' — The field to sort the results by.
    - `orderBy` 'ASC' | 'DESC' — The sort order to apply to the results, based on the value for the field specified by the key property. Valid values are: ASC, sort the results in ascending order; and, DESC, sort the results in descending order.
  - `timeRange` 'MONTH_TO_DATE' | 'PAST_30_DAYS' — An inclusive time period that Amazon Macie usage data applies to. Possible values are:

## Response `200`

Success

- GetUsageStatisticsResponse
  - `nextToken` string — The string to use in a subsequent request to get the next page of results in a paginated response. This value is null if there are no additional pages.
  - `records` UsageRecord[] — An array of objects that contains the results of the query. Each object contains the data for an account that matches the filter criteria specified in the request.
    - `accountId` string — The unique identifier for the Amazon Web Services account that the data applies to.
    - `automatedDiscoveryFreeTrialStartDate` string, date-time — The date and time, in UTC and extended ISO 8601 format, when the free trial of automated sensitive data discovery started for the account. If the account is a member account in an organization, this value is the same as the value for the organization's Amazon Macie administrator account.
    - `freeTrialStartDate` string, date-time — The date and time, in UTC and extended ISO 8601 format, when the Amazon Macie free trial started for the account.
    - `usage` UsageByAccount[] — An array of objects that contains usage data and quotas for the account. Each object contains the data for a specific usage metric and the corresponding quota.
      - `currency` 'USD' — The type of currency that the value for the metric (estimatedCost) is reported in.
      - `estimatedCost` string — The estimated value for the metric.
      - `serviceLimit` object — The current value for the quota that corresponds to the metric specified by the type field.
        - `isServiceLimited` boolean — Specifies whether the account has met the quota that corresponds to the metric specified by the UsageByAccount.type field in the response.
        - `unit` 'TERABYTES' — The unit of measurement for the value specified by the value field.
        - `value` integer — The value for the metric specified by the UsageByAccount.type field in the response.
      - `type` 'DATA_INVENTORY_EVALUATION' | 'SENSITIVE_DATA_DISCOVERY' | 'AUTOMATED_SENSITIVE_DATA_DISCOVERY' | 'AUTOMATED_OBJECT_MONITORING' — The name of the metric. Possible values are: AUTOMATED_OBJECT_MONITORING, to monitor S3 objects for automated sensitive data discovery; AUTOMATED_SENSITIVE_DATA_DISCOVERY, to analyze S3 objects for automated sensitive data discovery; DATA_INVENTORY_EVALUATION, to monitor S3 buckets; and, SENSITIVE_DATA_DISCOVERY, to run classification jobs.
  - `timeRange` 'MONTH_TO_DATE' | 'PAST_30_DAYS' — The inclusive time period that the usage data applies to. Possible values are: MONTH_TO_DATE, for the current calendar month to date; and, PAST_30_DAYS, for the preceding 30 days.

## Other responses

- `480` — ValidationException
- `481` — InternalServerException
- `482` — ServiceQuotaExceededException
- `483` — AccessDeniedException
- `484` — ResourceNotFoundException
- `485` — ThrottlingException
- `486` — ConflictException

---

[API](https://skmtc.net/aws/apis/macie2.md) · [All operations](https://skmtc.net/aws/apis/macie2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/macie2/versions/6252cf55d8ef/schema)
