For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create an attribute

Creates a new attribute.

  • The key must be unique across all attributes and must match the pattern ^[a-zA-Z_][a-zA-Z0-9_-]*$ (it must start with a letter or underscore, followed by letters, digits, underscores, or hyphens). Creating an attribute with a key that already exists is rejected.

  • key, name, and data_type are required.

  • The write-only translations object may be supplied to provide localized values of translatable fields (name).

post
/attributes/
Authorizations
AuthorizationstringRequired

Token credential sent in the Authorization header, in the form: Token <your-token>. Requires a staff (admin) account.

Body

The payload accepted when creating or fully updating an attribute.

keystring · max: 255Required

The unique machine key of the attribute.

Pattern: ^[a-zA-Z_][a-zA-Z0-9_-]*$
namestring · max: 255Required

The human-readable, translatable name of the attribute.

data_typestring · enumRequired

The data type of an attribute, controlling how its value is entered and interpreted. See the Data Types table under Attributes.

Possible values:
default_valueinteger · nullableOptional

The identifier of the attribute value used as the default, when any.

is_requiredbooleanOptional

Whether the attribute must have a value on the product.

is_visiblebooleanOptional

Whether the attribute is shown in management and storefront contexts.

is_searchablebooleanOptional

Whether the attribute is indexed for search.

is_filterablebooleanOptional

Whether the attribute can be used as a storefront filter.

is_variantbooleanOptional

Whether the attribute distinguishes variants of a product.

is_variant_listablebooleanOptional

Whether the attribute participates in choosing the listable variant.

is_form_requiredbooleanOptional

Whether the attribute is required in the product form.

is_form_field_requiredbooleanOptional

Whether the attribute's form field is required.

translationsobject · nullableWrite-onlyOptional

Localized values of the translatable fields, keyed by language code. Write-only.

Responses
201

The attribute was created.

application/json

An attribute definition as returned by the API.

pkintegerRead-onlyOptional

The unique identifier of the attribute.

keystring · max: 255Optional

The unique machine key of the attribute. Matches ^[a-zA-Z_][a-zA-Z0-9_-]*$.

namestring · max: 255Optional

The human-readable, translatable name of the attribute.

data_typestring · enumOptional

The data type of an attribute, controlling how its value is entered and interpreted. See the Data Types table under Attributes.

Possible values:
default_valueinteger · nullableOptional

The identifier of the attribute value used as the default, when any.

is_requiredbooleanOptional

Whether the attribute must have a value on the product.

is_visiblebooleanOptional

Whether the attribute is shown in management and storefront contexts.

is_searchablebooleanOptional

Whether the attribute is indexed for search.

is_filterablebooleanOptional

Whether the attribute can be used as a storefront filter.

is_variantbooleanOptional

Whether the attribute distinguishes variants of a product.

is_variant_listablebooleanOptional

Whether the attribute participates in choosing the listable variant.

is_form_requiredbooleanOptional

Whether the attribute is required in the product form.

is_form_field_requiredbooleanOptional

Whether the attribute's form field is required.

post/attributes/
POST /api/remote/1/attributes/ HTTP/1.1
Host: sandbox.akinon.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 266

{
  "key": "text",
  "name": "text",
  "data_type": "text",
  "default_value": null,
  "is_required": true,
  "is_visible": true,
  "is_searchable": true,
  "is_filterable": true,
  "is_variant": true,
  "is_variant_listable": true,
  "is_form_required": true,
  "is_form_field_required": true,
  "translations": null
}
{
  "pk": 42,
  "key": "color",
  "name": "Color",
  "data_type": "dropdown",
  "default_value": null,
  "is_required": true,
  "is_visible": true,
  "is_searchable": true,
  "is_filterable": true,
  "is_variant": true,
  "is_variant_listable": true,
  "is_form_required": false,
  "is_form_field_required": false
}

Last updated

Was this helpful?