Create Attribute
POST/api/attributes
Creates a new attribute.
products:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Requires Bearer token.
Fields:
- name (required): Unique name, max 255 chars
- type (required): One of: string, longtext, date, datetime, numeric, integer, checkbox
- display_options (optional): JSON object with display configuration
- option_values (optional): Array of selectable options for dropdown-type attributes
- option_values.*.value (optional): Option value string, max 255 chars
- option_values.*.sort_order (optional): Sort order integer
- validation (optional): JSON validation rules
- available_for_templates (optional): Boolean — makes attribute available in email templates
- attribute_group_id (optional): ID of the group to assign this attribute to
- notes (optional): Internal notes, max 255 chars
Requires permission: attributes.create
Each entry in option_values may carry an optional variant SWATCH — swatch_hex (a hex colour, max 20) and/or swatch_image_url (an image URL, max 500). When the attribute is used as a variant axis (e.g. Color), channels that support swatches (Walmart) render this chip for every variant that selects the value. Send null to clear a swatch.
Request
Responses
- 201
- 401
- 403
- 422
- 429
Created
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.