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

# SQ_GetAgents

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

Gets agents.

**Example request:** Get all agents with their current statuses.

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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: management-api
  version: 1.0.0
paths:
  /SQ_GetAgents:
    post:
      operationId: sq-get-agents
      summary: SQ_GetAgents
      description: |-
        Gets agents.

        **Example request:** Get all agents with their current statuses.
      tags:
        - subpackage_smartqueue
      parameters:
        - name: application_id
          in: query
          description: Application ID to search by
          required: true
          schema:
            type: integer
        - name: application_name
          in: query
          description: >-
            Application name to search by. Can be used instead of
            **application_id**
          required: false
          schema:
            type: string
        - name: sq_queue_id
          in: query
          description: >-
            List of SmartQueue IDs separated by semicolons (;). Use 'all' to
            select all the queues
          required: false
          schema:
            type: array
            items:
              type: integer
        - name: sq_queue_name
          in: query
          description: >-
            List of SmartQueue names separated by semicolons (;). Can be used
            instead of **sq_queue_id**
          required: false
          schema:
            type: array
            items:
              type: string
        - name: excluded_sq_queue_id
          in: query
          description: ID of the SmartQueue to exclude
          required: false
          schema:
            type: integer
        - name: excluded_sq_queue_name
          in: query
          description: >-
            Name of the SmartQueue to exclude. Can be used instead of
            **excluded_sq_queue_id**
          required: false
          schema:
            type: string
        - name: sq_skills
          in: query
          description: >-
            Skills to filter in the json array format. The array should contain
            objects with the **sq_skill_id**/**sq_skill_name**,
            **min_sq_skill_level**, and **max_sq_skill_level** keys where skill
            levels range from 1 to 5
          required: false
          schema:
            type: object
            additionalProperties:
              description: Any type
        - name: user_id
          in: query
          description: List of user IDs separated by semicolons (;)
          required: false
          schema:
            type: array
            items:
              type: integer
        - name: user_name
          in: query
          description: >-
            List of user names separated by semicolons (;). Can be used instead
            of **user_id**
          required: false
          schema:
            type: array
            items:
              type: string
        - name: user_name_template
          in: query
          description: Substring of the user name to filter
          required: false
          schema:
            type: string
        - name: sq_statuses
          in: query
          description: >-
            Filter statuses in the json array format. The array should contain
            objects with the **sq_status_type** and **sq_status_name** keys.
            Possible values for **sq_status_type** are 'CALL' and 'IM'. Possible
            values for **sq_status_name** are 'OFFLINE', 'ONLINE', 'READY',
            'IN_SERVICE', 'AFTER_SERVICE', 'DND'
          required: false
          schema:
            type: object
            additionalProperties:
              description: Any type
        - name: with_sq_skills
          in: query
          description: Whether to display agent skills
          required: false
          schema:
            type: boolean
            default: false
        - name: with_sq_queues
          in: query
          description: Whether to display agent queues
          required: false
          schema:
            type: boolean
            default: false
        - name: with_sq_statuses
          in: query
          description: Whether to display agent current statuses
          required: false
          schema:
            type: boolean
            default: false
        - name: count
          in: query
          description: Number of items to show in the output
          required: false
          schema:
            type: integer
            default: 20
        - name: offset
          in: query
          description: Number of items to skip in the output
          required: false
          schema:
            type: integer
            default: 0
        - name: handle_calls
          in: query
          description: >-
            Whether the agent can handle calls. When set to false, the agent is
            excluded from the CALL-request distribution
          required: true
          schema:
            type: boolean
        - 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_SQ_GetAgents_Response_200'
servers:
  - url: https://api.voximplant.com/platform_api
components:
  schemas:
    GetSqAgentsResultSqStatusesOneOf1Call:
      type: object
      properties:
        sq_status_name:
          type: string
      title: GetSqAgentsResultSqStatusesOneOf1Call
    GetSqAgentsResultSqStatusesOneOf1Im:
      type: object
      properties:
        sq_status_name:
          type: string
      title: GetSqAgentsResultSqStatusesOneOf1Im
    GetSqAgentsResultSqStatuses1:
      type: object
      properties:
        CALL:
          $ref: '#/components/schemas/GetSqAgentsResultSqStatusesOneOf1Call'
        IM:
          $ref: '#/components/schemas/GetSqAgentsResultSqStatusesOneOf1Im'
      title: GetSqAgentsResultSqStatuses1
    GetSqAgentsResultSqStatuses:
      oneOf:
        - type: array
          items:
            description: Any type
        - $ref: '#/components/schemas/GetSqAgentsResultSqStatuses1'
      description: Agent statuses info
      title: GetSqAgentsResultSqStatuses
    GetSQAgentsResult:
      type: object
      properties:
        user_id:
          type: integer
          description: ID of the user
        user_name:
          type: string
          description: Name of the user
        user_display_name:
          type: string
          description: Display name of the user
        max_simultaneous_conversations:
          type: integer
          description: Maximum number of chats that the user processes simultaneously
        sq_statuses:
          $ref: '#/components/schemas/GetSqAgentsResultSqStatuses'
          description: Agent statuses info
        sq_queues:
          type: object
          additionalProperties:
            description: Any type
          description: JSON array of the agent's queues
        sq_skills:
          type: object
          additionalProperties:
            description: Any type
          description: JSON array of the agent's skills
        'user_name:':
          type: string
      description: The [SQ_GetAgents] function result.
      title: GetSQAgentsResult
    smartqueue_SQ_GetAgents_Response_200:
      type: object
      properties:
        result:
          type: array
          items:
            $ref: '#/components/schemas/GetSQAgentsResult'
          description: The found agent(s)
        count:
          type: integer
        total_count:
          type: integer
      title: smartqueue_SQ_GetAgents_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 Example 1
import requests

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

querystring = {"application_id":"1","handle_calls":"true"}

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

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

print(response.json())
```

```javascript Example 1
const url = 'https://api.voximplant.com/platform_api/SQ_GetAgents?application_id=1&handle_calls=true';
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 Example 1
package main

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

func main() {

	url := "https://api.voximplant.com/platform_api/SQ_GetAgents?application_id=1&handle_calls=true"

	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 Example 1
require 'uri'
require 'net/http'

url = URI("https://api.voximplant.com/platform_api/SQ_GetAgents?application_id=1&handle_calls=true")

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 Example 1
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.voximplant.com/platform_api/SQ_GetAgents?application_id=1&handle_calls=true")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Example 1
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.voximplant.com/platform_api/SQ_GetAgents?application_id=1&handle_calls=true', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Example 1
using RestSharp;

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

```swift Example 1
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.voximplant.com/platform_api/SQ_GetAgents?application_id=1&handle_calls=true")! 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()
```