Create Entity
Create a new entity with the provided data.
This endpoint creates a new entity using the data provided in the request body. The entity will be validated according to the defined schema and business rules.
Args: entity_info: Complete entity data for creation including: - All required fields as defined in the entity schema - Optional fields with default values - Custom field values if applicable match_existing: Whether to match the payload against an existing entity on its natural key before creating (see the query parameter description). Entity types with no natural key ignore this and always create. user: Authenticated user information (used for audit trails) response: HTTP response object for status code modification
Returns: EntityResponseModel containing: - id: Unique identifier of the newly created entity, or of the existing entity the payload matched - matched: True when the payload matched an existing entity and updated it rather than creating a new one
Note: - Returns HTTP 201 (Created) on successful creation - Returns HTTP 200 (OK) when the payload matched an existing entity - Returns HTTP 206 (Partial Content) if entity is created but some custom fields failed to save - Automatically sets creation timestamp and user information
Raises: HTTPException: - 400: Invalid input data or validation errors - 401: Authentication required - 403: Insufficient permissions to create entities - 409: Entity already exists (if applicable) - 422: Validation error in request data - 500: Internal server error during creation
Query Parameters
- Type: booleanmatch
_existing Match the record against an existing one on its natural key (contacts on email, companies on website domain and name) when the payload carries no id, and update that record instead of creating a duplicate. Set false to always create.
Body·
- Type: stringae
Owner max length:50nullableAccount Executive owner ID
- Type: numbernullableannual
Contract Value Annual contract value
- Type: numbernullableannual
Contract Value Local Annual contract value in local currency
- Type: numbernullablearr
Annual Recurring Revenue
- Type: numbernullablearr
Local Annual Recurring Revenue in local currency
- Type: array of stringnullableautomatically
Added Partner Contacts Partner contacts automatically added to this contract
- Type: array of stringnullableautomatically
Added People People automatically added to this contract
- Type: numbernullablecarr
Committed Annual Recurring Revenue
- Type: numbernullablecarr
Local Committed Annual Recurring Revenue in local currency
- Type: numbernullablecmrr
Committed Monthly Recurring Revenue
- Type: numbernullablecmrr
Local Committed Monthly Recurring Revenue in local currency
- Type: stringcompany
Id max length:50nullableIdentifier of the associated company
- additionalPropertyType: anythingproperty
Name
Responses
- application/json
- application/json
- application/json
- application/json
curl 'https://crm.dreamhub.ai/api/v1/contracts/?match_existing=true' \
--request POST \
--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": "",
"endDate": "",
"duration": 1,
"renewalType": 1,
"nextRenewal": "",
"nextOptOut": "",
"signedOn": "",
"csmOwner": "",
"aeOwner": "",
"carr": 1,
"carrLocal": 1,
"cmrr": 1,
"cmrrLocal": 1,
"financialOverride": true,
"financialNote": "",
"csmRenewalConfidenceLevel": 1,
"isDetachedFromDeal": true,
"manuallyAddedPeople": [
""
],
"automaticallyAddedPeople": [
""
],
"partnerId": "",
"manuallyAddedPartnerContacts": [
""
],
"automaticallyAddedPartnerContacts": [
""
],
"onboardingStartDate": "",
"onboardingCompletedAt": "",
"uploadFiles": {
"additionalProperty": "anything"
},
"additionalProperty": "anything"
}'
{
"id": "string",
"matched": false
}
