## Create a property definition `client.Prism.Properties.New(ctx, objectType, params) (*PropertyDefinition, error)` **post** `/v2/prism/{teamId}/{objectType}/properties` Define a new property on this object type, scoped to the calling team. Search the existing properties first (GET this path with `term`) and reuse a match instead of defining a second property for the same fact. Pass `list_id` in the body to scope the definition to one list/app; without it the property is workspace-global and appears on every list. A name already used in that scope, an explicitly requested slug already taken, or a slug that a shared property already owns all return 409 naming the definition to use instead. The property's display format is resolved from `type` automatically — pass `role_id` only to override it. For `select_str` and `multiselect_str` types you may pre-seed the choices via `options`. ### Parameters - `objectType PrismPropertyNewParamsObjectType` - `const PrismPropertyNewParamsObjectTypeComment PrismPropertyNewParamsObjectType = "comment"` - `const PrismPropertyNewParamsObjectTypeDeal PrismPropertyNewParamsObjectType = "deal"` - `const PrismPropertyNewParamsObjectTypeEngagement PrismPropertyNewParamsObjectType = "engagement"` - `const PrismPropertyNewParamsObjectTypeIdentity PrismPropertyNewParamsObjectType = "identity"` - `const PrismPropertyNewParamsObjectTypeAIChatThread PrismPropertyNewParamsObjectType = "ai_chat_thread"` - `const PrismPropertyNewParamsObjectTypeAIChatMessage PrismPropertyNewParamsObjectType = "ai_chat_message"` - `const PrismPropertyNewParamsObjectTypeAgentSite PrismPropertyNewParamsObjectType = "agent_site"` - `const PrismPropertyNewParamsObjectTypeDocument PrismPropertyNewParamsObjectType = "document"` - `const PrismPropertyNewParamsObjectTypeAction PrismPropertyNewParamsObjectType = "action"` - `const PrismPropertyNewParamsObjectTypeEvent PrismPropertyNewParamsObjectType = "event"` - `const PrismPropertyNewParamsObjectTypeOrganization PrismPropertyNewParamsObjectType = "organization"` - `const PrismPropertyNewParamsObjectTypeContact PrismPropertyNewParamsObjectType = "contact"` - `params PrismPropertyNewParams` - `TeamID param.Field[string]` Path param - `PropertyDefinitionCreate param.Field[PropertyDefinitionCreate]` Body param: New property definition. Check for an existing property first (GET the same path with `term`) and reuse it rather than defining a near-duplicate — writes address properties by slug, so two definitions sharing a slug leave no addressable winner. For `select_str`/`multiselect_str` types you may pre-seed choices via `options`. - `IdempotencyKey param.Field[string]` Header param: A unique key (UUID or any opaque string up to 255 chars) for an authenticated POST, PUT, or PATCH request. The server retains the initial claim for 24 hours and replays a completed non-5xx response only when the method, path, and request body all match. Reusing a non-expired key with a different method, path, or body returns 409 `idempotency_key_mismatch`; reusing it after expiry returns 409 `idempotency_key_stale`, so use a new key. Replays include the `idempotent-replay: true` response header. ### Returns - `type PropertyDefinition struct{…}` Definition for a single property on an object type. Definitions with team_id and crm_id null are shared defaults; values may be scoped to a team and/or list (crm). - `ID string` - `Slug string` - `Type PropertyDefinitionType` Storage type for a property definition. Determines which per-type table holds the values, and which display formats the property can take. - `const PropertyDefinitionTypeNum PropertyDefinitionType = "num"` - `const PropertyDefinitionTypeStr PropertyDefinitionType = "str"` - `const PropertyDefinitionTypeBool PropertyDefinitionType = "bool"` - `const PropertyDefinitionTypeDate PropertyDefinitionType = "date"` - `const PropertyDefinitionTypeText PropertyDefinitionType = "text"` - `const PropertyDefinitionTypeByte PropertyDefinitionType = "byte"` - `const PropertyDefinitionTypeSelectStr PropertyDefinitionType = "select_str"` - `const PropertyDefinitionTypeMultiStr PropertyDefinitionType = "multi_str"` - `const PropertyDefinitionTypeMultiselectStr PropertyDefinitionType = "multiselect_str"` - `const PropertyDefinitionTypeJsonb PropertyDefinitionType = "jsonb"` - `const PropertyDefinitionTypeRefIdentity PropertyDefinitionType = "ref_identity"` - `const PropertyDefinitionTypeRefUser PropertyDefinitionType = "ref_user"` - `const PropertyDefinitionTypeRefOrganization PropertyDefinitionType = "ref_organization"` - `const PropertyDefinitionTypeRefContact PropertyDefinitionType = "ref_contact"` - `const PropertyDefinitionTypeRefThread PropertyDefinitionType = "ref_thread"` - `const PropertyDefinitionTypeRefMessage PropertyDefinitionType = "ref_message"` - `const PropertyDefinitionTypeRefEvent PropertyDefinitionType = "ref_event"` - `const PropertyDefinitionTypeRefAccount PropertyDefinitionType = "ref_account"` - `const PropertyDefinitionTypeRefAIChatThread PropertyDefinitionType = "ref_ai_chat_thread"` - `const PropertyDefinitionTypeRefAIChatMessage PropertyDefinitionType = "ref_ai_chat_message"` - `const PropertyDefinitionTypeMultirefAIChatMessage PropertyDefinitionType = "multiref_ai_chat_message"` - `const PropertyDefinitionTypeMultirefAgentSite PropertyDefinitionType = "multiref_agent_site"` - `const PropertyDefinitionTypeMultirefAction PropertyDefinitionType = "multiref_action"` - `const PropertyDefinitionTypeMultirefComment PropertyDefinitionType = "multiref_comment"` - `const PropertyDefinitionTypeMultirefContact PropertyDefinitionType = "multiref_contact"` - `const PropertyDefinitionTypeMultirefLabel PropertyDefinitionType = "multiref_label"` - `const PropertyDefinitionTypeMultirefThread PropertyDefinitionType = "multiref_thread"` - `const PropertyDefinitionTypeMultirefMessages PropertyDefinitionType = "multiref_messages"` - `const PropertyDefinitionTypeMultirefDocument PropertyDefinitionType = "multiref_document"` - `const PropertyDefinitionTypeMultirefIdentity PropertyDefinitionType = "multiref_identity"` - `const PropertyDefinitionTypeMultirefOrganization PropertyDefinitionType = "multiref_organization"` - `const PropertyDefinitionTypeMultirefEngagement PropertyDefinitionType = "multiref_engagement"` - `const PropertyDefinitionTypeMultirefAttendee PropertyDefinitionType = "multiref_attendee"` - `const PropertyDefinitionTypeMultirefMeetingEntry PropertyDefinitionType = "multiref_meeting_entry"` - `const PropertyDefinitionTypeMultirefReadReceipt PropertyDefinitionType = "multiref_read_receipt"` - `const PropertyDefinitionTypeMultirefAccount PropertyDefinitionType = "multiref_account"` - `const PropertyDefinitionTypeMultirefSource PropertyDefinitionType = "multiref_source"` - `Alias PropertyDefinitionAlias` Reserved alias naming this definition, or null. `app_stage` marks the list pipeline stage definition. Resolve stages by this field rather than by name, slug, or team_id: a superseded native `status` definition can coexist with the pipeline one and is otherwise identical on the wire. - `const PropertyDefinitionAliasAppStage PropertyDefinitionAlias = "app_stage"` - `CRMID string` Identifier of the list this definition is scoped to, when applicable. - `ListID string` Canonical identifier of the list this definition is scoped to. - `Locked bool` - `Name string` - `Native bool` - `Options []PropertyOption` Present only for select_str and multiselect_str types. - `ID string` - `Slug string` - `ColorScheme string` - `CRMID string` - `Description string` - `Icon string` - `ListID string` - `OptionGroup string` - `SortIndex int64` - `Value string` Display value for the option. - `Required bool` When true, records of this object type must carry a non-empty value for this property on create, and a patch may not clear it. - `RoleID string` The property's display format. Always populated on definitions created through this API; a null here means the definition predates that and will render as an unknown format until it is patched. - `TeamID string` ### Example ```go package main import ( "context" "fmt" "github.com/micro-so/micro-sdk-go" "github.com/micro-so/micro-sdk-go/option" ) func main() { client := micro.NewClient( option.WithAPIKey("My API Key"), option.WithTeamID("My Team ID"), ) propertyDefinition, err := client.Prism.Properties.New( context.TODO(), micro.PrismPropertyNewParamsObjectTypeComment, micro.PrismPropertyNewParams{ PropertyDefinitionCreate: micro.PropertyDefinitionCreateParam{ Name: micro.F("name"), Type: micro.F(micro.PropertyDefinitionCreateTypeNum), }, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", propertyDefinition.ID) } ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "slug": "slug", "type": "num", "alias": "app_stage", "crm_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "list_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "locked": true, "name": "name", "native": true, "options": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "slug": "slug", "color_scheme": "color_scheme", "crm_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "description": "description", "icon": "icon", "list_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "option_group": "option_group", "sort_index": 0, "value": "value" } ], "required": true, "role_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "team_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ```