Bulk Create Entities
Bulk create multiple entities in a single request.
This endpoint is a generic bulk create API for any entity that uses
GeneralizedEntityAPIRouter. It delegates to the shared accountsession
bulk infrastructure:
- Manager layer:
GeneralizedManager.bulk_create_entities() - DB layer:
DBSessionBulkOps.bulk_create_entities()
The operation is partial-safe:
- If some entities fail to create, successful creates are still committed.
- The HTTP status is set to
206 Partial Contentwhen at least one entity fails.
Args: entities_info: List of entity payloads to create (same shape as the regular create endpoint's body). Each item: - Must include all required fields for the entity. - May include custom-field values, which are processed after the base rows are inserted. 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 created successfully
- failedCount (int): number of entities that failed to create
- successfulIds (List[str]): IDs of created entities
- failedIds (List[str]): IDs (when available) or indices of failed entities
- errors (Dict[str,str]): mapping of index or ID → error description
Body·Entities Info
- Type: array of EasedBaseModelProperties: 29
Responses
- application/json
- application/json
curl https://crm.dreamhub.ai/api/v1/leads/bulk/create \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--data '[
{
"name": "Acme Corp - Enterprise Platform Evaluation",
"sdrOwner": "u-abc123",
"aeOwner": "u-xyz789",
"companyId": "c-company123",
"contactId": "p-contact789",
"status": 1,
"createdAt": "2024-01-15T10:30:00Z",
"engagementScore": 1,
"conversionProbability": 0.75,
"source": 1,
"disqualifiedReason": 1,
"disqualifiedCompanyReason": 2,
"closedAsQualifiedReason": 1,
"statusNotes": "Waiting for budget approval from CFO",
"statusChangedBy": "u-user123",
"statusChangedAt": "2024-01-20T14:45:00Z",
"licenseId": "l-license123",
"productId": "prod-platform",
"numberOfLicenses": 10,
"salesExplorationMeetingDate": "2024-02-01T15:00:00Z",
"inboundCampaignType": 1,
"outboundCampaignType": 2,
"referringCompany": "c-referrer123",
"referringPerson": "p-referrer456",
"otherCompanyName": "Subsidiary Corp",
"otherPersonName": "John Smith (Decision Maker)",
"partnerId": "ptn-partner123",
"partnerContactId": "ptc-contact789",
"additionalProperty": "anything"
}
]'
{
"additionalProperty": "anything"
}
