[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-08-13 UTC。"],[[["\u003cp\u003eThis documentation applies to both Apigee and Apigee hybrid, and it covers the security stats API for viewing abuse and bot-related statistics over the last 14 days.\u003c/p\u003e\n"],["\u003cp\u003eThe security stats API supports two types of statistics: tabular stats, which are aggregations without a time dimension, and time series stats, which do include a time dimension.\u003c/p\u003e\n"],["\u003cp\u003eAPI calls use parameters such as \u003ccode\u003eORG\u003c/code\u003e, \u003ccode\u003eENV\u003c/code\u003e, \u003ccode\u003eMETRIC_i\u003c/code\u003e, \u003ccode\u003eAGGREGATION_i\u003c/code\u003e, \u003ccode\u003eDIMENSION_i\u003c/code\u003e, and \u003ccode\u003ePAGE_SIZE\u003c/code\u003e, as well as a \u003ccode\u003etime_range\u003c/code\u003e defining the start and end times, with a maximum range of 14 days within the past 365 days.\u003c/p\u003e\n"],["\u003cp\u003eThe API allows querying tabular stats, time series stats, and incident details, and it includes specific metrics like \u003ccode\u003ebot\u003c/code\u003e, \u003ccode\u003ebot_traffic\u003c/code\u003e, and \u003ccode\u003emessage_count\u003c/code\u003e, along with aggregation functions like \u003ccode\u003esum\u003c/code\u003e, \u003ccode\u003ecount_distinct\u003c/code\u003e, \u003ccode\u003emin\u003c/code\u003e, and \u003ccode\u003emax\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe security stats API has limitations, including a maximum page size of 14400, a maximum of 10 or 15 dimensions for time series or tabular stats, a maximum of 5 metric aggregations, and the restriction that incident_id and bot_reason cannot be used with certain metrics.\u003c/p\u003e\n"]]],[],null,["# Security stats API\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\nThe security stats API lets you view abuse and bot-related statistics over\nthe past 14 days. There are two type of security stats:\n\n- Tabular stats, which don't have a time dimension. Tabular stats are often computed using an aggregation function, for example, `sum for message_count` or `bot_traffic`.\n- Time series stats, which do have a time dimension.\n\n**Note:** Bot detection has a processing delay of around 15 to 20 minutes on average.\n\nParameters in example API calls\n-------------------------------\n\nThe following sections give examples of API calls that use the security stats\nAPI. The API calls contain the following parameters:\n\n- \u003cvar translate=\"no\"\u003eORG\u003c/var\u003e: Your organization.\n- \u003cvar translate=\"no\"\u003eENV\u003c/var\u003e: Your environment.\n- \u003cvar translate=\"no\"\u003eMETRIC_i\u003c/var\u003e: A metric for the statistic. See [Metrics and aggregation functions](#metrics-and-aggregation-functions).\n- \u003cvar translate=\"no\"\u003eAGGREGATION_i\u003c/var\u003e: An aggregation function for the metric. See the table below.\n- \u003cvar translate=\"no\"\u003eDIMENSION_i\u003c/var\u003e: A [dimension](#dimensions) for grouping the values of the statistic.\n- \u003cvar translate=\"no\"\u003ePAGE_SIZE\u003c/var\u003e: Maximum number of subcomponents returned in a single page.\n- `time_range`: The time range for the statistics in the form \n\n ```\n \"time_range\": {\n \"start_time\": START_TIME,\n \"end_time\": END_TIME\n }\n ```\n\n where:\n - \u003cvar translate=\"no\"\u003eSTART_TIME\u003c/var\u003e is the start time for the time range.\n - \u003cvar translate=\"no\"\u003eEND_TIME\u003c/var\u003e is the end time for the time range.\n\n \u003cvar translate=\"no\"\u003eSTART_TIME\u003c/var\u003e and \u003cvar translate=\"no\"\u003eEND_TIME\u003c/var\u003e are of the form\n `\"YYYY-MM-DDT00:00:00Z\"`.\n\n The length of the time range can be at most 14 days, and both the start date and end date\n must be within the past 365 days.\n\nExample: Query tabular security stats for an environment\n--------------------------------------------------------\n\nA request that queries tabular stats has the following format: \n\n```\ncurl \"https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityStats:queryTabularStats\" \\\n -H 'Content-type: application/json' -H \"Authorization: Bearer $TOKEN\" -X POST -d \\\n '{ \"metrics\": [{\"metric\": \"METRIC_1\", \"aggregation\": \"AGGREGATION_1\",\n {\"metric\": \"METRIC_2\", \"aggregation\": \"AGGREGATION_2\"}],\n \"dimensions\": [\"DIMENSION_1\", \"DIMENSION_2\"],\n \"page_size\": PAGE_SIZE,\n \"time_range\": {\n \"start_time\": START_TIME,\n \"end_time\": END_TIME\n }\n }'\n```\n\nSee [Parameters in example API calls](#parameters-in-example-api-calls).\n\nSee [Limitations on security stats](#limitations-on-security-stats)\nfor the maximum numbers of metrics, aggregation functions, and dimensions that can\nbe included in a request.\n\nHere is an example of a request that queries tabular stats: \n\n```\ncurl \"https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityStats:queryTabularStats\" \\\n -H 'Content-type: application/json' -H \"Authorization: Bearer $TOKEN\" -X POST -d \\\n '{ \"metrics\": [{\"metric\": \"bot\", \"aggregation\": \"count_distinct\"},\n {\"metric\": \"bot_traffic\", \"aggregation\": \"sum\"},\n {\"metric\": \"bot_first_detected\", \"aggregation\": \"min\"},\n {\"metric\": \"bot_last_detected\", \"aggregation\": \"max\"}],\n \"dimensions\": [\"apiproxy\", \"bot_reason\", \"ax_resolved_client_ip\", \"ax_geo_city\", \"ax_geo_country\", \"client_id\", \"proxy_basepath\", \"proxy_pathsuffix\"],\n \"page_size\": 1,\n \"time_range\": {\n \"start_time\": START_TIME,\n \"end_time\": END_TIME\n }\n }'\n```\n\nSee the\n[`queryTabularStats`](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.securityStats/queryTabularStats) reference page for descriptions of the request\nand response.\n\nExample: Query time series security stats for an environment\n------------------------------------------------------------\n\nTime series APIs return time series stats for the chosen metrics, grouped by the chosen dimension.\n\nThe following call invokes time series stats for bot traffic grouped by API proxy. Since there are\nfour proxies, this yields four sequences of time series points. The order of the points of each row\nmatch the corresponding index in the columns field.\n\nHere is a sample request: \n\n```\ncurl \"https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityStats:queryTimeSeriesStats\" \\\n -H 'Content-type: application/json' -H \"Authorization: Bearer $TOKEN\" -X POST -d \\\n '{ \"metrics\": [{\"metric\": \"METRIC_1\", \"aggregation\": \"AGGREGATION_1\", \"order\": \"ORDER\"}],\n \"dimensions\": [\"DIMENSION_1\"], \"window_size\": \"WINDOW_SIZE\",\n \"page_size\": PAGE_SIZE,\n \"time_range\": {\n \"start_time\": START_TIME,\n \"end_time\": END_TIME\n }\n }'\n```\n\nSee [Parameters in example API calls](#parameters-in-example-api-calls).\n\nSee the\n[`queryTabularStats`](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.securityStats/queryTimeSeriesStats) reference page for descriptions of the request\nand response.\n\nExample: Query incident details for abuse detection\n---------------------------------------------------\n\nThe following example queries the details of an incident for Advanced API Security's\n[Abuse detection](/apigee/docs/api-security/abuse-detection). The call returns\ndetails for bot count for the developer_app for a given incident. \n\n```\ncurl \"https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityStats:queryTabularStats\" \\\n -H \"Content-Type: application/json\" -H \"Authorization: Bearer $(gcloud auth print-access-token)\" -X POST -d \\\n '{\"metrics\": [{\"metric\": \"bot_traffic\", \"aggregation\": \"sum\"}],\n \"dimensions\": [\"incident_id\", \"developer_app\"],\n \"filter\": \"incident_id eq '\\''d897d1af-51ac-4b5d-a29e-d1059d922a05'\\''\",\n \"page_size\": 100,\n \"time_range\": {\n \"start_time\": START_TIME,\n \"end_time\": END_TIME\n }\n }'\n```\n\nSee [Parameters in example API calls](#parameters-in-example-api-calls).\n\nThis returns a response like the following: \n\n```\n{\n \"values\": [\n [\n \"d897d1af-51ac-4b5d-a29e-d1059d922a05\",\n \"Developer2_App1\",\n 18353\n ],\n [\n \"d897d1af-51ac-4b5d-a29e-d1059d922a05\",\n \"Developer1_App1\",\n 18082\n ]\n ],\n \"columns\": [\n \"incident_id\",\n \"developer_app\",\n \"bot_traffic\"\n ]\n}\n```\n\nSee the\n[`queryTabularStats`](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.securityStats/queryTabularStats) reference page for descriptions of the request\nand response.\n\nMetrics and aggregation functions\n---------------------------------\n\nThe following table describes the metrics and aggregation functions available in\nthe security stats API:\n\nDimensions\n----------\n\nDimensions let you group metric values together based on related\nsubsets of the data. The following table describes the dimensions that are specific to\nAdvanced API Security reports:\n\n**Note:** `bot_reason` and `incident_id`\nonly work with the following metrics:\n\n- `bot`\n- `bot_traffic`\n- `response_size`\n\nIn addition to the dimensions described above, Advanced API Security also supports the following\n[dimensions](/apigee/docs/api-platform/analytics/analytics-reference#dimensions):\n\n- `access_token`\n- `api_product`\n- `apiproxy`\n- `app_group_app`\n- `app_group_name`\n- `ax_edge_execution_fault_code`\n- `ax_geo_city`\n- `ax_geo_continent`\n- `ax_geo_country`\n- `ax_geo_region`\n- `ax_isp`\n- `ax_resolved_client_ip`\n- `ax_ua_agent_version`\n- `client_id`\n- `developer`\n- `developer_app`\n- `developer_email`\n- `environment`\n- `proxy_basepath`\n- `proxy_pathsuffix`\n- `request_uri`\n- `response_status_code`\n- `target_url`\n- `useragent`\n\nLimitations on security stats\n-----------------------------\n\nThe security stats API (both tabular and time series) has the following limits:\n\n- Maximum page size: 14400\n- Maximum of 10 time series dimensions\n- Maximum of 15 tabular stats dimensions\n- Maximum of 5 metric aggregations.\n- Maximum of 5 time series metric aggregations\n- Time range: Length can be at most 14 days, and both the start date and end date must be within the past 365 days.\n- The dimensions `incident_id` and `bot_reason` cannot be used with the metrics `message_count` or `response_size`.\n\nComparing the security stats API and the security reports API\n-------------------------------------------------------------\n\nBoth the security stats API and the security reports API return abuse and bot-related security\nstatistics, but they have the following differences:\n\n- The security stats API is designed to\n view statistics for recent API traffic.\n Data for the security stats API goes back only 14 days, but you can view\n the stats immediately when you send a request.\n\n Security stats are also displayed in the\n [Abuse metrics view](/apigee/docs/api-security/security-scores#abuse-metrics-view) in the\n Apigee UI.\n- The [security reports API](/apigee/docs/api-security/security-reports-api) is designed to view statistics for long-running operations. To use the security scores API, you submit a job and view the results only when the job is completed. Data for the security scores API goes back one year."]]