---
title: "POST /detector/{detectorId}/usage/statistics"
method: POST
path: "/detector/{detectorId}/usage/statistics"
---

# POST /detector/{detectorId}/usage/statistics

`POST /detector/{detectorId}/usage/statistics`

Lists Amazon GuardDuty usage statistics over the last 30 days for the specified detector ID. For newly enabled detectors or data sources, the cost returned will include only the usage so far under 30 days. This may differ from the cost metrics in the console, which project usage over 30 days to provide a monthly cost estimate. For more information, see <a href="https://docs.aws.amazon.com/guardduty/latest/ug/monitoring_costs.html#usage-calculations">Understanding How Usage Costs are Calculated</a>.

## Path parameters

- `detectorId` string, required

## Query parameters

- `MaxResults` string
- `NextToken` string

## Request body

- object
  - `usageStatisticsType` 'SUM_BY_ACCOUNT' | 'SUM_BY_DATA_SOURCE' | 'SUM_BY_RESOURCE' | 'TOP_RESOURCES' | 'SUM_BY_FEATURES', required — The type of usage statistics to retrieve.
  - `usageCriteria` object, required — Contains information about the criteria used to query usage statistics.
    - `AccountIds` AccountId[] — The account IDs to aggregate usage statistics from.
    - `DataSources` DataSource[] — The data sources to aggregate usage statistics from.This parameter is deprecated, use Features instead
    - `Resources` String[] — The resources to aggregate usage statistics from. Only accepts exact resource names.
    - `Features` UsageFeature[] — The features to aggregate usage statistics from.
  - `unit` string — The currency unit you would like to view your usage statistics in. Current valid values are USD.
  - `maxResults` integer — The maximum number of results to return in the response.
  - `nextToken` string — A token to use for paginating results that are returned in the response. Set the value of this parameter to null for the first request to a list action. For subsequent calls, use the NextToken value returned from the previous request to continue listing results after the first page.

## Response `200`

Success

- GetUsageStatisticsResponse
  - `UsageStatistics` object — The usage statistics object. If a UsageStatisticType was provided, the objects representing other types will be null.
    - `SumByAccount` UsageAccountResult[] — The usage statistic sum organized by account ID.
      - `AccountId` string — The Account ID that generated usage.
      - `Total` object — Represents the total of usage for the Account ID.
        - `Amount` string — The total usage.
        - `Unit` string — The currency unit that the amount is given in.
    - `SumByDataSource` UsageDataSourceResult[] — The usage statistic sum organized by on data source.
      - `DataSource` 'FLOW_LOGS' | 'CLOUD_TRAIL' | 'DNS_LOGS' | 'S3_LOGS' | 'KUBERNETES_AUDIT_LOGS' | 'EC2_MALWARE_SCAN' — The data source type that generated usage.
      - `Total` object — Represents the total of usage for the specified data source.
        - `Amount` string — The total usage.
        - `Unit` string — The currency unit that the amount is given in.
    - `SumByResource` UsageResourceResult[] — The usage statistic sum organized by resource.
      - `Resource` string — The Amazon Web Services resource that generated usage.
      - `Total` object — Represents the sum total of usage for the specified resource type.
        - `Amount` string — The total usage.
        - `Unit` string — The currency unit that the amount is given in.
    - `TopResources` UsageResourceResult[] — Lists the top 50 resources that have generated the most GuardDuty usage, in order from most to least expensive.
      - `Resource` string — The Amazon Web Services resource that generated usage.
      - `Total` object — Represents the sum total of usage for the specified resource type.
        - `Amount` string — The total usage.
        - `Unit` string — The currency unit that the amount is given in.
    - `SumByFeature` UsageFeatureResult[] — The usage statistic sum organized by feature.
      - `Feature` 'FLOW_LOGS' | 'CLOUD_TRAIL' | 'DNS_LOGS' | 'S3_DATA_EVENTS' | 'EKS_AUDIT_LOGS' | 'EBS_MALWARE_PROTECTION' | 'RDS_LOGIN_EVENTS' | 'LAMBDA_NETWORK_LOGS' | 'EKS_RUNTIME_MONITORING' — The feature that generated the usage cost.
      - `Total` object — Contains the total usage with the corresponding currency unit for that value.
        - `Amount` string — The total usage.
        - `Unit` string — The currency unit that the amount is given in.
  - `NextToken` string — The pagination parameter to be used on the next list operation to retrieve more items.

## Other responses

- `480` — BadRequestException
- `481` — InternalServerErrorException

---

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