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:

The operation is partial-safe:

  • If some entities fail to create, successful creates are still committed.
  • The HTTP status is set to 206 Partial Content when 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

required
application/json
  • Properties: 44

Responses

  • application/json
  • application/json
Request Example for post/bulk/create
curl https://crm.dreamhub.ai/api/v1/deals/bulk/create \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '[
  {
    "name": "Acme Corp - Enterprise License Q1 2024",
    "managedBy": "550e8400-e29b-41d4-a716-446655440000",
    "companyId": "550e8400-e29b-41d4-a716-446655440001",
    "contactId": "550e8400-e29b-41d4-a716-446655440002",
    "leadId": "550e8400-e29b-41d4-a716-446655440003",
    "status": "active",
    "stage": 3,
    "movedToStageAt": "2024-01-15T10:30:00Z",
    "expectedCloseAt": "2024-03-31T23:59:59Z",
    "closedAt": "2024-03-28T14:30:00Z",
    "dealValueAmount": 125000,
    "arr": 50000,
    "mrr": 4166.67,
    "arrLocal": 50000,
    "mrrLocal": 4166.67,
    "probability": 75,
    "techEvaluationStatus": 1,
    "qualificationScore": 85.5,
    "aeConfidenceLevel": 1,
    "aiAssignedProbability": 78.3,
    "closedLostReason": 3,
    "closedLostReasonText": "Customer chose competitor due to lower pricing",
    "manuallyAddedPeople": [
      "550e8400-e29b-41d4-a716-446655440004",
      "550e8400-e29b-41d4-a716-446655440005"
    ],
    "manuallyAddedPartnerContacts": [
      "ptc-abc123",
      "ptc-def456"
    ],
    "contractStartDate": "2024-04-01T00:00:00Z",
    "contractEndDate": "2025-03-31T23:59:59Z",
    "optOutDate": "2024-06-30T23:59:59Z",
    "contractTotalAmount": 150000,
    "amountBreakdownByPeriod": [
      {
        "amount": 37500,
        "period": "2024-Q1"
      },
      {
        "amount": 37500,
        "period": "2024-Q2"
      }
    ],
    "autoRenewal": true,
    "licenseId": "ENT-2024-001",
    "productId": "PROD-ENTERPRISE",
    "licensesInDeal": 50,
    "potentialLicensesInCompany": 200,
    "implementationCost": 15000,
    "trainingCost": 5000,
    "uploadContracts": {
      "contract_v1.pdf": {
        "size": 1024000,
        "uploaded_at": "2024-01-15T10:00:00Z"
      }
    },
    "annualContractValue": 125000,
    "totalContractValue": 375000,
    "currency": "USD",
    "contractId": "CONTRACT-2024-001",
    "partnerId": "ptn-acme-550e8400",
    "partnerContactId": "ptc-jane-550e8400",
    "additionalProperty": "anything"
  }
]'
{
  "additionalProperty": "anything"
}