{"id":61572,"date":"2024-03-29T11:26:34","date_gmt":"2024-03-29T11:26:34","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?p=61572"},"modified":"2024-03-29T12:06:05","modified_gmt":"2024-03-29T12:06:05","slug":"billing-usage-summary-api","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/api-guide\/billing-usage-summary-api\/","title":{"rendered":"Billing Usage Summary API"},"content":{"rendered":"<section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row type_default valign_top\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p><span style=\"font-weight: 400;\">This API provides a summary of the billing usage specific to an account or bot for a given period.<\/span><\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae8707e9af52\" data-id=\"6ae8707e9af52\" data-height=\"10\" data-height-mobile=\"10\" data-height-tab=\"10\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<table>\n<tbody>\n<tr>\n<td><strong>Method<\/strong><\/td>\n<td><span style=\"font-weight: 400;\">POST and GET<\/span><\/td>\n<\/tr>\n<tr>\n<td><strong>Endpoint<\/strong><\/td>\n<td>POST<br \/>\nFor Bot Builder: <code>https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/billingsessionsummary<\/code><br \/>\nFor BAC: <code>https:\/\/{{host}}\/api\/public\/billingsessionsummary<\/code>&nbsp;<\/p>\n<p><b>Important<\/b><span style=\"font-weight: 400;\">: First, use the POST method to set filters, then use the following GET method to retrieve the billing session summary.<\/span><\/p>\n<p>GET<br \/>\nFor Bot Builder: <code>https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/billingsessionsummary\/status?type=summary<\/code><br \/>\nFor BAC: <code>https:\/\/{{host}}\/api\/public\/billingsessionsummary\/status?type=summary<\/code><\/td>\n<\/tr>\n<tr>\n<td><strong>Content Type<\/strong><\/td>\n<td><code>application\/json<\/code><\/td>\n<\/tr>\n<tr>\n<td><strong>Authorization<\/strong><\/td>\n<td><code>auth: {{JWT}}<\/code><\/p>\n<p>See <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/api-guide\/apis\/#Generating_the_JWT_Token\" target=\"_blank\" rel=\"noopener noreferrer\">How to generate the JWT Token.<\/a><\/td>\n<\/tr>\n<tr>\n<td><strong>API Scope<\/strong><\/td>\n<td>\n<ul>\n<li>Bot Builder: Billing Sessions<\/li>\n<li>Bot Admin Console: Bot Analytics &gt; Billing Sessions<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae8707e9b146\" data-id=\"6ae8707e9b146\" data-height=\"10\" data-height-mobile=\"10\" data-height-tab=\"10\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Query_Parameters\">Query Parameters<\/span><\/h2>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>host<\/td>\n<td>Environment URL, for example, https:\/\/bots.kore.ai<\/td>\n<\/tr>\n<tr>\n<td>BotID<\/p>\n<p>(when using with Bot Builder scope)<\/td>\n<td>Bot ID or Stream ID. You can access it from the General Settings page of the bot.<\/td>\n<\/tr>\n<\/thead>\n<\/table>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae8707e9b29b\" data-id=\"6ae8707e9b29b\" data-height=\"10\" data-height-mobile=\"10\" data-height-tab=\"10\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Sample_Request\">Sample Request<\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Sample_POST_Method_Request_for_the_Bot_Builder_API_Scope\">Sample POST Method Request for the Bot Builder API Scope<\/span><\/h3>\n<pre><code>curl --location 'https:\/\/{{HOST}}\/api\/public\/bot\/{{botId}}\/billingsessionsummary'\\\r\n--header 'auth: {{Auth Token}}' \\\r\n--header 'content-type: application\/json' \\\r\n--data-raw '{\r\n\"fromDate\": \"2023-04-07T10:10:54.680Z\",\r\n\"toDate\": \"2023-04-09T10:10:54.680Z\",\r\n\"unitType\": [\"request\",\"session\",\"alert\",\"proactive\",\"conversations\"],\r\n\"groupByBot\": \"no\",\r\n\"groupByPeriod\": \"date_day_hour\"\r\n},\r\n<\/code><\/pre>\n<p><b>Note:<\/b> Use the POST method to set filters, then use the following GET method to retrieve the billing session summary:<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Sample_GET_Method_Request_for_the_Bot_Builder_API_Scope\">Sample GET Method Request for the Bot Builder API Scope<\/span><\/h3>\n<pre><code>curl --location 'https:\/\/{{HOST}}\/api\/public\/bot\/{{botId}}\/billingsessionsummary\/statu?type=summary'\\\r\n--header 'auth: {{Auth Token}}' \\\r\n--header 'content-type: application\/json'\r\n<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Sample_POST_Method_Request_for_the_Admin_API_BAC_scope\">Sample POST Method Request for the Admin API (BAC) scope<\/span><\/h3>\n<pre><code>curl --location 'https:\/\/{{HOST}}\/api\/public\/bots\/billingsessionsummary' \\\r\n--header 'auth: {{Auth Token}}' \\\r\n--header 'content-type: application\/json' \\\r\n--data-raw '{\r\n\"fromDate\": \"2022-09-01T07:18:54.089Z\",\r\n\"toDate\": \"2022-09-07T23:30:25.931Z\",\r\n\"unitType\": [\"session\",\"request\",\"alert\",\"proactive\", \u201cconversations\u201d],\r\n\"groupByBot\": \"yes\",\r\n\"streamIds\": [\"st-13d7a88d-83cb-52bb-b847-ed32cxxxxxxx\"],\r\n\"groupByPeriod\": \"date_month\"\r\n},\r\n<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Sample_GET_Method_Request_for_the_BAC_API_Scope\">Sample GET Method Request for the BAC API Scope<\/span><\/h3>\n<pre><code>curl --location 'https:\/\/{{HOST}}\/api\/public\/bots\/billingsessionsummary\/statu?type=summary'\\\r\n--header 'auth: {{Auth Token}}' \\\r\n--header 'content-type: application\/json'\r\n<\/code><\/pre>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae8707e9b3ba\" data-id=\"6ae8707e9b3ba\" data-height=\"10\" data-height-mobile=\"10\" data-height-tab=\"10\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Body_Parameters_for_the_POST_Request\">Body Parameters for the POST Request<\/span><\/h2>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Required\/Optional<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>fromDate<\/td>\n<td>date, required<\/td>\n<td>Accepts the date in yyyy-mm-dd format\u00a0(or) yyyy-mm-ddThh:mm:ss.msZ<br \/>\nEg: 2019-04-01 (or) 2019-04-01T13:25:58.515Z<\/p>\n<p>Default: no<br \/>\nMax: 90 days<\/td>\n<\/tr>\n<tr>\n<td>toDate<\/td>\n<td>date, required<\/td>\n<td>Accepts the date in yyyy-mm-dd format<br \/>\n(or) yyyy-mm-ddThh:mm:ss.msZ<br \/>\nEg: 2019-04-01 (or) 2019-04-01T13:25:58.515Z<\/p>\n<p>Default: no<br \/>\nMax: 90 days<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">unitType<\/span><\/td>\n<td><span style=\"font-weight: 400;\">string, required<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The unit type of the billing session.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Possible values:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">session &#8211; the conversation session<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">request &#8211; the request that is sent to the bot<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">alert &#8211; the alert notifications sent by the bot to users.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">proactive -the proactive notifications sent by the bot to the users.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">conversations &#8211; the conversations between the bot and a user.<\/span><\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">groupByBot<\/span><\/td>\n<td><span style=\"font-weight: 400;\">string, required<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\">Yes <span style=\"font-weight: 400;\">&#8211; If you want to use BAC scope with stream ID.<\/span><\/li>\n<li>No <span style=\"font-weight: 400;\">&#8211; If you want to use Bot Build scope without stream ID.<\/span><\/li>\n<\/ul>\n<\/td>\n<td><span style=\"font-weight: 400;\">The parameter to group the billing sessions by bots<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">groupByPeriod<\/span><\/td>\n<td><span style=\"font-weight: 400;\">string, required<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The parameter to retrieve the conversation sessions data on <\/span><i><span style=\"font-weight: 400;\">Monthly<\/span><\/i><span style=\"font-weight: 400;\">, <\/span><i><span style=\"font-weight: 400;\">Daily, <\/span><\/i><span style=\"font-weight: 400;\">and <\/span><i><span style=\"font-weight: 400;\">Hourly <\/span><\/i><span style=\"font-weight: 400;\">basis.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Possible values:<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">date_day_hour\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">date_day<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">date_month<\/span><\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/thead>\n<\/table>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae8707e9b6f3\" data-id=\"6ae8707e9b6f3\" data-height=\"10\" data-height-mobile=\"10\" data-height-tab=\"10\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Sample_Response\">Sample Response<\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Sample_POST_Method_Response_BAC_API_Scope\">Sample POST Method Response (BAC API Scope)<\/span><\/h3>\n<pre><code>\r\n{\r\n    \"reportId\": \"121242\",\r\n    \"status\": \"IN_PROGRESS\",\r\n    \"percentageComplete\": 0,\r\n    \"orgId\": \"o-d54e1923-94e5-5b33-b248-xxxxxxxx\",\r\n    \"createdBy\": \"u-093524cf-9df9-5371-b28b-xxxxxxxxx\",\r\n    \"jobType\": \"BILLINGSESSIONS_API\",\r\n    \"action\": \"QUERY\",\r\n    \"statusLogs\": [],\r\n    \"_id\": \"ds-d7d23763-b876-5219-b93e-6398ea4cb1ec\",\r\n    \"lMod\": \"2023-04-27T06:19:11.000Z\",\r\n    \"createdOn\": \"2023-04-27T06:19:11.034Z\",\r\n    \"__v\": 0\r\n}\r\n<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Sample_GET_Method_Responses\">Sample GET Method Responses<\/span><\/h3>\n<p><b>Monthly Billing Session Summary<\/b><\/p>\n<pre><code>\r\n{\r\n\"_id\": \"ds-df7dbe18-9028-59db-8d12-cda96xxxxxx\",\r\n\"status\": \"success\",\r\n\"__v\": 0,\r\n\"lastModifiedBy\": \"u-5c86a357-0346-5646-b143-007f6xxxxxx\",\r\n\"modifiedOn\": \"2023-04-24T09:46:37.668Z\",\r\n\"response\": {\r\n\"data\": [\r\n{\r\n\"bot\": \"ALL\",\r\n\"val\": [\r\n{\r\n\"date\": \"2023-04-01T00:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 57,\r\n\"proactive_notifications\": 10,\r\n\"conversations\": 3\r\n}\r\n}\r\n]\r\n}\r\n],\r\n\"averageSessions\": 70\r\n}\r\n}\r\n<\/code><\/pre>\n<p><b>Daily Billing Session Summary<\/b><\/p>\n<pre><code>\r\n{\r\n\"_id\": \"ds-45b9f531-ac8b-5103-9a36-7960c3xxxxxxx\",\r\n\"status\": \"success\",\r\n\"__v\": 0,\r\n\"lastModifiedBy\": \"u-5c86a357-0346-5646-b143-007f6xxxxxxx\",\r\n\"modifiedOn\": \"2023-04-24T09:48:30.778Z\",\r\n\"response\": {\r\n\"data\": [\r\n{\r\n\"bot\": \"ALL\",\r\n\"val\": [\r\n{\r\n\"date\": \"2023-04-07T00:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 0,\r\n\"proactive_notifications\": 0,\r\n\"conversations\": 0\r\n}\r\n},\r\n{\r\n\"date\": \"2023-04-08T00:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 33,\r\n\"proactive_notifications\": 10,\r\n\"conversations\": 3\r\n}\r\n},\r\n{\r\n\"date\": \"2023-04-09T00:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 24,\r\n\"proactive_notifications\": 0,\r\n\"conversations\": 0\r\n}\r\n}\r\n]\r\n}\r\n],\r\n\"averageSessions\": 35\r\n}\r\n}\r\n<\/code><\/pre>\n<p><b>Hourly Billing Session Summary<\/b><\/p>\n<pre><code>\r\n{\r\n\"_id\": \"ds-477c077e-605a-5253-8a66-a4678dxxxxx\",\r\n\"status\": \"success\",\r\n\"__v\": 0,\r\n\"lastModifiedBy\": \"u-5c86a357-0346-5646-b143-007f6xxxxxx\",\r\n\"modifiedOn\": \"2023-04-24T09:49:09.861Z\",\r\n\"response\": {\r\n\"data\": [\r\n{\r\n\"bot\": \"ALL\",\r\n\"val\": [\r\n{\r\n\"date\": \"2023-04-07T10:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 0,\r\n\"proactive_notifications\": 0,\r\n\"conversations\": 0\r\n}\r\n},\r\n},\r\n},\r\n{\r\n\"date\": \"2023-04-08T10:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 2,\r\n\"proactive_notifications\": 0,\r\n\"conversations\": 0\r\n}\r\n},\r\n{\r\n\"date\": \"2023-04-08T15:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 2,\r\n\"proactive_notifications\": 0,\r\n\"conversations\": 0\r\n}\r\n},\r\n{\r\n\"date\": \"2023-04-08T16:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 4,\r\n\"proactive_notifications\": 0,\r\n\"conversations\": 0\r\n}\r\n},\r\n\r\n{\r\n\"date\": \"2023-04-09T00:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 2,\r\n\"proactive_notifications\": 0,\r\n\"conversations\": 0\r\n}\r\n},\r\n{\r\n\"date\": \"2023-04-09T01:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 4,\r\n\"proactive_notifications\": 0,\r\n\"conversations\": 0\r\n}\r\n},\r\n},\r\n},\r\n{\r\n\"date\": \"2023-04-09T05:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 2,\r\n\"proactive_notifications\": 0,\r\n\"conversations\": 0\r\n}\r\n},\r\n{\r\n\"date\": \"2023-04-09T06:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 2,\r\n\"proactive_notifications\": 0,\r\n\"conversations\": 0\r\n}\r\n},\r\n{\r\n\"date\": \"2023-04-09T07:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 2,\r\n\"proactive_notifications\": 0,\r\n\"conversations\": 0\r\n}\r\n},\r\n{\r\n\"date\": \"2023-04-09T08:00:00.000Z\",\r\n\"val\": {\r\n\"requests\": 0,\r\n\"sessions\": 0,\r\n\"alert_notifications\": 4,\r\n\"proactive_notifications\": 0,\r\n\"conversations\": 0\r\n}\r\n},\r\n}\r\n],\r\n\"averageSessions\": 2\r\n}\r\n}\r\n<\/code><\/pre>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae8707e9b7f9\" data-id=\"6ae8707e9b7f9\" data-height=\"10\" data-height-mobile=\"10\" data-height-tab=\"10\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"This API provides a summary of the billing usage specific to an account or bot for a given period. Method POST and GET Endpoint POST For Bot Builder: https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/billingsessionsummary For BAC: https:\/\/{{host}}\/api\/public\/billingsessionsummary&nbsp; Important: First, use the POST method to set filters, then use the following GET method to retrieve the billing session summary. GET For...","protected":false},"author":26,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-61572","post","type-post","status-publish","format-standard","hentry","category-api-guide"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/61572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=61572"}],"version-history":[{"count":4,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/61572\/revisions"}],"predecessor-version":[{"id":61576,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/61572\/revisions\/61576"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=61572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=61572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=61572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}