# Lấy danh sách agent

Lấy các agent trong tài khoản, ví dụ để tìm ID agent.

API 4.1

Dùng endpoint này để lấy các agent trong tài khoản, ví dụ để tìm ID agent dùng khi [mời agent](/developers/vi/api-reference/conversations/invite-agent) hoặc [giao agent](/developers/vi/api-reference/conversations/assign-agent).

Tài khoản được lấy từ access token. Không có tham số và không có body.

## Phản hồi

Yêu cầu thành công trả HTTP `200` cùng một **mảng** JSON các agent, không phải một đối tượng:

```json
[
  {
    "id": "agent_example",
    "account_id": "account_example",
    "type": "agent",
    "state": "active",
    "fullname": "Sam Example",
    "email": "sam@example.com",
    "scopes": [
      "supervisor"
    ]
  },
  {
    "id": "agent_second_example",
    "account_id": "account_example",
    "type": "agent",
    "state": "pending",
    "fullname": "Jamie Example",
    "email": "jamie@example.com"
  }
]
```

Ví dụ này hiển thị một số trường. Xem [Định dạng agent](/developers/vi/agents/format) để biết mọi trường và giá trị `state`. Danh sách không phân trang.

Lọc mảng trong code của bạn. Ví dụ, chỉ giữ agent có `state` là `active` trước khi hiển thị làm lựa chọn để giao việc.

## Đường dẫn khác

`GET https://api.subiz.com.vn/4.0/agents` và `GET https://api.subiz.com.vn/4.0/accounts/YOUR_ACCID/agents` trả về cùng danh sách.

## Yêu cầu HTTP

Thay `YOUR_ACCESS_TOKEN` bằng token của bạn.

```http
GET https://api.subiz.com.vn/4.1/agents
Authorization: Bearer YOUR_ACCESS_TOKEN
```