Create an attribute definition

Create an attribute, including full AI-generation config (snake_case body). For an AI-generated attribute set ai_generated: true + custom_instructions (reference other attributes with {{key}}), and pick selected_tools: includeWebSearch (live web research), includeDataSources (scraped sites/CSVs), includeImages (vision), includeProductAttributes. Image/video generation models are supported. inheritance_mode shares a value across a variant family (products only).

Scope: write:attributes.

post/attributes

Request

  • Base URL
    https://www.merchkit.com/api/v1
  • Auth
    HTTP bearer

Request body

namestring required
entity_typestring required
data_type'single_line_text_field' | 'multi_line_text_field' | 'rich_text_field' | 'number' | 'boolean' | 'date' | 'url' | 'json' | 'single_select_list' | 'multi_select_list' | 'image' | 'video' | 'formula' | 'web_preview' | 'status' | 'progress' | 'rank' required
ai_generatedboolean required
custom_instructionsstring

Generation prompt; reference other attributes with {{key}}.

formula_expressionstring

Template of a computed column: a formula expression, or an HTML template with data_type: web_preview. Makes the attribute computed (not AI-generated).

acceptable_valuesstring

Comma-separated allowed values for select attributes.

default_valuestring
is_primaryboolean
selected_toolsstring[]

AI text-generation tools. includeWebSearch = live web research; includeDataSources = scraped sites/CSVs; includeImages = vision.

source_attribute_keysstring[]
required_dependenciesstring[]
image_model'gpt-image-1' | 'nano-banana'
image_source_attribute_keystring[]
aspect_ratio'1:1' | '4:3' | '3:4' | '16:9' | '9:16'

Image generation aspect ratio. Legacy values (Square→1:1, Landscape→16:9, Portrait→9:16) are still accepted for backward compatibility but are deprecated.

video_model'veo3.1'
video_source_attribute_keystring[]
vision_image_source_attribute_keystring[]
inheritance_mode'off' | 'inherit_from_parent' | 'rollup_from_children'

Parent/child variant inheritance (products only; ignored for image/video attributes). inherit_from_parent = variants display the parent's value; rollup_from_children = the parent displays its variants' combined values; off removes inheritance. Virtualized at read time.

rollup_aggregation'unique' | 'all'

Only with rollup_from_children. unique = distinct values joined; all = one entry per variant. Default unique.

Response

The created attribute definition (full config).

Example response

{
  "data": {
    "id": "a3d81c22-5f6e-4b09-8d17-c40a92e5b613",
    "name": "Material",
    "key": "material",
    "data_type": "single_select_list",
    "tool": "manual",
    "entity_type": "product",
    "channel": null,
    "is_primary": false,
    "custom_instructions": null,
    "acceptable_values": "White Oak,Smoked Oak,Walnut",
    "default_value": null,
    "constraints": {},
    "source_attributes": null
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.