Bulk Upsert Entities
Bulk upsert entities (create or update) in a single request.
This endpoint:
- Creates new entities for items without
id. - Updates existing entities for items with
id.
Args:
entities_info:
List of entities to upsert. Each item:
- Without id → treated as a create.
- With id → treated as an update for that ID. An id naming a
record of a company hidden from the caller is not written and
fails exactly as an id with no record does.
override:
Controls update behavior for entities that already have an id
(i.e. the update branch of an upsert):
- True → REPLACE: all input fields written, nulls included
(erases existing data). Same as /bulk/update?override=true.
- False → FILL: null inputs are skipped and non-null
inputs only write where the stored value is currently None.
This differs from /bulk/update?override=false (SYNC), which
overwrites existing non-null values. Use FILL when you want to
seed missing fields without touching already-populated ones.
match_field:
Match id-less items on the caller's own key rather than the natural
key: each item's value in this field is compared, as exact text, with
the stored records'. An item matching more than one record is not
written and is counted as failed, keyed by its position in the request.
An unknown field, or a column that does not hold text, is refused with 400.
At most 500 items per request; a larger one is refused with 413 before
anything is written.
Returns:
JSON object with:
- successfulCount (int): number of entities created or updated successfully
- failedCount (int): number of items that failed
- successfulIds (List[str]): IDs of created/updated entities
- failedIds (List[str]): IDs (when available) or indices of failed entities
- matchedCount (int): number of id-less entities that matched an existing
entity on its natural key (or on match_field), so they were routed to
the update branch rather than created. Counted before the write — read
failedIds for what became of each one.
- matchedIds (List[str]): IDs of the entities those payloads matched
- errors (Dict[str,str]): mapping of index or ID → error description
Query Parameters
- Type: booleanoverride
For entities with IDs, controls update behavior. True = REPLACE (all fields written including nulls). False = FILL (nulls skipped, only empty existing fields filled).
- Type: booleanmatch
_existing For entities without IDs, match each one against an existing entity on its natural key (contacts on email, companies on website domain and name) and update that entity instead of creating a duplicate. Set false to create every id-less entity unconditionally. Ignored when match_field is set.
- Type: stringnullablematch
_field For entities without IDs, match each one on the value it carries in this field (a text column or custom field of the entity, e.g. your own external id) instead of the natural key. One match updates that entity, none creates one, and more than one fails the item.
Body·Entities Info
- Type: array of accountsession__api__messages__create_eased_base_model___locals___EasedBaseModel__1Properties: 42
Responses
- application/json
- application/json
curl 'https://crm.dreamhub.ai/api/v1/contracts/bulk/upsert?override=true&match_existing=true' \
--request PUT \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--data '[
{
"name": "",
"dealId": "",
"companyId": "",
"productId": "",
"status": 1,
"arr": 1,
"arrLocal": 1,
"mrr": 1,
"mrrLocal": 1,
"currency": "",
"revenueItems": [
""
],
"annualContractValue": 1,
"annualContractValueLocal": 1,
"totalContractValue": 1,
"totalContractValueLocal": 1,
"startDate": "2026-11-23T03:49:24.854Z",
"endDate": "2026-11-23T03:49:24.854Z",
"duration": 1,
"renewalType": 1,
"nextRenewal": "2026-11-23T03:49:24.854Z",
"nextOptOut": "2026-11-23T03:49:24.854Z",
"signedOn": "2026-11-23T03:49:24.855Z",
"csmOwner": "",
"aeOwner": "",
"carr": 1,
"carrLocal": 1,
"cmrr": 1,
"cmrrLocal": 1,
"financialOverride": true,
"financialNote": "",
"currentFxRate": 1,
"csmRenewalConfidenceLevel": 1,
"isDetachedFromDeal": true,
"manuallyAddedPeople": [
""
],
"automaticallyAddedPeople": [
""
],
"partnerId": "",
"manuallyAddedPartnerContacts": [
""
],
"automaticallyAddedPartnerContacts": [
""
],
"onboardingStartDate": "2026-11-23T03:49:24.855Z",
"onboardingCompletedAt": "2026-11-23T03:49:24.855Z",
"uploadFiles": {
"additionalProperty": null
},
"additionalProperty": "anything"
}
]'
{
"additionalProperty": "anything"
}
