List teams
List teams
Section titled “List teams”POST
https://gptunnel.ru/api/v1/employees/getTeamsSend a POST request to list up to 25 teams per page. For each team, userIds and logins include only members whose role is below the caller’s. Owners can see admins, team managers, and members. Admins can see team managers and members. A team may have empty member arrays.
To filter the list, pass teamIds. Use a returned teamId to read the team’s access settings.
Request headers
| Parameter | Type | Description |
|---|---|---|
Authorization* | string | API key |
Request parameters
| Parameter | Type | Description |
|---|---|---|
page | number | Page number from 1 to 40,000. Defaults to 1. |
teamIds | string[] | Optional list of 1 to 25 team IDs. Omit it to list all teams. |
Successful response (200 OK)
Section titled “Successful response (200 OK)”Response
| Parameter | Type | Description |
|---|---|---|
code* | number | Result code. 0 indicates success. |
items* | Team[] | Teams on the current page (see Team below) |
page* | number | Current page number |
pageSize* | number | Maximum number of teams per page (25) |
count* | number | Number of teams on the current page (at most pageSize; the last page may contain fewer) |
total* | number | Total number of matching teams across all pages |
totalPages* | number | Total pages |
Team Fields
| Parameter | Type | Description |
|---|---|---|
teamId* | string | Team ID |
teamName* | string | Team name |
userIds* | string[] | IDs of visible team members. The array may be empty. |
logins* | string[] | Team member logins, in the same order as userIds. The array may be empty. |
Example request
Section titled “Example request”Set GPTUNNEL_API_KEY and replace the placeholders with values for your organization.
import jsonimport osfrom urllib.request import Request, urlopen
key = os.environ.get("GPTUNNEL_API_KEY")if not key: raise SystemExit("Set GPTUNNEL_API_KEY")
body = { "page": 1}request = Request( "https://gptunnel.ru/api/v1/employees/getTeams", method="POST", headers={ "Authorization": key, "Content-Type": "application/json", }, data=json.dumps(body).encode("utf-8"),)with urlopen(request, timeout=30) as response: print(json.load(response))curl --request POST \ --url 'https://gptunnel.ru/api/v1/employees/getTeams' \ --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \ --header 'Content-Type: application/json' \ --data '{ "page": 1}'const key = process.env.GPTUNNEL_API_KEYif (!key) throw new Error("Set GPTUNNEL_API_KEY")
const body = { "page": 1}const response = await fetch("https://gptunnel.ru/api/v1/employees/getTeams", { method: "POST", headers: { Authorization: key, "Content-Type": "application/json", }, body: JSON.stringify(body),})if (!response.ok) throw new Error(await response.text())console.log(await response.json())Example response
Section titled “Example response”{ "code": 0, "items": [ { "teamId": "66a346f64dcb57627c03d596", "teamName": "Маркетинг", "userIds": ["66b1...", "66b2..."], "logins": ["ivanov", "petrov"] }, { "teamId": "5f1c9a0b2e3d4c5a6b7c8d9e", "teamName": "Продажи", "userIds": [], "logins": [] } ], "page": 1, "pageSize": 25, "count": 2, "total": 2, "totalPages": 1}{ "code": 3, "message": "Invalid input, check schema issues.", "details": []}{ "error": { "message": "Unauthorized", "type": "unauthorized_request_error", "param": null, "code": null }}{ "code": 7, "message": "Not allowed to perform this action for the organization."}{ "code": 13, "message": "This section is not available from a personal account. Use a business organization API key."}{ "code": 1, "message": "Internal server error.", "trace_id": "66a346f64dcb57627c03d596"}