Update Client (v1)
Method + Path
PATCH /v1/workspace/:workspaceId/clients/:clientId
Actual backend path: /v1/workspace/:workspaceId/clients/:clientId
Description
Update an existing client (customer) in a workspace. All fields are optional - only provided fields will be updated.
Authentication
Required - JWT token in Authorization header
Required Permissions:
clients.update
Headers
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token: Bearer <token> |
Content-Type | string | Yes | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace identifier |
clientId | string | Yes | Client identifier |
Request Body
{
"name": "Jane Doe",
"avatarUrl": "https://example.com/new-avatar.jpg",
"contactMethods": [
{
"type": "email",
"value": "jane@example.com",
"isPreferred": true
}
],
"customFields": [
{
"fieldKey": "notes",
"value": "Updated notes"
}
]
}
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | Client name (minimum 1 character if provided) |
avatarUrl | string | No | URL to client avatar image (must be valid URL if provided, can be null) |
contactMethods | array | No | Array of contact methods (if provided, minimum 1, exactly one must be preferred) |
customFields | array | No | Array of custom field values |
Note: At least one field must be provided for update.
Response (200)
{
"client": {
"id": "507f1f77bcf86cd799439011",
"name": "Jane Doe",
"avatarUrl": "https://example.com/new-avatar.jpg",
"contactMethods": [
{
"type": "email",
"value": "jane@example.com",
"isPreferred": true
}
],
"customFields": [],
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T11:00:00Z"
}
}
Common Errors
- 400 Bad Request: Invalid request body or no fields provided
- 401 Unauthorized: Missing or invalid authentication token
- 403 Forbidden: Insufficient permissions (requires
clients.update) - 404 Not Found: Client or workspace not found
- 422 Unprocessable Entity: Validation errors
- 500 Internal Server Error: Server error