Bulk Update Entities
Bulk update multiple user entities in a single request.
This endpoint is designed for updating many users at once (e.g. changing roles, departments, or status in bulk). Each user is updated independently, so one failing user does not block the others.
The operation is partial-safe:
- If some users fail to update, successful updates are still committed.
- The HTTP status is set to
206 Partial Contentwhen at least one update fails. - The response body always reflects the true per-user outcome.
Args:
entities_info:
List of user objects to update. Each item:
- Must include id (user ID, e.g. "u-johs-f47ac10b").
- May include only the fields to change (partial update per user).
Returns:
BulkUpdateResponse with:
- successful_count: number of users updated successfully
- failed_count: number of users that failed to update
- successful_ids: list of user IDs updated successfully
- failed_entities: the submitted objects (including id) of users that failed
- errors: mapping of user ID → error description
Error semantics:
- If a user ID does not exist, that user is added to failed_entities and
errors[user_id] is typically set to "Entity not found".
- If the user is updated but their custom or linked fields could not be
saved, the user is reported in failed_entities and errors[user_id] is set to
"Entity updated but failed to process custom fields: ..." (or similar).
- Updates are saved in groups; if a group fails to save, only the users in
that group are reported as failed and other groups can still succeed.
Email changes:
- When a user's email changes, an update of their sign-in email is
attempted once the user is updated. If that step fails, the user is
still reported as updated and their sign-in email is unchanged.
HTTP status codes:
- 200 OK:
All requested users updated successfully.
- 206 Partial Content:
At least one user failed to update (see errors in response body).
- 500 Internal Server Error:
Unexpected error or complete bulk failure.
Example request body:
[
{
"id": "u-johs-f47ac10b",
"roleId": 2,
"departmentId": 5
},
{
"id": "u-annb-f47ac10b",
"status": 1,
"email": "new.email@company.com"
}
]
Example response (partial success):
{
"successfulCount": 1,
"failedCount": 1,
"successfulIds": ["u-johs-f47ac10b"],
"failedEntities": [
{"id": "u-annb-f47ac10b", "status": 1, "email": "new.email@company.com"}
],
"errors": {
"u-annb-f47ac10b": "Email domain not allowed"
}
}
Body·Entities Info
- Type: array of accountsession__api__messages__create_eased_base_model___locals___EasedBaseModel__3Properties: 16
Responses
- application/json
- application/json
curl https://crm.dreamhub.ai/api/v1/users/bulk/ \
--request PUT \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--data '[
{
"lastName": "Smith",
"displayName": "John Smith",
"department": 1,
"areaOfResponsibility": 1,
"email": "john.smith@company.com",
"role": 1,
"jobTitle": "Account Executive",
"userLanguage": "en",
"avatarUrl": "https://example.com/avatars/user123.jpg",
"groupIds": [
"g-sales",
"g-enterprise"
],
"quotaPlan": 1,
"managerId": "u-manager123",
"timezone": "America/New_York",
"id": "u-user123",
"firstName": "John",
"additionalProperty": "anything"
}
]'
{
"successfulCount": 1,
"failedCount": 1,
"successfulIds": [
"string"
],
"failedEntities": [
{
"additionalProperty": "anything"
}
],
"errors": {
"additionalProperty": "string"
}
}
