Skip to main content

Create User

Create a new user account in the Audian platform.

Endpoint​

POST https://api.audian.com:8443/v2/accounts/{accountId}/users

Request​

Headers​

Content-Type: application/json
X-Auth-Token: YOUR_API_TOKEN

Request Body​

ParameterTypeRequiredDescription
firstNamestringYesUser's first name
lastNamestringYesUser's last name
emailstringYesEmail address (must be unique)
usernamestringNoLogin username
extensionstringNoPhone extension
rolestringNoUser role (standard, admin, operator, agent)
phonestringNoPhone number
titlestringNoJob title
departmentstringNoDepartment name
managerstringNoManager user ID
timezonestringNoUser timezone
languagestringNoPreferred language
sendInvitationbooleanNoSend activation email (default: true)
metadataobjectNoCustom metadata

Examples​

Create Basic User​

curl -X POST https://api.audian.com:8443/v2/accounts/acc_1234567890/users \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"firstName": "Alice",
"lastName": "Smith",
"email": "alice.smith@acme.com"
}'

Create User with Full Details​

curl -X POST https://api.audian.com:8443/v2/accounts/acc_1234567890/users \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"firstName": "Alice",
"lastName": "Smith",
"email": "alice.smith@acme.com",
"username": "alice.smith",
"extension": "1001",
"role": "standard",
"phone": "+1-555-0101",
"title": "Sales Executive",
"department": "Sales",
"manager": "user_manager_001",
"timezone": "America/New_York",
"language": "en",
"sendInvitation": true,
"metadata": {
"costCenter": "SALES-01",
"employeeId": "EMP-12345"
}
}'

JavaScript/Node.js Example​

const axios = require('axios');

async function createUser(accountId, userData) {
try {
const response = await axios.post(
`https://api.audian.com:8443/v2/accounts/${accountId}/users`,
userData,
{
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN'
}
}
);

console.log('User created:', response.data);
return response.data;
} catch (error) {
console.error('Error creating user:', error.response.data);
}
}

createUser('acc_1234567890', {
firstName: 'Alice',
lastName: 'Smith',
email: 'alice.smith@acme.com',
extension: '1001',
role: 'standard'
});

Python Example​

import requests

def create_user(account_id, user_data):
url = f'https://api.audian.com:8443/v2/accounts/{account_id}/users'
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN'
}

response = requests.post(url, headers=headers, json=user_data)

if response.status_code == 201:
print('User created:', response.json())
return response.json()
else:
print('Error:', response.json())

create_user('acc_1234567890', {
'firstName': 'Alice',
'lastName': 'Smith',
'email': 'alice.smith@acme.com',
'extension': '1001',
'role': 'standard'
})

Response​

Success Response (201 Created)​

{
"id": "user_123456",
"accountId": "acc_1234567890",
"firstName": "Alice",
"lastName": "Smith",
"email": "alice.smith@acme.com",
"username": "alice.smith",
"extension": "1001",
"role": "standard",
"phone": "+1-555-0101",
"title": "Sales Executive",
"department": "Sales",
"manager": "user_manager_001",
"status": "pending",
"timezone": "America/New_York",
"language": "en",
"lastLogin": null,
"createdAt": "2023-10-20T10:00:00Z",
"updatedAt": "2023-10-20T10:00:00Z",
"invitationSent": true,
"invitationExpires": "2023-10-27T10:00:00Z"
}

Error Response (400 Bad Request)​

{
"error": {
"code": "INVALID_REQUEST",
"message": "Email address already in use",
"details": {
"field": "email",
"value": "alice.smith@acme.com"
}
}
}

Status Codes​

CodeDescription
201User created successfully
400Bad request or validation error
401Unauthorized - invalid token
403Forbidden - insufficient permissions
409Conflict - email already exists
429Too many requests
500Server error

Validation Rules​

  • firstName: 1-50 characters, required
  • lastName: 1-50 characters, required
  • email: Valid email format, unique per account, required
  • username: 3-30 characters, alphanumeric and underscores
  • extension: 3-6 digits, unique per account
  • role: One of: standard, admin, operator, agent, resource, service
  • timezone: Valid IANA timezone identifier
  • language: Valid ISO 639-1 code (en, es, fr, de, etc)

User Roles Explained​

Standard User​

  • Make/receive calls
  • Access own devices
  • View own call history
  • Standard permissions

Admin User​

  • Full account access
  • Manage all users
  • Manage devices
  • View account analytics
  • Manage billing and settings

Operator​

  • Screen and transfer calls
  • View call queue
  • Manage call routing
  • Receptionist features

Agent​

  • Make/receive calls
  • Access call queue
  • View agent analytics
  • Limited call controls

Resource​

  • Special accounts for resources
  • Meeting room accounts
  • Virtual assistants
  • Automated systems

Invitation Process​

When sendInvitation=true:

  1. User account is created with pending status
  2. Activation email is sent to user
  3. User clicks link and sets password
  4. User status changes to active
  5. User can now log in and use services

Manual Invitation​

If sendInvitation=false, manually invite the user:

curl -X POST https://api.audian.com:8443/v2/accounts/acc_1234567890/users/user_123456/invite \
-H "X-Auth-Token: YOUR_API_TOKEN"

Extension Assignment​

Extensions should be unique and follow a pattern:

  • 3-4 digits: Small organizations
  • 4-5 digits: Medium organizations
  • Ranges: 1000-1999 for Sales, 2000-2999 for Support, etc

Example automatic assignment:

curl -X POST https://api.audian.com:8443/v2/accounts/acc_1234567890/users \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"firstName": "Alice",
"lastName": "Smith",
"email": "alice.smith@acme.com",
"role": "standard",
"assignExtensionAutomatically": true
}'

Next Steps​

After creating a user:

  1. Retrieve user details
  2. Update user information
  3. Assign user permissions
  4. Assign user devices
  5. Configure user presence