> 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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: management-api
  version: 1.0.0
paths:
  /GetSQState:
    post:
      operationId: get-sq-state
      summary: GetSQState
      description: >-
        Gets the current state of the specified SmartQueue.


        **Example request:** Get the current state of the SmartQueue with id =
        1.
      tags:
        - subpackage_smartqueue
      parameters:
        - name: application_id
          in: query
          description: The application ID to search by
          required: true
          schema:
            type: integer
        - name: application_name
          in: query
          description: >-
            The application name to search by. Can be used instead of the
            **application_id** parameter
          required: false
          schema:
            type: string
        - name: sq_queue_id
          in: query
          description: >-
            The SmartQueue ID list separated by semicolons (;). Use the 'all'
            value to select all SmartQueues
          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: timezone
          in: query
          description: The selected timezone or the 'auto' value (the account location)
          required: false
          schema:
            type: string
            default: UTC
        - 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_GetSQState_Response_200'
servers:
  - url: https://api.voximplant.com/platform_api
components:
  schemas:
    SmartQueueAgent_Skill:
      type: object
      properties:
        sq_skill_id:
          type: integer
          description: The agent skill ID
        sq_skill_name:
          type: string
          description: The agent skill name
        sq_skill_level:
          type: integer
          description: The agent skill level
      description: Agent skill info.
      title: SmartQueueAgent_Skill
    SmartQueueStateAgentSqStatusesOneOf1Call:
      type: object
      properties:
        from_date:
          type: string
        sq_status_name:
          type: string
      title: SmartQueueStateAgentSqStatusesOneOf1Call
    SmartQueueStateAgentSqStatusesOneOf1Im:
      type: object
      properties:
        from_date:
          type: string
        sq_status_name:
          type: string
      title: SmartQueueStateAgentSqStatusesOneOf1Im
    SmartQueueStateAgentSqStatuses1:
      type: object
      properties:
        CALL:
          $ref: '#/components/schemas/SmartQueueStateAgentSqStatusesOneOf1Call'
        IM:
          $ref: '#/components/schemas/SmartQueueStateAgentSqStatusesOneOf1Im'
      title: SmartQueueStateAgentSqStatuses1
    SmartQueueStateAgentSqStatuses:
      oneOf:
        - type: array
          items:
            description: Any type
        - $ref: '#/components/schemas/SmartQueueStateAgentSqStatuses1'
      description: Agent statuses info
      title: SmartQueueStateAgentSqStatuses
    SmartQueueState_Agent:
      type: object
      properties:
        user_id:
          type: integer
          description: The user ID
        user_name:
          type: string
          description: The user name
        user_display_name:
          type: string
          description: The display user name
        sq_skills:
          type: array
          items:
            $ref: '#/components/schemas/SmartQueueAgent_Skill'
          description: Agent skills
        sq_statuses:
          $ref: '#/components/schemas/SmartQueueStateAgentSqStatuses'
          description: Agent statuses info
      description: SmartQueueState.sq_agents item.
      title: SmartQueueState_Agent
    SmartQueueTask_Skill:
      type: object
      properties:
        sq_skill_name:
          type: string
          description: The skill name
        sq_skill_level:
          type: integer
          description: The skill level
      description: Task skill info.
      title: SmartQueueTask_Skill
    SmartQueueState_Task:
      type: object
      properties:
        task_type:
          type: string
          description: The task type. Possible values are CALL, IM
        status:
          type: string
          description: >-
            The task status. Possible values are IN_QUEUE, DISTRIBUTED,
            IN_PROCESSING
        user_id:
          type: integer
          description: Selected agent
        sq_skills:
          type: array
          items:
            $ref: '#/components/schemas/SmartQueueTask_Skill'
          description: Task skills
        waiting_time:
          type: integer
          description: Waiting time in ms
        processing_time:
          type: integer
          description: Processing time in ms
        custom_data:
          type: object
          additionalProperties:
            description: Any type
          description: >-
            Custom data text string for the current task. You can set the custom
            data in the
            [enqueueTask](/docs/references/voxengine/voxengine/enqueuetask#enqueuetask)
            method
      description: SmartQueueState.tasks item.
      title: SmartQueueState_Task
    SmartQueueState:
      type: object
      properties:
        sq_queue_id:
          type: integer
          description: The SmartQueue ID
        sq_queue_name:
          type: string
          description: The SmartQueue name
        sq_agents:
          type: array
          items:
            $ref: '#/components/schemas/SmartQueueState_Agent'
          description: The list of logged-in agents with their skills and statuses
        tasks:
          type: array
          items:
            $ref: '#/components/schemas/SmartQueueState_Task'
          description: The list of tasks
      description: The [GetSQState] function result.
      title: SmartQueueState
    smartqueue_GetSQState_Response_200:
      type: object
      properties:
        result:
          type: array
          items:
            $ref: '#/components/schemas/SmartQueueState'
      title: smartqueue_GetSQState_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 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()
```