> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

# RequestSmartQueueHistory

POST https://api.voximplant.com/platform_api/RequestSmartQueueHistory

Gets history for the specified SmartQueue. Refer to the <a href="/docs/guides/contact-center/reporting">SmartQueue reporting guide</a> to learn more.

**Example request:** Generate a service_level report file in csv format for the period from 2021-03-17 00:00:00 to 2021-03-17 22:00:00.

Reference: https://docs.voximplant.ai/api-reference/management-api/reference/smartqueue/request-smart-queue-history

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: management-api
  version: 1.0.0
paths:
  /RequestSmartQueueHistory:
    post:
      operationId: request-smart-queue-history
      summary: RequestSmartQueueHistory
      description: >-
        Gets history for the specified SmartQueue. Refer to the <a
        href="/docs/guides/contact-center/reporting">SmartQueue reporting
        guide</a> to learn more.


        **Example request:** Generate a service_level report file in csv format
        for the period from 2021-03-17 00:00:00 to 2021-03-17 22:00:00.
      tags:
        - subpackage_smartqueue
      parameters:
        - name: application_id
          in: query
          description: >-
            The application ID to search by. **Required** unless
            **application_name** is provided.
          required: false
          schema:
            type: integer
        - name: application_name
          in: query
          description: >-
            The application name to search by. **Required** unless
            **application_id** is provided.
          required: false
          schema:
            type: string
        - name: user_id
          in: query
          description: >-
            The user ID list with a maximum of 5 values separated by semicolons
            (;). Use the 'all' value to select all users. Can operate as a
            filter for the **occupancy_rate**, **sum_agents_online_time**,
            **sum_agents_ready_time**, **sum_agents_dialing_time**,
            **sum_agents_in_service_time**, **sum_agents_afterservice_time**,
            **sum_agents_dnd_time**, **sum_agents_banned_time**,
            **min_handle_time**, **max_handle_time**, **average_handle_time**,
            **count_handled_calls**, **min_after_call_worktime**,
            **max_after_call_worktime**, **average_after_call_worktime** report
            types
          required: false
          schema:
            type: array
            items:
              type: integer
        - name: user_name
          in: query
          description: >-
            The user name list separated by semicolons (;). Can be used instead
            of **user_id**
          required: false
          schema:
            type: array
            items:
              type: string
        - name: sq_queue_id
          in: query
          description: >-
            The SmartQueue ID list with a maximum of 5 values separated by
            semicolons (;). Can operate as filter for the
            **calls_blocked_percentage**, **count_blocked_calls**,
            **average_abandonment_rate**, **count_abandonment_calls**,
            **service_level**, **occupancy_rate**, **min_time_in_queue**,
            **max_time_in_queue**, **average_time_in_queue**,
            **min_answer_speed**, **max_answer_speed**,
            **average_answer_speed**, **min_handle_time**, **max_handle_time**,
            **average_handle_time**, **count_handled_calls**,
            **min_after_call_worktime**, **max_after_call_worktime**,
            **average_after_call_worktime** report types
          required: true
          schema:
            type: array
            items:
              type: integer
        - name: sq_queue_name
          in: query
          description: >-
            The SmartQueue name list separated by semicolons (;). Can be used
            instead of **sq_queue_id**
          required: false
          schema:
            type: array
            items:
              type: string
        - name: from_date
          in: query
          description: >-
            The from date in the selected timezone in 24-h format: YYYY-MM-DD
            HH:mm:ss. Default is the current time minus 1 day
          required: true
          schema:
            type: string
        - name: to_date
          in: query
          description: >-
            The to date in the selected timezone in 24-h format: YYYY-MM-DD
            HH:mm:ss. Default is the current time
          required: true
          schema:
            type: string
        - name: timezone
          in: query
          description: The selected timezone or the 'auto' value (the account location)
          required: false
          schema:
            type: string
            default: UTC
        - name: interval
          in: query
          description: 'Interval format: YYYY-MM-DD HH:mm:ss. Default is 1 day'
          required: false
          schema:
            type: string
            default: 0-0-1 0:0:0
        - name: report_type
          in: query
          description: >-
            The report type. Possible values are: calls_blocked_percentage,
            count_blocked_calls, im_blocked_chats_percentage,
            im_count_blocked_chats, im_answered_chats_rate,
            average_abandonment_rate, count_abandonment_calls, service_level,
            im_service_level, occupancy_rate, im_agent_occupancy_rate,
            agent_utilization_rate, im_agent_utilization_rate,
            sum_agents_online_time, sum_agents_ready_time,
            sum_agents_dialing_time, sum_agents_in_service_time,
            sum_agents_in_service_incoming_time,
            sum_agents_in_service_outcoming_time, sum_agents_afterservice_time,
            sum_agents_dnd_time, sum_agents_custom_1_time,
            sum_agents_custom_2_time, sum_agents_custom_3_time,
            sum_agents_custom_4_time, sum_agents_custom_5_time,
            sum_agents_custom_6_time, sum_agents_custom_7_time,
            sum_agents_custom_8_time, sum_agents_custom_9_time,
            sum_agents_custom_10_time, sum_agents_banned_time,
            im_sum_agents_online_time, im_sum_agents_ready_time,
            im_sum_agents_in_service_time, im_sum_agents_dnd_time,
            im_sum_agents_custom_1_time, im_sum_agents_custom_2_time,
            im_sum_agents_custom_3_time, im_sum_agents_custom_4_time,
            im_sum_agents_custom_5_time, im_sum_agents_custom_6_time,
            im_sum_agents_custom_7_time, im_sum_agents_custom_8_time,
            im_sum_agents_custom_9_time, im_sum_agents_custom_10_time,
            im_sum_agents_banned_time, average_agents_idle_time,
            max_agents_idle_time, min_agents_idle_time,
            percentile_0_25_agents_idle_time, percentile_0_50_agents_idle_time,
            percentile_0_75_agents_idle_time, min_time_in_queue,
            max_time_in_queue, average_time_in_queue, min_answer_speed,
            max_answer_speed, average_answer_speed, im_min_answer_speed,
            im_max_answer_speed, im_average_answer_speed, min_handle_time,
            max_handle_time, average_handle_time, count_handled_calls,
            min_after_call_worktime, max_after_call_worktime,
            average_after_call_worktime, count_agent_unanswered_calls,
            im_count_agent_unanswered_chats, min_reaction_time,
            max_reaction_time, average_reaction_time, im_min_reaction_time,
            im_max_reaction_time, im_average_reaction_time,
            im_count_abandonment_chats, im_count_lost_chats, im_lost_chats_rate,
            call_count_assigned_to_queue, im_count_assigned_to_queue
          required: true
          schema:
            type: array
            items:
              type: string
        - name: group_by
          in: query
          description: >-
            Group the result by **agent** or *queue*. The **agent** grouping is
            allowed only for 1 queue and for the occupancy_rate,
            sum_agents_online_time, sum_agents_ready_time,
            sum_agents_dialing_time, sum_agents_in_service_time,
            sum_agents_afterservice_time, sum_agents_dnd_time,
            sum_agents_banned_time, min_handle_time, max_handle_time,
            average_handle_time, count_handled_calls, min_after_call_worktime,
            max_after_call_worktime, average_after_call_worktime report types.
            The **queue** grouping allowed for the calls_blocked_percentage,
            count_blocked_calls, average_abandonment_rate,
            count_abandonment_calls, service_level, occupancy_rate,
            min_time_in_queue, max_time_in_queue, average_time_in_queue,
            min_answer_speed, max_answer_speed, average_answer_speed,
            min_handle_time, max_handle_time, average_handle_time,
            count_handled_calls, min_after_call_worktime,
            max_after_call_worktime, average_after_call_worktime report types
          required: false
          schema:
            type: string
        - name: max_waiting_sec
          in: query
          description: Maximum waiting time. Required for the **service_level** report type
          required: false
          schema:
            type: integer
        - name: Authorization
          in: header
          description: >-
            Voximplant Management API uses signed JWT tokens generated from your
            service-account private key. Pass the token in the `Authorization`
            header as a Bearer value:


            ```

            Authorization: Bearer $VOXIMPLANT_TOKEN

            ```


            See [Authorization](/api-reference/management-api/authorization) for
            ready-to-copy snippets in bash, Python, Node.js and Go that turn
            your `credentials.json` into a token.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/smartqueue_RequestSmartQueueHistory_Response_200
