{"id":29072,"date":"2021-07-12T13:44:39","date_gmt":"2021-07-12T12:44:39","guid":{"rendered":"https:\/\/multisite.korebots.com\/v9-0\/?p=29072"},"modified":"2021-07-13T12:03:32","modified_gmt":"2021-07-13T11:03:32","slug":"billing-sessions-api","status":"publish","type":"post","link":"https:\/\/multisite.korebots.com\/v9-0\/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 via_grid cols_1 laptops-cols_inherit tablets-cols_inherit mobiles-cols_1 valign_top type_default stacking_default\"><div class=\"wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><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<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Query_Parameters\"><\/span>Query Parameters<span class=\"ez-toc-section-end\"><\/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<\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Body_Parameters\"><\/span>Body Parameters<span class=\"ez-toc-section-end\"><\/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<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Authorization\"><\/span>Authorization<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Invoke the API with JWT in the header with the following syntax:<br \/>\n<code>auth: {{JWT}}<\/code><\/p>\n<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Response_content_type\"><\/span>Response content type<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><code>application\/JSON<\/code><\/p>\n<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Sample_Request\"><\/span>Sample Request<span class=\"ez-toc-section-end\"><\/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<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Sample_Response\"><\/span>Sample Response<span class=\"ez-toc-section-end\"><\/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<\/div><\/div><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><\/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":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/29072"}],"collection":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/comments?post=29072"}],"version-history":[{"count":3,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/29072\/revisions"}],"predecessor-version":[{"id":29086,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/29072\/revisions\/29086"}],"wp:attachment":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/media?parent=29072"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/categories?post=29072"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/tags?post=29072"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}