{"id":30879,"date":"2021-08-14T07:48:07","date_gmt":"2021-08-14T06:48:07","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-3\/?p=30879"},"modified":"2024-03-29T11:18:25","modified_gmt":"2024-03-29T11:18:25","slug":"billing-sessions-api","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-3\/docs\/bots\/api-guide\/billing-sessions-api\/","title":{"rendered":"Billing Sessions 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>This API retrieves the list of individual billing sessions created for a bot so that you can review them for correctness and reconciliation.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small\"><\/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>POST<\/td>\n<\/tr>\n<tr>\n<td><strong>Endpoint<\/strong><\/td>\n<td><code>https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/getBillingSessionsDetails<\/code><\/p>\n<p>For Bot Admin Console:\u00a0<code>https:\/\/{{host}}\/api\/public\/getBillingSessionsDetails<\/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-3\/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-6ae8cf92e12f7\" data-id=\"6ae8cf92e12f7\" 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-6ae8cf92e13ea\" data-id=\"6ae8cf92e13ea\" 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\">Body Parameters<\/span><\/h2>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>fromDate<\/td>\n<td>Takes the date format yyyy-mm-dd<br \/>\n(or) yyyy-mm-ddThh:mm:ss.msZ<br \/>\neg:2019-04-01 (or) 2019-04-01T13:25:58.515Z<\/td>\n<\/tr>\n<tr>\n<td>toDate<\/td>\n<td>Takes the date format yyyy-mm-dd<br \/>\n(or) yyyy-mm-ddThh:mm:ss.msZ<br \/>\neg:2019-04-01 (or) 2019-04-01T13:25:58.515ZMaximum six month date period allowed<\/td>\n<\/tr>\n<tr>\n<td>channel (optional)<\/td>\n<td>The channel code.<\/td>\n<\/tr>\n<tr>\n<td>botId (optional when using Admin 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=\"w-separator size_small\"><\/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<ul>\n<li>Bot Builder API scope\n<pre class=\"\">curl --location --request POST 'https:\/\/{{HOST}}\/api\/public\/bot\/{{botId}}\/getBillingSessionsDetails' \\\r\n--header 'auth: {{Auth Token}}' \\\r\n--header 'content-type: application\/json' \\\r\n--data-raw '{\r\n    \"fromDate\": \"2021-02-21\",\r\n    \"toDate\": \"2021-07-22\"\r\n}'\r\n<\/pre>\n<\/li>\n<li>For Admin API scope\n<pre class=\"\">curl --location --request POST 'https:\/\/{{HOST}}\/api\/public\/bots\/getBillingSessionsDetails' \\\r\n--header 'auth: {{Auth Token}}' \\\r\n--header 'content-type: application\/json' \\\r\n--data-raw '{\r\n    \"fromDate\": \"2021-03-21\",\r\n    \"toDate\": \"2021-07-22\"\r\n}'\r\n<\/pre>\n<\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small\"><\/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<pre>{\r\n  \"total\": 2,\r\n  \"sessions\":\r\n   [\r\n    {\r\n       \"botId\": \"st-cXaaXXXe-ddXd-XXXX-XbeX-XXXXXcXdXbcX\",\r\n       \"channel\": \"IVR\",\r\n       \"koreUserId\": \"u-eXXXXXXX-bXfX-XXXc-XXXb-XfXaaXXXXXXX\",\r\n       \"channelUserId\": \"XfXXXXXfXXdXcXXXfeXXXdX\/ivrvoice\/00000152\",\r\n       \"billingSessionType\": \"Conversations\",\r\n       \"conversationSessionId\": \"XXXXXXbXbXeXXbXcXXfXaXXX\",\r\n       \"conversationSessionStartDateTime\": \"03-10-2021 2:05:03 pm\",\r\n       \"conversationSessionEndDateTime\": \"03-10-2021 2:05:30 pm\",\r\n       \"billingSessionId\": \"XXXXXXbXXXcXXXXcXdXXXXXf\",\r\n       \"billingSessionStartDateTime\": \"03-10-2021 2:05:03 pm\",\r\n       \"billingSessionEndDateTime\": \"03-10-2021 2:05:30 pm\"\r\n   },\r\n   {\r\n       \"botId\": \"st-cXaaXXXe-ddXd-XXXX-XbeX-XXXXXcXdXbcX\",\r\n       \"channel\": \"IVR\",\r\n       \"koreUserId\": \"u-eXXXXXXX-bXfX-XXXc-XXXb-XfXaaXXXXXXX\",\r\n       \"channelUserId\": \"XfXXXXXfXXdXcXXXfeXXXdX\/ivrvoice\/00000152\",\r\n       \"billingSessionType\": \"Conversations\",\r\n       \"conversationSessionId\": \"XXXXXXbXbXeXXbXcXXfXaXXX\",\r\n       \"conversationSessionStartDateTime\": \"03-10-2021 2:09:02 pm\",\r\n       \"conversationSessionEndDateTime\": \"03-10-2021 2:10:17 pm\",\r\n       \"billingSessionId\": \"XXXXXXbXXXcXXXXcXdXXXXXf\",\r\n       \"billingSessionStartDateTime\": \"03-10-2021 2:09:02 pm\",\r\n       \"billingSessionEndDateTime\": \"03-10-2021 2:10:17 pm\"\r\n   }\r\n ]\r\n}<\/pre>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"This API retrieves the list of individual billing sessions created for a bot so that you can review them for correctness and reconciliation. Method POST Endpoint https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/getBillingSessionsDetails For Bot Admin Console:\u00a0https:\/\/{{host}}\/api\/public\/getBillingSessionsDetails Content Type application\/json Authorization auth: {{JWT}} See How to generate the JWT Token. API Scope Bot Builder: Billing Sessions Bot Admin Console: Bot Analytics...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-30879","post","type-post","status-publish","format-standard","hentry","category-api-guide"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-3\/wp-json\/wp\/v2\/posts\/30879","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v10-3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v10-3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-3\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-3\/wp-json\/wp\/v2\/comments?post=30879"}],"version-history":[{"count":4,"href":"https:\/\/developer.kore.ai\/v10-3\/wp-json\/wp\/v2\/posts\/30879\/revisions"}],"predecessor-version":[{"id":61571,"href":"https:\/\/developer.kore.ai\/v10-3\/wp-json\/wp\/v2\/posts\/30879\/revisions\/61571"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-3\/wp-json\/wp\/v2\/media?parent=30879"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-3\/wp-json\/wp\/v2\/categories?post=30879"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-3\/wp-json\/wp\/v2\/tags?post=30879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}