Bulk Update Entities
Bulk update multiple entities in a single request.
This endpoint is a generic bulk update API for any entity that uses
GeneralizedEntityAPIRouter. It delegates to the shared accountsession
bulk infrastructure:
- Manager layer:
GeneralizedManager.bulk_update_entities() - DB layer:
DBSessionBulkOps.bulk_update_entities_by_id()
Behavior:
- Each entity is updated independently based on its
id. - Some updates can succeed while others fail (partial success).
- Custom fields and linked fields are updated using the same logic as single-entity updates.
Args:
entities_info:
List of entity payloads to update. Each item:
- Must include id (see the entity schema for the expected ID format).
- May include only the fields to change (per-entity partial update).
override:
Maps to BulkUpdateMode:
- True → REPLACE: every input field is written, including
nulls (clears the stored value). Use when the payload is the
authoritative source of truth and you want explicit null inputs to
erase existing data.
- False → SYNC: null input fields are skipped; non-null
inputs overwrite existing values regardless of whether they are
already set. Safe default for partial updates.
user:
Authenticated user performing the bulk operation.
response:
FastAPI response object, used to set HTTP status to 206 when needed.
Returns:
JSON object with:
- successfulCount (int): number of entities updated successfully
- failedCount (int): number of entities that failed to update
- successfulIds (List[str]): IDs of updated entities
- failedIds (List[str]): IDs of entities that failed (when available)
- errors (Dict[str,str]): mapping of ID → error description
Query Parameters
- Type: booleanoverride
When true, all provided fields override existing values. When false, only non-null fields are applied.
Body·Entities Info
- Type: array of EasedBaseModelProperties: 24
Responses
- application/json
- application/json
curl 'https://crm.dreamhub.ai/api/v1/companies/bulk/update?override=true' \
--request PUT \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--data '[
{
"name": "Acme Corporation",
"status": 1,
"sdrOwner": "u-sdr123",
"aeOwner": "u-ae789",
"csmOwner": "u-csm345",
"industryId": 1,
"subIndustryId": "si-tech",
"city": "San Francisco",
"stateRegion": "California",
"country": "United States",
"postalCode": "94105",
"numOfEmployees": 50,
"parentCompany": "c-parent123",
"address": "123 Main Street",
"fiscalYearStartsAt": "2024-01-01T00:00:00Z",
"website": "https://www.acme.com",
"domains": "",
"phone": "+1-555-123-4567",
"segment": 1,
"arr": 120000,
"mrr": 10000,
"annualContractValue": 150000,
"totalContractValue": 450000,
"additionalProperty": "anything"
}
]'
{
"additionalProperty": "anything"
}
