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

# GetSmartQueueDayHistory

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

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

**Example request:** Get the time agents spent in the ONLINE status for all SmartQueues within one application.

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

## OpenAPI Specification

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


        **Example request:** Get the time agents spent in the ONLINE status for
        all SmartQueues within one application.
      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 (;). **user_name** 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: false
          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: false
          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_GetSmartQueueDayHistory_Response_200
servers:
  - url: https://api.voximplant.com/platform_api
components:
  schemas:
    SmartQueueMetricsGroupsValues:
      type: object
      properties:
        from_date:
          type: string
          description: |-
            Timestamp in YYYY-MM-DD HH:mm:ss format.

            The start of the period
        to_date:
          type: string
          description: |-
            Timestamp in YYYY-MM-DD HH:mm:ss format.

            The end of the period
        value:
          type: integer
          description: The report value
      description: The [SmartQueueMetricsGroups] details.
      title: SmartQueueMetricsGroupsValues
    SmartQueueMetricsGroups:
      type: object
      properties:
        sq_queue_id:
          type: integer
          description: The SmartQueue ID
        sq_queue_name:
          type: string
          description: The SmartQueue name
        user_id:
          type: integer
          description: The user ID
        user_name:
          type: string
          description: The user name
        user_display_name:
          type: string
          description: The user display name
        values:
          type: array
          items:
            $ref: '#/components/schemas/SmartQueueMetricsGroupsValues'
          description: The group values
      description: The [SmartQueueMetricsResult] details.
      title: SmartQueueMetricsGroups
    SmartQueueMetricsResult:
      type: object
      properties:
        report_type:
          type: string
          description: >-
            The report type(s). Possible values are calls_blocked_percentage,
            count_blocked_calls, average_abandonment_rate,
            count_abandonment_calls, service_level, 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_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,
            sum_agents_custom_1_time ... sum_agents_custom_10_time,
            call_count_assigned_to_queue, im_count_assigned_to_queue
        groups:
          type: array
          items:
            $ref: '#/components/schemas/SmartQueueMetricsGroups'
          description: Grouping by agent or queue
      description: The [GetSmartQueueRealtimeMetrics] function result.
      title: SmartQueueMetricsResult
    smartqueue_GetSmartQueueDayHistory_Response_200:
      type: object
      properties:
        result:
          type: array
          items:
            $ref: '#/components/schemas/SmartQueueMetricsResult'
        timezone:
          type: string
          description: The used timezone, e.g., 'Etc/GMT'
      title: smartqueue_GetSmartQueueDayHistory_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 Online status statistics
import requests

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

querystring = {"sq_queue_id":"[1]","report_type":"[\"string\"]"}

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript Online status statistics
const url = 'https://api.voximplant.com/platform_api/GetSmartQueueDayHistory?sq_queue_id=%5B1%5D&report_type=%5B%22string%22%5D';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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

```go Online status statistics
package main

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

func main() {

	url := "https://api.voximplant.com/platform_api/GetSmartQueueDayHistory?sq_queue_id=%5B1%5D&report_type=%5B%22string%22%5D"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

```ruby Online status statistics
require 'uri'
require 'net/http'

url = URI("https://api.voximplant.com/platform_api/GetSmartQueueDayHistory?sq_queue_id=%5B1%5D&report_type=%5B%22string%22%5D")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

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

```java Online status statistics
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.voximplant.com/platform_api/GetSmartQueueDayHistory?sq_queue_id=%5B1%5D&report_type=%5B%22string%22%5D")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Online status statistics
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.voximplant.com/platform_api/GetSmartQueueDayHistory?sq_queue_id=%5B1%5D&report_type=%5B%22string%22%5D', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Online status statistics
using RestSharp;

var client = new RestClient("https://api.voximplant.com/platform_api/GetSmartQueueDayHistory?sq_queue_id=%5B1%5D&report_type=%5B%22string%22%5D");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Online status statistics
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.voximplant.com/platform_api/GetSmartQueueDayHistory?sq_queue_id=%5B1%5D&report_type=%5B%22string%22%5D")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```