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

# GetSQState

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

Gets the current state of the specified SmartQueue.

**Example request:** Get the current state of the SmartQueue with id = 1.

Reference: https://docs.voximplant.ai/api-reference/management-api/reference/smartqueue/get-sq-state

## Authentication

- `Authorization` header (bearer token, required) — 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.

## Request

### Query parameters

- `application_id` (integer, required) — The application ID to search by
- `application_name` (string, optional) — The application name to search by. Can be used instead of the **application_id** parameter
- `sq_queue_id` (list of integer, required) — The SmartQueue ID list separated by semicolons (;). Use the 'all' value to select all SmartQueues
- `sq_queue_name` (list of string, optional) — The SmartQueue name list separated by semicolons (;). Can be used instead of **sq_queue_id**
- `timezone` (string, optional, default: UTC) — The selected timezone or the 'auto' value (the account location)

## Response

### 200

Successful response

- `result` (list of SmartQueueState, optional)

## Types

### SmartQueueState

The [GetSQState] function result.

- `sq_queue_id` (integer, optional) — The SmartQueue ID
- `sq_queue_name` (string, optional) — The SmartQueue name
- `sq_agents` (list of SmartQueueState_Agent, optional) — The list of logged-in agents with their skills and statuses
- `tasks` (list of SmartQueueState_Task, optional) — The list of tasks

### SmartQueueState_Agent

SmartQueueState.sq_agents item.

- `user_id` (integer, optional) — The user ID
- `user_name` (string, optional) — The user name
- `user_display_name` (string, optional) — The display user name
- `sq_skills` (list of SmartQueueAgent_Skill, optional) — Agent skills
- `sq_statuses` (SmartQueueStateAgentSqStatuses, optional) — Agent statuses info

### SmartQueueState_Task

SmartQueueState.tasks item.

- `task_type` (string, optional) — The task type. Possible values are CALL, IM
- `status` (string, optional) — The task status. Possible values are IN_QUEUE, DISTRIBUTED, IN_PROCESSING
- `user_id` (integer, optional) — Selected agent
- `sq_skills` (list of SmartQueueTask_Skill, optional) — Task skills
- `waiting_time` (integer, optional) — Waiting time in ms
- `processing_time` (integer, optional) — Processing time in ms
- `custom_data` (map from string to any, optional) — Custom data text string for the current task. You can set the custom data in the [enqueueTask](/api-reference/voxengine/voxengine#enqueuetask) method

### SmartQueueAgent_Skill

Agent skill info.

- `sq_skill_id` (integer, optional) — The agent skill ID
- `sq_skill_name` (string, optional) — The agent skill name
- `sq_skill_level` (integer, optional) — The agent skill level

### SmartQueueStateAgentSqStatuses

Agent statuses info

- list of any
- SmartQueueStateAgentSqStatuses1

### SmartQueueTask_Skill

Task skill info.

- `sq_skill_name` (string, optional) — The skill name
- `sq_skill_level` (integer, optional) — The skill level

### SmartQueueStateAgentSqStatuses1

- `CALL` (SmartQueueStateAgentSqStatusesOneOf1Call, optional)
- `IM` (SmartQueueStateAgentSqStatusesOneOf1Im, optional)

### SmartQueueStateAgentSqStatusesOneOf1Call

- `from_date` (string, optional)
- `sq_status_name` (string, optional)

### SmartQueueStateAgentSqStatusesOneOf1Im

- `from_date` (string, optional)
- `sq_status_name` (string, optional)

## Examples

**Response**

```json
{
  "result": [
    {
      "sq_queue_id": 1,
      "sq_queue_name": "queue_name_1",
      "sq_agents": [
        {
          "user_id": 1,
          "user_name": "user-1",
          "user_display_name": "Sylvester Stallone",
          "sq_skills": [
            {
              "sq_skill_id": 1,
              "sq_skill_name": "skill_1",
              "sq_skill_level": 5
            }
          ],
          "sq_statuses": {
            "CALL": {
              "from_date": "2021-05-25 12:24:44",
              "sq_status_name": "ONLINE"
            },
            "IM": {
              "from_date": "2021-05-25 12:24:44",
              "sq_status_name": "ONLINE"
            }
          }
        },
        {
          "user_id": 2,
          "user_name": "user-2",
          "user_display_name": "Chuck Norris",
          "sq_skills": [
            {
              "sq_skill_id": 3,
              "sq_skill_name": "skill_3",
              "sq_skill_level": 2
            }
          ],
          "sq_statuses": {
            "CALL": {
              "from_date": "2021-05-25 12:35:58",
              "sq_status_name": "DND"
            },
            "IM": {
              "from_date": "2021-05-25 12:35:58",
              "sq_status_name": "DND"
            }
          }
        },
        {
          "user_id": 3,
          "user_name": "user-3",
          "user_display_name": "Sylvester Norris",
          "sq_skills": [],
          "sq_statuses": {
            "CALL": {
              "from_date": "2021-05-25 12:32:43",
              "sq_status_name": "DND"
            },
            "IM": {
              "from_date": "2021-05-25 12:32:43",
              "sq_status_name": "DND"
            }
          }
        }
      ],
      "tasks": []
    }
  ]
}
```

**SDK Code**

```python SmartQueue state
import requests

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

querystring = {"application_id":"1","sq_queue_id":"[1]"}

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

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

print(response.json())
```

```javascript SmartQueue state
const url = 'https://api.voximplant.com/platform_api/GetSQState?application_id=1&sq_queue_id=%5B1%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 SmartQueue state
package main

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

func main() {

	url := "https://api.voximplant.com/platform_api/GetSQState?application_id=1&sq_queue_id=%5B1%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 SmartQueue state
require 'uri'
require 'net/http'

url = URI("https://api.voximplant.com/platform_api/GetSQState?application_id=1&sq_queue_id=%5B1%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 SmartQueue state
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

```php SmartQueue state
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp SmartQueue state
using RestSharp;

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

```swift SmartQueue state
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.voximplant.com/platform_api/GetSQState?application_id=1&sq_queue_id=%5B1%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()
```