List employees
Staff list
Section titled “Staff list”https://gptunnel.ru/api/v1/employees/getEmployeesReturns up to 25 employees per page with their roles and teams. You can filter by email, login, team, or role.
The key creator can see employees with an equal or lower role. An owner can see other owners, administrators, team managers and members. An administrator can see other administrators, team managers and members.
Request headers
| Parameter | Type | Description |
|---|---|---|
Authorization* | string | API key |
Request parameters
| Parameter | Type | Description |
|---|---|---|
page | number | Page number from 1 to 40,000 |
email | string | Filter by email address. Partial matches are supported. |
login | string | Filter by login. Partial matches are supported. |
teamId | string | Filter by team ID. Returns HTTP 404 if the team does not belong to the organization. |
role | string | Role filter: owner, admin, member or manager (team manager) |
Successful response schema (200 OK)
Section titled “Successful response schema (200 OK)”Top level:
Response
| Parameter | Type | Description |
|---|---|---|
code* | number | Result code. 0 indicates success. |
items* | Employee[] | Employees on the current page. See Employee fields below. |
page* | number | Current page number |
pageSize* | number | Maximum number of employees per page (25). |
count* | number | Number of employees on the current page (at most pageSize; the last page may contain fewer) |
total* | number | Total number of employees matching the filters across all pages. |
totalPages* | number | Total pages |
Each element of items is an Employee object.
Employee fields
| Parameter | Type | Description |
|---|---|---|
email* | string | Email address. May be an empty string. |
login* | string | Login |
phone* | string | Phone number. May be an empty string. |
firstName* | string | Given name. May be an empty string. |
lastName* | string | Family name. May be an empty string. |
role* | string | null | Role in the organization: owner, admin, member or manager (null — if the role is outside this set) |
teamIds* | string[] | IDs of the teams the employee belongs to. An empty array means no teams. |
If an existing account has a pending invitation, the employee still appears in the list. The response includes login, role and teamIds, but email, phone, firstName and lastName are empty, so an email filter will not find that employee. The remaining fields become available after the invitation is accepted.
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, "login": "iv"}request = Request( "https://gptunnel.ru/api/v1/employees/getEmployees", 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/getEmployees' \ --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \ --header 'Content-Type: application/json' \ --data '{ "page": 1, "login": "iv"}'const key = process.env.GPTUNNEL_API_KEYif (!key) throw new Error("Set GPTUNNEL_API_KEY")
const body = { "page": 1, "login": "iv"}const response = await fetch("https://gptunnel.ru/api/v1/employees/getEmployees", { 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": [ { "email": "ivanov@example.com", "login": "ivanov", "phone": "+70000000000", "firstName": "Иван", "lastName": "Иванов", "role": "member", "teamIds": ["66a346f64dcb57627c03d596", "5f1c9a0b2e3d4c5a6b7c8d9e"] } ], "page": 1, "pageSize": 25, "count": 1, "total": 1, "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": 11, "message": "Team not found in the organization."}{ "code": 1, "message": "Internal server error.", "trace_id": "66a346f64dcb57627c03d596"}