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: stringnamemin length:1max length:256required
Company Name - Official name of the company or organization
- Type: enumstatusrequired
Company Status - Current status of the company account (e.g., ACTIVE, INACTIVE, PROSPECT)
values12345 - Type: stringaddressmax length:256nullable
Address - Street address of the company's headquarters or primary location
- Type: stringnullableae
Owner AE Owner - Account Executive responsible for this company. Must be a valid user ID starting with 'u-'
- Type: numbernullableannual
Contract Value Annual Contract Value (ACV) - Total value of annual contracts with this company in USD
- Type: numbernullablearr
Annual Recurring Revenue (ARR) - Total annual recurring revenue from this company in USD
- Type: stringcitymax length:256nullable
City - City where the company is headquartered or has primary operations
- Type: stringcountrymax length:256nullable
Country - Country where the company is headquartered or has primary operations
- Type: stringnullablecsm
Owner CSM Owner - Customer Success Manager assigned to this company. Must be a valid user ID starting with 'u-'
- Type: stringdomainsmax length:256nullable
Domains - Semicolon-separated list of known company domains
- Type: stringFormat: date-timenullablefiscal
Year Starts At Fiscal Year Start Date - When the company's fiscal year begins. Used for financial reporting and quota calculations
- Type: integernullableindustry
Id Industry ID - Primary industry classification for this company
- additionalPropertyType: anythingproperty
Name
Responses
- application/json
- application/json
- application/json
- application/json
curl 'https://crm.dreamhub.ai/api/v1/companies/?match_existing=true' \
--request POST \
--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"
}'
{
"id": "string",
"matched": false
}
