Update Account
Update an existing account's information and settings.
Endpoint​
PATCH https://api.audian.com:8443/v2/accounts/{accountId}
Request​
Path Parameters​
| Parameter | Type | Required | Description |
|---|---|---|---|
accountId | string | Yes | The unique account identifier |
Headers​
Content-Type: application/json
X-Auth-Token: YOUR_API_TOKEN
Request Body​
All fields are optional. Only include the fields you want to update.
| Parameter | Type | Description |
|---|---|---|
displayName | string | Display name for the account |
email | string | Primary contact email |
phone | string | Primary contact phone number |
address | object | Billing address |
settings | object | Account-level settings |
status | string | Account status (active, suspended, closed) |
metadata | object | Custom metadata |
Examples​
Update Account Name​
curl -X PATCH https://api.audian.com:8443/v2/accounts/acc_1234567890 \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"displayName": "Acme Corp - Updated"
}'
Update Settings​
curl -X PATCH https://api.audian.com:8443/v2/accounts/acc_1234567890 \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"settings": {
"timezone": "America/New_York",
"enableRecording": true,
"recordingRetention": 60
}
}'
Update Address and Contact​
curl -X PATCH https://api.audian.com:8443/v2/accounts/acc_1234567890 \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"email": "neoadmin@acme.com",
"phone": "+1-555-0200",
"address": {
"street": "456 Corporate Blvd",
"city": "New York",
"state": "NY",
"postalCode": "10001",
"country": "US"
}
}'
JavaScript/Node.js Example​
const axios = require('axios');
async function updateAccount(accountId, updates) {
try {
const response = await axios.patch(
`https://api.audian.com:8443/v2/accounts/${accountId}`,
updates,
{
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN'
}
}
);
console.log('Account updated:', response.data);
return response.data;
} catch (error) {
console.error('Error updating account:', error.response.data);
}
}
updateAccount('acc_1234567890', {
displayName: 'Acme Corp - Updated',
settings: {
timezone: 'America/New_York',
enableRecording: true
}
});
Python Example​
import requests
def update_account(account_id, updates):
url = f'https://api.audian.com:8443/v2/accounts/{account_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('Account updated:', response.json())
return response.json()
else:
print('Error:', response.json())
update_account('acc_1234567890', {
'displayName': 'Acme Corp - Updated',
'settings': {
'timezone': 'America/New_York',
'enableRecording': True
}
})
Response​
Success Response (200 OK)​
{
"id": "acc_1234567890",
"name": "Acme Corporation",
"displayName": "Acme Corp - Updated",
"email": "neoadmin@acme.com",
"phone": "+1-555-0200",
"status": "active",
"plan": "professional",
"address": {
"street": "456 Corporate Blvd",
"city": "New York",
"state": "NY",
"postalCode": "10001",
"country": "US"
},
"settings": {
"timezone": "America/New_York",
"language": "en",
"enableVoiceMail": true,
"enableRecording": true,
"recordingRetention": 60,
"smsEnabled": true
},
"createdAt": "2023-10-15T10:30:00Z",
"updatedAt": "2023-10-20T16:45:00Z"
}
Error Response (400 Bad Request)​
{
"error": {
"code": "INVALID_REQUEST",
"message": "Invalid timezone format",
"details": {
"field": "settings.timezone",
"value": "Invalid/Timezone"
}
}
}
Status Codes​
| Code | Description |
|---|---|
200 | Account updated successfully |
400 | Bad request or validation error |
401 | Unauthorized - invalid token |
403 | Forbidden - insufficient permissions |
404 | Account not found |
409 | Conflict - duplicate email or resource conflict |
429 | Too many requests |
500 | Server error |
Partial Updates​
The PATCH method allows you to update only the fields you specify. Omitted fields will not be modified.
Immutable Fields​
The following fields cannot be updated:
id- Account ID is immutablename- Original account name cannot be changedplan- Use upgrade/downgrade endpoint for plan changescreatedAt- Creation timestamp is immutable
Validation Rules​
- displayName: 1-100 characters
- email: Valid email format
- phone: Valid phone format
- timezone: Valid IANA timezone identifier
- status: One of: active, suspended, closed
- recordingRetention: Integer between 1 and 365