Skip to content

Create an employee account

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

Creates an account with the member role in the organization associated with the API key. If you supply an email, the employee receives their sign-in details there.

If the login already belongs to a registered user outside your organization, the service sends them an invitation. The password, name, and phone number in the request do not change the existing account. Until the user accepts, only their login is visible in the employee list. The response has the same structure as for a new account, but the returned userId does not identify the invited account.

If another organization created the account, the service returns the same response without sending an invitation. The account will not appear in your employee list.

Request headers

ParameterTypeDescription
Authorization*stringAPI key

Request parameters

ParameterTypeDescription
login*stringEmployee login (any string from 1 to 255 characters)
password*stringPassword (at least 5 characters)
emailstringEmail address, unique within the organization
firstNamestringFirst name
lastNamestringLast name
phonestringPhone number (any string)
avatarstringAvatar

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 = {
"login": "ivanov@example.com",
"password": "secret123",
"email": "ivanov@example.com",
"firstName": "Иван",
"lastName": "Иванов"
}
request = Request(
"https://gptunnel.ru/api/v1/employees/createEmployee",
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,
"userId": "66a346f64dcb57627c03d596"
}