Create object schema
Code Mode: praxis.crm.schemas.create
HTTP: POST /crm/v1/schemas
Define a custom CRM object type before creating its records. Provide its immutable name, singular and plural labels, primaryDisplayProperty, properties and associated object types. Save the returned object type identifier for subsequent record and property operations. Writes return refs (ResourceRef[]) for entity cards and optional property changes in conversations.
签名
praxis.crm.schemas.create(args:{body:{/** Determines if the object type can include properties that are marked as sensitive. */ allowsSensitiveProperties:boolean;/** Associations defined for this object type. */ associatedObjects:Array<string>;/** A brief explanation of the object type. */ description?:string;/** Singular and plural display names for the object type in record lists and pages. */ labels:{/** The word for multiple objects. */ plural?:string;/** The word for one object. */ singular?:string};/** A unique name for this object. */ name:string;/** The name of the primary property for this object. */ primaryDisplayProperty?:string;/** Properties defined for this object type. */ properties:Array<{/** A description of the property that will be shown as help text in CRM. */ description?:string;/** The order that this property should be displayed in the CRM UI relative to other properties for this object type. e.g. 0 */ displayOrder?:number;/** Specifies the reference type for external options associated with the property. */ externalOptionsReferenceType?:string;/** Controls how the property appears in CRM. */ fieldType:string;/** Whether the property can be used in a CRM form. */ formField?:boolean;/** The name of the group this property belongs to. */ groupName?:string;/** Whether or not the property's value must be unique. */ hasUniqueValue?:boolean;/** Hidden options won't be shown in CRM. */ hidden?:boolean;/** A human-readable property label that will be shown in CRM. */ label:string;/** The internal property name, which must be used when referencing the property from the API. */ name:string;/** Controls how numeric properties are formatted in the CRM UI e.g. "currency" */ numberDisplayHint?:"currency"|"duration"|"formatted"|"percentage"|"probability"|"unformatted";/** Controls how the property options will be sorted in the CRM UI. e.g. "ALPHABETICAL" */ optionSortStrategy?:"ALPHABETICAL"|"DISPLAY_ORDER";/** A list of available options for the property. */ options?:Array<{/** A description of the option. */ description?:string;/** Options are shown in order starting with the lowest positive integer value. e.g. 0 */ displayOrder:number;/** Hidden options won't be shown in CRM. */ hidden:boolean;/** A human-readable option label that will be shown in CRM. */ label:string;/** The internal value of the option, which must be used when setting the property value through the API. */ value:string}>;/** Defines the options this property will return, e.g. */ referencedObjectType?:string;/** Allow users to search for information entered to this field (limited to 3 properties) */ searchableInGlobalSearch?:boolean;/** Whether the property will display the currency symbol in the CRM UI. */ showCurrencySymbol?:boolean;/** Controls how text properties are formatted in the CRM UI e.g. "domain_name" */ textDisplayHint?:"domain_name"|"email"|"ip_address"|"multi_line"|"phone_number"|"physical_address"|"postal_code"|"unformatted_single_line";/** The data type of the property. e.g. "bool" */ type:"bool"|"date"|"datetime"|"enumeration"|"number"|"phone_number"|"string"}>;/** The names of properties that should be **required** when creating an object of this type. */ requiredProperties:Array<string>;/** Names of properties that will be indexed for this object type in by CRM's product search. */ searchableProperties:Array<string>;/** The names of secondary properties for this object. */ secondaryDisplayProperties:Array<string>;/** A boolean indicating whether associations should be created between objects of the same type. */ shouldCreateSameObjectAssociation:boolean}}):Promise<({/** A boolean indicating whether the object schema allows sensitive properties. */ allowsSensitiveProperties:boolean;/** A boolean indicating whether the object schema is archived. */ archived:boolean;/** Associations defined for a given object type. */ associations:Array<{/** When the association was defined. e.g. "2026-10-29T12:00:00Z" */ createdAt?:string;/** ID of the primary object type to link from. */ fromObjectTypeId:string;/** A unique ID for this association. */ id:string;/** A unique name for this association. */ name?:string;/** ID of the target object type ID to link to. */ toObjectTypeId:string;/** When the association was last updated. e.g. "2026-10-29T12:00:00Z" */ updatedAt?:string}>;/** When the object schema was created. e.g. "2026-10-29T12:00:00Z" */ createdAt?:string;/** An integer representing the ID of the user who created the object schema. e.g. 0 */ createdByUserId?:number;/** A string providing a description of the object schema. */ description?:string;/** An assigned unique ID for the object, including portal ID and object name. */ fullyQualifiedName:string;/** A unique ID for this schema's object type. */ id:string;/** Singular and plural display names for the object type in record lists and pages. */ labels:{/** The word for multiple objects. */ plural?:string;/** The word for one object. */ singular?:string};/** A unique name for the schema's object type. */ name:string;/** A string representing the type ID of the object. */ objectTypeId:string;/** The name of the primary property for this object. */ primaryDisplayProperty?:string;/** Properties defined for this object type. */ properties:Array<{/** Whether or not the property is archived. */ archived?:boolean;/** When the property was archived. e.g. "2026-10-29T12:00:00Z" */ archivedAt?:string;/** For default properties, true indicates that the property is calculated by a CRM process. */ calculated?:boolean;/** The formula used to calculate the value of this property, if it is a calculated property. */ calculationFormula?:string;/** When the property was created e.g. "2026-10-29T12:00:00Z" */ createdAt?:string;/** The internal ID of the user who created the property in CRM. */ createdUserId?:string;/** The name of the property that defines the currency for this property, if applicable. */ currencyPropertyName?:string;/** The sensitivity level of the data stored in this property, such as 'sensitive' or 'highly_sensitive'. e.g. "highly_sensitive" */ dataSensitivity?:"highly_sensitive"|"non_sensitive"|"sensitive";/** Controls how date properties are displayed in the CRM UI, with options such as 'absolute', 'absolute_with_relative', 'time_since', and 'time_until'. e.g. "absolute" */ dateDisplayHint?:"absolute"|"absolute_with_relative"|"time_since"|"time_until";/** A description of the property that will be shown as help text in CRM. */ description:string;/** The order that this property should be displayed in the CRM UI relative to other properties for this object type. e.g. 0 */ displayOrder?:number;/** For default properties, true indicates that the options are stored externally to the property settings. */ externalOptions?:boolean;/** Controls how the property appears in CRM. */ fieldType:string;/** Whether or not the property can be used in a CRM form. */ formField?:boolean;/** The name of the property group the property belongs to. */ groupName:string;/** Whether or not the property's value must be unique. */ hasUniqueValue?:boolean;/** Hidden options won't be shown in CRM. e.g. false */ hidden?:boolean;/** This will be true for default object properties built into CRM. */ hubspotDefined?:boolean;/** A human-readable property label that will be shown in CRM. */ label:string;/** Restrictions on archiving and editing this property definition, options or record values. */ modificationMetadata?:{/** Indicates whether the property can be archived. */ archivable:boolean;/** Indicates whether the property's definition is read-only. */ readOnlyDefinition:boolean;/** Indicates whether the property's options are read-only. */ readOnlyOptions?:boolean;/** Indicates whether the property's value is read-only. */ readOnlyValue:boolean};/** The internal property name, which must be used when referencing the property via the API. */ name:string;/** A hint for how number values should be displayed, with options like 'formatted' or 'currency'. e.g. "currency" */ numberDisplayHint?:"currency"|"duration"|"formatted"|"percentage"|"probability"|"unformatted";/** A list of valid options for the property. */ options:Array<{/** A description of the option. */ description?:string;/** Options are displayed in order starting with the lowest positive integer value. e.g. 0 */ displayOrder?:number;/** Hidden options will not be displayed in CRM. */ hidden:boolean;/** A human-readable option label that will be shown in CRM. */ label:string;/** The internal value of the option, which must be used when setting the property value through the API. */ value:string}>;/** If this property is related to other object(s), they'll be listed here. */ referencedObjectType?:string;/** An array of categories that describe the types of sensitive data contained in this property. */ sensitiveDataCategories?:Array<string>;/** Whether the property will display the currency symbol set in the account settings. */ showCurrencySymbol?:boolean;/** A hint for how text values should be displayed, with options like 'email' or 'phone_number'. e.g. "domain_name" */ textDisplayHint?:"domain_name"|"email"|"ip_address"|"multi_line"|"phone_number"|"physical_address"|"postal_code"|"unformatted_single_line";/** The property data type. */ type:string;/** When the object type was last updated. e.g. "2026-10-29T12:00:00Z" */ updatedAt?:string;/** The internal user ID of the user who updated the property in CRM. */ updatedUserId?:string}>;/** The names of properties that should be **required** when creating an object of this type. */ requiredProperties:Array<string>;/** Names of properties that will be indexed for this object type in by CRM's product search. */ searchableProperties:Array<string>;/** The names of secondary properties for this object. */ secondaryDisplayProperties:Array<string>;/** When the object schema was last updated. e.g. "2026-10-29T12:00:00Z" */ updatedAt?:string;/** An integer representing the ID of the user who last updated the object schema. e.g. 0 */ updatedByUserId?:number})&({/** Affected record references for rendering entity cards in conversations; may be empty for definition-only writes. */ refs:Array<{/** Object type containing the referenced record; use with objects.retrieve. e.g. "deals" */ object:string;/** Record identifier to retrieve with object; obtained from the write result. e.g. "rec_example" */ id:string;/** Console URL for opening the entity card in a conversation or viewing the record. e.g. "https://console.deepraxis.com/crm/deals/rec_example" */ viewer_url:string;/** Optional property changes to render alongside the entity card. */ changes?:Array<{/** Internal name of the property changed by this request. */ property:string;/** Value before the change; null means the property was empty. */ before:string|null;/** Value committed by the change; null means the property was cleared. */ after:string|null}>}>})>;请求体
| 必填 | 内容类型 | 说明 |
|---|---|---|
| 是 | application/json | Values for create object schema; use internal property names and resource ids from the corresponding list operations. |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 201 | application/json | Create object schema succeeded; inspect the returned resource or result collection. |
| 400 | application/json | VALIDATION_ERROR rejects invalid properties or stage rules; supply errors[0].context.properties when requirements are missing, or choose an allowed stage. BAD_REQUEST rejects malformed input; correct the request before retrying. |
| 401 | application/json | The bearer credential is missing or invalid; provide a valid platform API key before retrying. |
| 404 | application/json | OBJECT_NOT_FOUND means an object type, record or definition is unavailable in your organization; select an accessible identifier from its list operation. |
| 409 | application/json | CONFLICT means a unique value is already used or a change-set reversal would overwrite a later value; read the current records and resolve the conflicting values before retrying. |