Skip to content

Import employees in bulk

POSThttps://gptunnel.ru/api/v1/employees/importEmployees

The API processes each address in emails separately. For a new account, the email address becomes the login. GPTunneL generates a password and emails the credentials to the employee. An invalid address or the address of an active employee does not cause the entire batch to fail. The response is HTTP 200. Check failed for the number of rejected addresses and failedEmails for the reasons. If every address is rejected, created is 0.

If an address belongs to an existing account outside your organization, the API sends an invitation instead of creating another account, just as it does for a dashboard invitation. The address counts toward created. The employee joins the organization after accepting. Until then, only their login is visible in the employee list. Accounts created by another organization cannot be invited. The response looks the same, but the employee does not appear in the list.

Request headers

ParameterTypeDescription
Authorization*stringAPI key

Request parameters

ParameterTypeDescription
emails*string[]An array of 1 to 25 email addresses. For each new account, the email address becomes the login.

Error reasons

ParameterTypeDescription
invalid_emailstringIncorrect email format
already_existsstringAn employee with this login or email already exists in the organization.
errorstringUnforeseen error in creation

Set GPTUNNEL_API_KEY and replace the placeholders with values for your organization.

import json
import os
from urllib.request import Request, urlopen
key = os.environ.get("GPTUNNEL_API_KEY")
if not key:
raise SystemExit("Set GPTUNNEL_API_KEY")
body = {
"emails": [
"ivanov@example.com",
"petrov@example.com"
]
}
request = Request(
"https://gptunnel.ru/api/v1/employees/importEmployees",
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))
{
"code": 0,
"created": 1,
"failed": 1,
"failedEmails": [
{
"email": "petrov@example.com",
"reason": "already_exists",
"message": "Employee with this login or email is already in the organization."
}
]
}