## Query analytics summary `client.analyticsQuery.summary(stringdataset, AnalyticsQuerySummaryParamsparams, RequestOptionsoptions?): AnalyticsQuerySummaryResponse` **post** `/accounts/{account_id}/analytics/query/{dataset}/summary` Returns aggregate summary stats for a dataset. Includes current-period and previous-period totals for trend comparison. ### Parameters - `dataset: string` - `params: AnalyticsQuerySummaryParams` - `account_id: string` Path param: Cloudflare account identifier. - `filters: Array` Body param: Filters to apply before aggregating results. - `name: string` Specifies the column name to filter on. Requires a valid column for the target dataset (e.g. `country`, `allowed`, `appId`). - `op: string` Filter operator. Common values: `eq`, `neq`, `in`, `not_in`, `gt`, `lt`, `gte`, `lte`. - `values: Array` Values to match against. Type depends on the column. - `string` - `boolean` - `number` - `from: string` Body param: The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`). - `groupBy: Array` Body param: Specifies the column names to group results by. Requires valid columns for the target dataset. - `stats: Array` Body param: Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`). - `to: string` Body param: Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone. ### Returns - `AnalyticsQuerySummaryResponse` - `currentTotal: Array>` Aggregated stats for the requested time range. - `previousTotal: Array>` Aggregated stats for the equivalent preceding time range, for trend comparison. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.analyticsQuery.summary('access-logins', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', filters: [], from: '2024-11-01T00:00:00Z', groupBy: [], stats: ['attemptsTotal'], to: '2024-11-08T00:00:00Z', }); console.log(response.currentTotal); ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "API in beta: expect breaking changes." } ], "result": { "currentTotal": [ { "attemptsTotal": 48291 } ], "previousTotal": [ { "attemptsTotal": 41033 } ] }, "success": true } ```