servers:
  - url: https://api.voximplant.com/platform_api
components:
  schemas:
    smartqueue_RequestSmartQueueHistory_Response_200:
      type: object
      properties:
        result:
          type: integer
          description: Returns 1 if the request has been completed successfully
        history_report_id:
          type: integer
          description: History report ID
      title: smartqueue_RequestSmartQueueHistory_Response_200
  securitySchemes:
    JwtAuth:
      type: http
      scheme: bearer
      description: >-
        Voximplant Management API uses signed JWT tokens generated from your
        service-account private key. Pass the token in the `Authorization`
        header as a Bearer value:


        ```

        Authorization: Bearer $VOXIMPLANT_TOKEN

        ```


        See [Authorization](/api-reference/management-api/authorization) for
        ready-to-copy snippets in bash, Python, Node.js and Go that turn your
        `credentials.json` into a token.

```

## SDK Code Examples

```python Generated csv report
import requests

url = "https://api.voximplant.com/platform_api/RequestSmartQueueHistory"

querystring = {"sq_queue_id":"[1024]","from_date":"2021-03-17 00:00:00","to_date":"2021-03-17 22:00:00","report_type":"[\"service_level\"]","max_waiting_sec":"20"}

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, params=querystring)

print(response.json())
```

```javascript Generated csv report
const url = 'https://api.voximplant.com/platform_api/RequestSmartQueueHistory?sq_queue_id=%5B1024%5D&from_date=2021-03-17+00%3A00%3A00&to_date=2021-03-17+22%3A00%3A00&report_type=%5B%22service_level%22%5D&max_waiting_sec=20';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Generated csv report
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.voximplant.com/platform_api/RequestSmartQueueHistory?sq_queue_id=%5B1024%5D&from_date=2021-03-17+00%3A00%3A00&to_date=2021-03-17+22%3A00%3A00&report_type=%5B%22service_level%22%5D&max_waiting_sec=20"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Generated csv report
require 'uri'
require 'net/http'

