Skip to main content

Update User

Update an existing user's information and settings.

Endpoint​

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

Request​

Path Parameters​

ParameterTypeRequiredDescription
accountIdstringYesAccount ID
userIdstringYesUser ID

Headers​

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

Request Body​

All fields are optional. Only include fields you want to update.

ParameterTypeDescription
firstNamestringUser's first name
lastNamestringUser's last name
emailstringEmail address
phonestringPhone number
titlestringJob title
departmentstringDepartment
managerstringManager user ID
timezonestringTimezone
languagestringLanguage preference
rolestringUser role
statusstringUser status
extensionstringPhone extension
settingsobjectUser settings

Examples​

Update User Name​

curl -X PATCH https://api.audian.com:8443/v2/accounts/acc_1234567890/users/user_123456 \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"firstName": "Alice",
"lastName": "Johnson"
}'

Update Contact Information​

curl -X PATCH https://api.audian.com:8443/v2/accounts/acc_1234567890/users/user_123456 \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"email": "alice.johnson@acme.com",
"phone": "+1-555-0102",
"title": "Senior Sales Executive",
"department": "Enterprise Sales"
}'

Update User Settings​

curl -X PATCH https://api.audian.com:8443/v2/accounts/acc_1234567890/users/user_123456 \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"timezone": "America/Los_Angeles",
"language": "en",
"settings": {
"callWaiting": true,
"voicemail": {
"enabled": true,
"greetingType": "custom"
},
"callForwarding": {
"enabled": true,
"destination": "+1-555-9999"
}
}
}'

Change User Status​

curl -X PATCH https://api.audian.com:8443/v2/accounts/acc_1234567890/users/user_123456 \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"status": "suspended"
}'

JavaScript/Node.js Example​

const axios = require('axios');

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

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

updateUser('acc_1234567890', 'user_123456', {
firstName: 'Alice',
lastName: 'Johnson',
title: 'Senior Sales Executive'
});

Python Example​

import requests

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

response = requests.patch(url, headers=headers, json=updates)

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

update_user('acc_1234567890', 'user_123456', {
'firstName': 'Alice',
'lastName': 'Johnson',
'title': 'Senior Sales Executive'
})

Response​

Success Response (200 OK)​

{
"id": "user_123456",
"accountId": "acc_1234567890",
"firstName": "Alice",
"lastName": "Johnson",
"email": "alice.johnson@acme.com",
"username": "alice.smith",
"extension": "1001",
"phone": "+1-555-0102",
"title": "Senior Sales Executive",
"department": "Enterprise Sales",
"role": "standard",
"status": "active",
"timezone": "America/Los_Angeles",
"language": "en",
"createdAt": "2023-10-15T10:30:00Z",
"updatedAt": "2023-10-20T16:45:00Z",
"settings": {
"callWaiting": true,
"callForwarding": {
"enabled": true,
"destination": "+1-555-9999"
},
"voicemail": {
"enabled": true,
"greetingType": "custom"
}
}
}

Error Response (400 Bad Request)​

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

Status Codes​

CodeDescription
200User updated successfully
400Bad request or validation error
401Unauthorized - invalid token
403Forbidden - insufficient permissions
404User not found
409Conflict - duplicate email or extension
429Too many requests
500Server error

Settings Object​

Call Settings​

{
"callWaiting": true,
"callHolding": true,
"callDisplay": "full"
}

Call Forwarding​

{
"callForwarding": {
"enabled": false,
"destination": null,
"destinationType": "external",
"ringDelay": 20
}
}

Voicemail Settings​

{
"voicemail": {
"enabled": true,
"greetingType": "default",
"customGreeting": null,
"emailNotification": true,
"transcription": true
}
}

Do Not Disturb​

{
"dnd": {
"enabled": false,
"scheduleType": "manual",
"message": "In a meeting"
}
}

Partial Updates​

The PATCH method allows updating only the fields you specify. Omitted fields remain unchanged.

Immutable Fields​

The following fields cannot be updated:

  • id: User ID is immutable
  • accountId: Account assignment is immutable
  • username: Login username cannot be changed
  • createdAt: Creation timestamp is immutable

Validation Rules​

  • firstName: 1-50 characters
  • lastName: 1-50 characters
  • email: Valid format, unique per account
  • extension: 3-6 digits, unique per account
  • timezone: Valid IANA timezone
  • language: Valid ISO 639-1 code
  • role: One of: standard, admin, operator, agent, resource, service
  • status: One of: active, disabled, suspended, pending

User Status Transitions​

pending → active (after user activation)
active → suspended → active (temporary restriction)
active → disabled (permanent restriction)
any → deleted (final state)

Batch Updates​

Update multiple users at once:

curl -X POST https://api.audian.com:8443/v2/accounts/acc_1234567890/users/batch-update \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"updates": [
{
"userId": "user_123456",
"data": { "department": "New Sales" }
},
{
"userId": "user_123457",
"data": { "department": "New Sales" }
}
]
}'

Change Password​

To change a user's password:

curl -X POST https://api.audian.com:8443/v2/accounts/acc_1234567890/users/user_123456/change-password \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"currentPassword": "old_password",
"newPassword": "new_secure_password"
}'

Reset Password​

Admin can reset user password:

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

User will receive password reset email.