Users
Create user
Create a new user for the current account (requires account-id header)
POST
/
api
/
v1
/
users
Create user
curl --request POST \
--url https://api.evoai.app/api/v1/users \
--header 'Content-Type: application/json' \
--header 'account-id: <account-id>' \
--header 'api_access_token: <api-key>' \
--data '
{
"name": "<string>",
"email": "[email protected]",
"password": "<string>",
"auto_offline": true,
"custom_attributes": {}
}
'import requests
url = "https://api.evoai.app/api/v1/users"
payload = {
"name": "<string>",
"email": "[email protected]",
"password": "<string>",
"auto_offline": True,
"custom_attributes": {}
}
headers = {
"account-id": "<account-id>",
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'account-id': '<account-id>',
api_access_token: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
email: '[email protected]',
password: '<string>',
auto_offline: true,
custom_attributes: {}
})
};
fetch('https://api.evoai.app/api/v1/users', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.evoai.app/api/v1/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'email' => '[email protected]',
'password' => '<string>',
'auto_offline' => true,
'custom_attributes' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"account-id: <account-id>",
"api_access_token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.evoai.app/api/v1/users"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"email\": \"[email protected]\",\n \"password\": \"<string>\",\n \"auto_offline\": true,\n \"custom_attributes\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("account-id", "<account-id>")
req.Header.Add("api_access_token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.evoai.app/api/v1/users")
.header("account-id", "<account-id>")
.header("api_access_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"email\": \"[email protected]\",\n \"password\": \"<string>\",\n \"auto_offline\": true,\n \"custom_attributes\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.evoai.app/api/v1/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["account-id"] = '<account-id>'
request["api_access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"email\": \"[email protected]\",\n \"password\": \"<string>\",\n \"auto_offline\": true,\n \"custom_attributes\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"email": "[email protected]",
"type": "User",
"role": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "<string>",
"name": "<string>"
},
"pubsub_token": "<string>",
"display_name": "<string>",
"availability": "online",
"mfa_enabled": true,
"confirmed": true,
"custom_attributes": {},
"ui_settings": {},
"is_super_admin": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
},
"message": "<string>"
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Required parameter missing: user"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"path": "/api/v1/users",
"method": "POST"
}
}{
"success": false,
"error": {
"code": "INVALID_TOKEN",
"message": "Invalid token"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"path": "/api/v1/users",
"method": "POST"
}
}{
"success": false,
"error": {
"code": "FORBIDDEN",
"message": "You are not authorized to perform this action",
"details": {
"action": "users.create",
"record": "User"
}
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"path": "/api/v1/users",
"method": "POST"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Validation failed",
"details": [
{
"field": "email",
"messages": [
"has already been taken"
],
"full_messages": [
"Email has already been taken"
]
},
{
"field": "password",
"messages": [
"is too short (minimum is 8 characters)"
],
"full_messages": [
"Password is too short (minimum is 8 characters)"
]
}
]
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"path": "/api/v1/users",
"method": "POST"
}
}{
"success": false,
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"path": "/api/v1/users",
"method": "POST"
}
}Autorizações
API access token authentication
Cabeçalhos
Account ID (required)
Corpo
application/json
User full name
Minimum string length:
1User email address
User password (optional, will be auto-generated if not provided)
Minimum string length:
8User role
Opções disponíveis:
administrator, agent User availability status
Opções disponíveis:
online, offline, busy Whether user should be automatically set to offline
Custom user attributes
⌘I
Create user
curl --request POST \
--url https://api.evoai.app/api/v1/users \
--header 'Content-Type: application/json' \
--header 'account-id: <account-id>' \
--header 'api_access_token: <api-key>' \
--data '
{
"name": "<string>",
"email": "[email protected]",
"password": "<string>",
"auto_offline": true,
"custom_attributes": {}
}
'import requests
url = "https://api.evoai.app/api/v1/users"
payload = {
"name": "<string>",
"email": "[email protected]",
"password": "<string>",
"auto_offline": True,
"custom_attributes": {}
}
headers = {
"account-id": "<account-id>",
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'account-id': '<account-id>',
api_access_token: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
email: '[email protected]',
password: '<string>',
auto_offline: true,
custom_attributes: {}
})
};
fetch('https://api.evoai.app/api/v1/users', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.evoai.app/api/v1/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'email' => '[email protected]',
'password' => '<string>',
'auto_offline' => true,
'custom_attributes' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"account-id: <account-id>",
"api_access_token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.evoai.app/api/v1/users"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"email\": \"[email protected]\",\n \"password\": \"<string>\",\n \"auto_offline\": true,\n \"custom_attributes\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("account-id", "<account-id>")
req.Header.Add("api_access_token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.evoai.app/api/v1/users")
.header("account-id", "<account-id>")
.header("api_access_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"email\": \"[email protected]\",\n \"password\": \"<string>\",\n \"auto_offline\": true,\n \"custom_attributes\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.evoai.app/api/v1/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["account-id"] = '<account-id>'
request["api_access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"email\": \"[email protected]\",\n \"password\": \"<string>\",\n \"auto_offline\": true,\n \"custom_attributes\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"email": "[email protected]",
"type": "User",
"role": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "<string>",
"name": "<string>"
},
"pubsub_token": "<string>",
"display_name": "<string>",
"availability": "online",
"mfa_enabled": true,
"confirmed": true,
"custom_attributes": {},
"ui_settings": {},
"is_super_admin": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
},
"message": "<string>"
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Required parameter missing: user"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"path": "/api/v1/users",
"method": "POST"
}
}{
"success": false,
"error": {
"code": "INVALID_TOKEN",
"message": "Invalid token"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"path": "/api/v1/users",
"method": "POST"
}
}{
"success": false,
"error": {
"code": "FORBIDDEN",
"message": "You are not authorized to perform this action",
"details": {
"action": "users.create",
"record": "User"
}
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"path": "/api/v1/users",
"method": "POST"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Validation failed",
"details": [
{
"field": "email",
"messages": [
"has already been taken"
],
"full_messages": [
"Email has already been taken"
]
},
{
"field": "password",
"messages": [
"is too short (minimum is 8 characters)"
],
"full_messages": [
"Password is too short (minimum is 8 characters)"
]
}
]
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"path": "/api/v1/users",
"method": "POST"
}
}{
"success": false,
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"path": "/api/v1/users",
"method": "POST"
}
}