{"id":30879,"date":"2021-08-14T07:48:07","date_gmt":"2021-08-14T06:48:07","guid":{"rendered":"https:\/\/developer.kore.ai\/v9-3\/?p=30879"},"modified":"2021-08-14T07:48:07","modified_gmt":"2021-08-14T06:48:07","slug":"billing-sessions-api","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v9-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. . This API is available in BT and BAC app scopes.<\/p>\n<p class=\"note\">To use this API, an app needs the Bot Builder API scope of <em>Billing Sessions<\/em>.<br \/>\nOR the Admin API Scope of <em>Billing Sessions<\/em>\u00a0under <em>Bot Analytics<\/em>.<\/p>\n<p><strong>POST<\/strong>\u00a0<code>https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/getBillingSessionsDetails<\/code><br \/>\nand <code>https:\/\/{{host}}\/api\/public\/getBillingSessionsDetails<\/code>for Bot Admin Console<\/p>\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>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Query_Parameters\">Query Parameters<\/span><\/h3>\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\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Body_Parameters\">Body Parameters<\/span><\/h3>\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 with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Authorization\">Authorization<\/span><\/h3>\n<p>Invoke the API with JWT in the header with the following syntax:<br \/>\n<code>auth: {{JWT}}<\/code><\/p>\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>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Response_content_type\">Response content type<\/span><\/h3>\n<p><code>application\/JSON<\/code><\/p>\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>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Sample_Request\">Sample Request<\/span><\/h3>\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 with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Sample_Response\">Sample Response<\/span><\/h3>\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. . This API is available in BT and BAC app scopes. To use this API, an app needs the Bot Builder API scope of Billing Sessions. OR the Admin API Scope of...","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\/v9-3\/wp-json\/wp\/v2\/posts\/30879","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v9-3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v9-3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v9-3\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v9-3\/wp-json\/wp\/v2\/comments?post=30879"}],"version-history":[{"count":2,"href":"https:\/\/developer.kore.ai\/v9-3\/wp-json\/wp\/v2\/posts\/30879\/revisions"}],"predecessor-version":[{"id":30881,"href":"https:\/\/developer.kore.ai\/v9-3\/wp-json\/wp\/v2\/posts\/30879\/revisions\/30881"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v9-3\/wp-json\/wp\/v2\/media?parent=30879"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v9-3\/wp-json\/wp\/v2\/categories?post=30879"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v9-3\/wp-json\/wp\/v2\/tags?post=30879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}