{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":1168,"path":"api-reference/web-services/c_APIAnalyticsCollectClean.md","title":"REST and SOAP API analytics collection and cleanup","bundle":null,"doc_type":null,"release":"australia","body":"\n# REST and SOAP API analytics collection and cleanup\n\nAPI analytics uses scheduled jobs to collect and clean up analytics data.\n\nThe instance tracks all web service transactions for APIs on the inclusion list and maintains a daily history, aggregated by resource and HTTP action combination. Requester information is aggregated per requester, resource, and HTTP action combination and tracked up to the daily limit defined by the property **com.glide.api.stats.daily\\_ limit**.\n\nRefer to the following table to determine which requests are logged.\n\n<table id=\"table_mdt_fkr_2x\"><thead><tr><th>\n\nAPI name\n\n</th><th>\n\nExample resource\n\n</th><th>\n\nResponse code\n\n</th><th>\n\nDescription\n\n</th><th>\n\nLogged\n\n</th></tr></thead><tbody><tr><td>\n\nnow/table\n\n</td><td>\n\n/api/now/table/incident\n\n</td><td>\n\nAny except 401\n\n</td><td>\n\nValid resource and table\n\n</td><td>\n\nYes\n\n</td></tr><tr><td>\n\nnow/table\n\n</td><td>\n\n/api/now/table/invalidResource\n\n</td><td>\n\n400\n\n</td><td>\n\nValid resource but an invalid table\n\n</td><td>\n\nYes\n\n</td></tr><tr><td>\n\nnow/table\n\n</td><td>\n\n/api/now/table/incident\n\n</td><td>\n\n403\n\n</td><td>\n\nRequesting user has insufficient privileges\n\n</td><td>\n\nYes\n\n</td></tr><tr><td>\n\nnow/table\n\n</td><td>\n\n/api/now/table/incident\n\n</td><td>\n\n401\n\n</td><td>\n\nRequesting user is not authenticated\n\n</td><td>\n\nNo\n\n</td></tr><tr><td>\n\nmyApp/myScriptedApi\n\n</td><td>\n\nmyApp/myScriptedApi/myResource\n\n</td><td>\n\nAny except 401\n\n</td><td>\n\nValid resource\n\n</td><td>\n\nYes\n\n</td></tr><tr><td>\n\nmyApp/invalidApiName\n\n</td><td>\n\n-   myApp/invalidApiName\n-   myApp/invalidApiName/myResource\n\n</td><td>\n\n400\n\n</td><td>\n\nInvalid API, even with a matching inclusion list entry\n\n</td><td>\n\nNo\n\n</td></tr></tbody>\n</table>On the 2nd of each month, the API Monthly Stats scheduled job calculates the monthly total for each resource and HTTP action combination. Each day the API Monthly Requestor Stats scheduled job calculates the monthly total for each resource, requester, and HTTP action combination based on daily scores older than 2 days.\n\nDaily statistics are maintained for 33 days. Monthly totals are maintained for 13 months. Table cleaners for the sys\\_api\\_stats, sys\\_api\\_stats\\_requestor, and sys\\_api\\_stats\\_requestor\\_monthly tables remove analytics records older than these limits.\n\n**Parent Topic:**[Analyze REST and SOAP API usage](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/web-services/c_APIAnalytics.md)\n\n## REST &amp; SOAP API analytics naming\n\nThe **API Name** used when tracking API analytics is determined by the type of API being described, such as a REST API or a Scripted SOAP service.\n\n<table id=\"table_dnf_n3b_55\"><thead><tr><th>\n\nAPI type\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nREST\n\n</td><td>\n\nThe API namespace and the first part of the URI following the namespace is used as the API name. For example, for the Table API endpoints `api/now/table/incident`and `api/now/table/problem`, the namespace and ID are **now/table**.\n\n</td></tr><tr><td>\n\nDirect SOAP \\(table does not extend Import Set Row table\\)\n\n</td><td>\n\nIf the direct SOAP request accesses a table, Direct SOAP is used as the API name.\n\n</td></tr><tr><td>\n\nSOAP import \\(table extends Import Set Row table\\)\n\n</td><td>\n\nImport Set SOAP is used as the API name.\n\n</td></tr><tr><td>\n\nScripted SOAP Services\n\n</td><td>\n\nThe SOAP request endpoint page is used as the API name, such as my\\_service.do.\n\n</td></tr></tbody>\n</table>"}}