API ReferenceUsers
Update User
Partially update a user's profile, metadata, or organization assignment using field masks.
Endpoint
PATCH /v1/identities/{id}Base URL: https://api-id.avnology.net
Authentication: API Key or OAuth token with admin:users:write scope
Uses field masks (AIP-134) to update only the specified fields. Unspecified fields are left unchanged.
Request
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | User ID |
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <api_key> |
Content-Type | Yes | application/json |
If-Match | No | ETag for conditional update |
Body
| Field | Type | Required | Description |
|---|---|---|---|
identity | object | Yes | Fields to update |
update_mask | string | Yes | Comma-separated field paths to update |
Example Request
curl -X PATCH "https://api-id.avnology.net/v1/identities/usr_4f18acec-2712-4be7-a9af-b063b4f6deba" \
-H "Authorization: Bearer ak_live_..." \
-H "Content-Type: application/json" \
-H "If-Match: W/\"a1b2c3d4e5\"" \
-d '{
"identity": {
"first_name": "Jane",
"last_name": "Doe",
"phone": "+14155559876",
"admin_metadata": { "notes": "Updated by migration script" }
},
"update_mask": "first_name,last_name,phone,admin_metadata"
}'Response
Success (200 OK)
Returns the full updated user object. See Get User for the response schema.
Errors
| Status | Code | Description |
|---|---|---|
| 400 | AVNOLOGY_AUTH_902 | Validation failed |
| 404 | AVNOLOGY_AUTH_901 | User not found |
| 409 | AVNOLOGY_AUTH_903 | ETag mismatch (concurrent modification) |
| 403 | AVNOLOGY_AUTH_100 | Insufficient permissions |
Code Examples
JavaScript (fetch)
async function updateUser(apiKey, userId, fields, updateMask) {
return fetch(`https://api-id.avnology.net/v1/identities/${userId}`, {
method: 'PATCH',
headers: { 'Authorization': `Bearer ${apiKey}`,
Python (httpx)
import httpx
def update_user(api_key: str, user_id: str, fields: dict, update_mask: str) -> dict:
return httpx.patch(f"https://api-id.avnology.net/v1/identities/{user_id
Go (net/http)
func updateUser(ctx context.Context, apiKey, userID string, fields map[string]interface{}, updateMask string
Related
- Get User -- fetch current state before updating
- Create User -- create a new user
- SDK:
client.admin.updateUser(userId, fields)(TypeScript)