Skip to main content

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​

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token: Bearer <token>
Content-TypestringYesapplication/json

Path Parameters​

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace identifier
clientIdstringYesClient identifier

Request Body​

{
"name": "Jane Doe",
"dateOfBirth": "1990-01-15",
"gender": "female",
"avatarUrl": "https://example.com/new-avatar.jpg",
"contactMethods": [
{
"type": "email",
"value": "jane@example.com",
"isPreferred": true
}
],
"customFields": [
{
"fieldKey": "notes",
"value": "Updated notes"
}
]
}

Body Parameters​

ParameterTypeRequiredDescription
namestringNoClient name (minimum 1 character if provided)
dateOfBirthstringNoDate of birth in ISO 8601 format (YYYY-MM-DD). Used for age-based features like Labs. Can be null to clear
genderstringNoGender. Valid values: 'male', 'female'. Used for gender-specific features like Labs. Can be null to clear
avatarUrlstringNoURL to client avatar image (must be valid URL if provided, can be null)
contactMethodsarrayNoArray of contact methods (if provided, minimum 1, exactly one must be preferred)
customFieldsarrayNoArray of custom field values
posInvoiceDiscountobject | nullNoSet, update, or clear (null) the default POS invoice discount for this client

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