Import employees in bulk
Mass imports of employees
Section titled “Mass imports of employees”https://gptunnel.ru/api/v1/employees/importEmployeesThe 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
| Parameter | Type | Description |
|---|---|---|
Authorization* | string | API key |
Request parameters
| Parameter | Type | Description |
|---|---|---|
emails* | string[] | An array of 1 to 25 email addresses. For each new account, the email address becomes the login. |
Error reasons
| Parameter | Type | Description |
|---|---|---|
invalid_email | string | Incorrect email format |
already_exists | string | An employee with this login or email already exists in the organization. |
error | string | Unforeseen error in creation |
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 = { "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))curl --request POST \ --url 'https://gptunnel.ru/api/v1/employees/importEmployees' \ --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \ --header 'Content-Type: application/json' \ --data '{ "emails": [ "ivanov@example.com", "petrov@example.com" ]}'const key = process.env.GPTUNNEL_API_KEYif (!key) throw new Error("Set GPTUNNEL_API_KEY")
const body = { "emails": [ "ivanov@example.com", "petrov@example.com" ]}const response = await fetch("https://gptunnel.ru/api/v1/employees/importEmployees", { 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, "created": 1, "failed": 1, "failedEmails": [ { "email": "petrov@example.com", "reason": "already_exists", "message": "Employee with this login or email is already in the organization." } ]}{ "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": 43, "message": "Too many employee creation requests, retry later."}{ "code": 1, "message": "Internal server error.", "trace_id": "66a346f64dcb57627c03d596"}