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
Important: First, use the POST method to set filters, then use the following GET method to retrieve the billing session summary. GET |
Content Type | application/json |
Authorization | auth: {{JWT}}
|
API Scope |
|
Query Parameters
Parameter | Description |
---|---|
host | Environment URL, for example, https://bots.kore.ai |
BotID
(when using with Bot Builder scope) |
Bot ID or Stream ID. You can access it from the General Settings page of the bot. |
Sample Request
Sample POST Method Request for the Bot Builder API Scope
curl --location 'https://{{HOST}}/api/public/bot/{{botId}}/billingsessionsummary'\
--header 'auth: {{Auth Token}}' \
--header 'content-type: application/json' \
--data-raw '{
"fromDate": "2023-04-07T10:10:54.680Z",
"toDate": "2023-04-09T10:10:54.680Z",
"unitType": ["request","session","alert","proactive","conversations"],
"groupByBot": "no",
"groupByPeriod": "date_day_hour"
},
Note: Use the POST method to set filters, then use the following GET method to retrieve the billing session summary:
Sample GET Method Request for the Bot Builder API Scope
curl --location 'https://{{HOST}}/api/public/bot/{{botId}}/billingsessionsummary/statu?type=summary'\
--header 'auth: {{Auth Token}}' \
--header 'content-type: application/json'
Sample POST Method Request for the Admin API (BAC) scope
curl --location 'https://{{HOST}}/api/public/bots/billingsessionsummary' \
--header 'auth: {{Auth Token}}' \
--header 'content-type: application/json' \
--data-raw '{
"fromDate": "2022-09-01T07:18:54.089Z",
"toDate": "2022-09-07T23:30:25.931Z",
"unitType": ["session","request","alert","proactive", “conversations”],
"groupByBot": "yes",
"streamIds": ["st-13d7a88d-83cb-52bb-b847-ed32cxxxxxxx"],
"groupByPeriod": "date_month"
},
Sample GET Method Request for the BAC API Scope
curl --location 'https://{{HOST}}/api/public/bots/billingsessionsummary/statu?type=summary'\
--header 'auth: {{Auth Token}}' \
--header 'content-type: application/json'
Body Parameters for the POST Request
Parameter | Required/Optional | Description |
---|---|---|
fromDate | date, required | Accepts the date in yyyy-mm-dd format (or) yyyy-mm-ddThh:mm:ss.msZ Eg: 2019-04-01 (or) 2019-04-01T13:25:58.515Z Default: no |
toDate | date, required | Accepts the date in yyyy-mm-dd format (or) yyyy-mm-ddThh:mm:ss.msZ Eg: 2019-04-01 (or) 2019-04-01T13:25:58.515Z Default: no |
unitType | string, required | The unit type of the billing session.
Possible values:
|
groupByBot | string, required
|
The parameter to group the billing sessions by bots |
groupByPeriod | string, required | The parameter to retrieve the conversation sessions data on Monthly, Daily, and Hourly basis.
Possible values:
|
Sample Response
Sample POST Method Response (BAC API Scope)
{
"reportId": "121242",
"status": "IN_PROGRESS",
"percentageComplete": 0,
"orgId": "o-d54e1923-94e5-5b33-b248-xxxxxxxx",
"createdBy": "u-093524cf-9df9-5371-b28b-xxxxxxxxx",
"jobType": "BILLINGSESSIONS_API",
"action": "QUERY",
"statusLogs": [],
"_id": "ds-d7d23763-b876-5219-b93e-6398ea4cb1ec",
"lMod": "2023-04-27T06:19:11.000Z",
"createdOn": "2023-04-27T06:19:11.034Z",
"__v": 0
}
Sample GET Method Responses
Monthly Billing Session Summary
{
"_id": "ds-df7dbe18-9028-59db-8d12-cda96xxxxxx",
"status": "success",
"__v": 0,
"lastModifiedBy": "u-5c86a357-0346-5646-b143-007f6xxxxxx",
"modifiedOn": "2023-04-24T09:46:37.668Z",
"response": {
"data": [
{
"bot": "ALL",
"val": [
{
"date": "2023-04-01T00:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 57,
"proactive_notifications": 10,
"conversations": 3
}
}
]
}
],
"averageSessions": 70
}
}
Daily Billing Session Summary
{
"_id": "ds-45b9f531-ac8b-5103-9a36-7960c3xxxxxxx",
"status": "success",
"__v": 0,
"lastModifiedBy": "u-5c86a357-0346-5646-b143-007f6xxxxxxx",
"modifiedOn": "2023-04-24T09:48:30.778Z",
"response": {
"data": [
{
"bot": "ALL",
"val": [
{
"date": "2023-04-07T00:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 0,
"proactive_notifications": 0,
"conversations": 0
}
},
{
"date": "2023-04-08T00:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 33,
"proactive_notifications": 10,
"conversations": 3
}
},
{
"date": "2023-04-09T00:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 24,
"proactive_notifications": 0,
"conversations": 0
}
}
]
}
],
"averageSessions": 35
}
}
Hourly Billing Session Summary
{
"_id": "ds-477c077e-605a-5253-8a66-a4678dxxxxx",
"status": "success",
"__v": 0,
"lastModifiedBy": "u-5c86a357-0346-5646-b143-007f6xxxxxx",
"modifiedOn": "2023-04-24T09:49:09.861Z",
"response": {
"data": [
{
"bot": "ALL",
"val": [
{
"date": "2023-04-07T10:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 0,
"proactive_notifications": 0,
"conversations": 0
}
},
},
},
{
"date": "2023-04-08T10:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 2,
"proactive_notifications": 0,
"conversations": 0
}
},
{
"date": "2023-04-08T15:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 2,
"proactive_notifications": 0,
"conversations": 0
}
},
{
"date": "2023-04-08T16:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 4,
"proactive_notifications": 0,
"conversations": 0
}
},
{
"date": "2023-04-09T00:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 2,
"proactive_notifications": 0,
"conversations": 0
}
},
{
"date": "2023-04-09T01:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 4,
"proactive_notifications": 0,
"conversations": 0
}
},
},
},
{
"date": "2023-04-09T05:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 2,
"proactive_notifications": 0,
"conversations": 0
}
},
{
"date": "2023-04-09T06:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 2,
"proactive_notifications": 0,
"conversations": 0
}
},
{
"date": "2023-04-09T07:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 2,
"proactive_notifications": 0,
"conversations": 0
}
},
{
"date": "2023-04-09T08:00:00.000Z",
"val": {
"requests": 0,
"sessions": 0,
"alert_notifications": 4,
"proactive_notifications": 0,
"conversations": 0
}
},
}
],
"averageSessions": 2
}
}