url = URI("https://api.voximplant.com/platform_api/RequestSmartQueueHistory?sq_queue_id=%5B1024%5D&from_date=2021-03-17+00%3A00%3A00&to_date=2021-03-17+22%3A00%3A00&report_type=%5B%22service_level%22%5D&max_waiting_sec=20")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java Generated csv report
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.voximplant.com/platform_api/RequestSmartQueueHistory?sq_queue_id=%5B1024%5D&from_date=2021-03-17+00%3A00%3A00&to_date=2021-03-17+22%3A00%3A00&report_type=%5B%22service_level%22%5D&max_waiting_sec=20")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php Generated csv report
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.voximplant.com/platform_api/RequestSmartQueueHistory?sq_queue_id=%5B1024%5D&from_date=2021-03-17+00%3A00%3A00&to_date=2021-03-17+22%3A00%3A00&report_type=%5B%22service_level%22%5D&max_waiting_sec=20', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Generated csv report
using RestSharp;

var client = new RestClient("https://api.voximplant.com/platform_api/RequestSmartQueueHistory?sq_queue_id=%5B1024%5D&from_date=2021-03-17+00%3A00%3A00&to_date=2021-03-17+22%3A00%3A00&report_type=%5B%22service_level%22%5D&max_waiting_sec=20");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Generated csv report
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.voximplant.com/platform_api/RequestSmartQueueHistory?sq_queue_id=%5B1024%5D&from_date=2021-03-17+00%3A00%3A00&to_date=2021-03-17+22%3A00%3A00&report_type=%5B%22service_level%22%5D&max_waiting_sec=20")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```