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​
| Parameter | Type | Required | Description |
|---|---|---|---|
firstName | string | Yes | User's first name |
lastName | string | Yes | User's last name |
email | string | Yes | Email address (must be unique) |
username | string | No | Login username |
extension | string | No | Phone extension |
role | string | No | User role (standard, admin, operator, agent) |
phone | string | No | Phone number |
title | string | No | Job title |
department | string | No | Department name |
manager | string | No | Manager user ID |
timezone | string | No | User timezone |
language | string | No | Preferred language |
sendInvitation | boolean | No | Send activation email (default: true) |
metadata | object | No | Custom 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​
| Code | Description |
|---|---|
201 | User created successfully |
400 | Bad request or validation error |
401 | Unauthorized - invalid token |
403 | Forbidden - insufficient permissions |
409 | Conflict - email already exists |
429 | Too many requests |
500 | Server 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:
- User account is created with
pendingstatus - Activation email is sent to user
- User clicks link and sets password
- User status changes to
active - 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:
- Retrieve user details
- Update user information
- Assign user permissions
- Assign user devices
- Configure user presence