Product Options API Routes

A product option is a way to define different options for a product, such as "Size" or "Color". Product options can be created globally and used by multiple products, or they can be exclusive to a specific product. These API routes allow admin users to manage product options.

GET /admin/product-options#

List Product Options

Retrieve a list of product options. The product options can be filtered by fields such as id. The product options can also be sorted or paginated.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Query parameters

titlestring | string[]Optional
Filter by a product option title.
created_atobjectOptional
Filter by the product option's creation date. Accepts the filter operators.
updated_atobjectOptional
Filter by the product option's update date. Accepts the filter operators.
deleted_atobjectOptional
Filter by the product option's deletion date. Accepts the filter operators.
orderstringOptional
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
qstringOptional
Search query for product options.
is_exclusivebooleanOptional
Filter by whether the product option is global or exclusive to a product.
limitnumberOptional
Limit the number of items returned in the list.
offsetnumberOptional
The number of items to skip when retrieving a list.
with_deletedbooleanOptional
The product option's with deleted.
fieldsstringOptional
Comma-separated fields that should be included in the returned data. If a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. Without prefix it will replace the entire default fields.
$andobject[]Optional
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
$orobject[]Optional
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
idstring | string[]Optional
Filter by a product option ID.

Request examples

Responses

200 OK

limitnumber
The maximum number of items returned.
offsetnumber
The number of items skipped before retrieving the returned items.
countnumber
The total number of items.
estimate_countnumberOptional
The estimated count retrieved from the PostgreSQL query planner, which may be inaccurate.
product_optionsobject[]
The list of product options.

400, 401, 404, 409, 422, 500: an error response is returned.


POST /admin/product-options#

Create Product Option

Create a product option.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Request body (application/json)

titlestring
The product option's title.
valuesstring[]
The product option's values.
ranksobjectOptional
The ranking of the option's values. The keys are the value names and the values are their respective ranks.
is_exclusivebooleanOptional
Whether the option is exclusive to the product.

Request examples

Responses

200 OK

product_optionobject
The product option's details.

400, 401, 404, 409, 422, 500: an error response is returned.

Emitted events

  • product-option.created: Emitted when product options are created.

GET /admin/product-options/{id}#

Get a Product Option

Retrieve a product option by its ID. You can expand the product option's relations or select the fields that should be returned.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The product option's ID.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. If a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. Without prefix it will replace the entire default fields.

Request examples

Responses

200 OK

product_optionobject
The product option's details.

400, 401, 404, 409, 422, 500: an error response is returned.


POST /admin/product-options/{id}#

Update a Product Option

Update a product option's details.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The product option's ID.

Request body (application/json)

titlestringOptional
The option's title.
valuesstring[]Optional
The option's values.
idstringOptional
The option's ID.
ranksobjectOptional
The product option's ranks.
is_exclusivebooleanOptional
Whether the product option is exclusive to the product. If disabled, the product option can be used by other products.
metadataobjectOptional
Key-value pairs that hold additional information about the product option.

Request examples

Responses

200 OK

product_optionobject
The product option's details.

400, 401, 404, 409, 422, 500: an error response is returned.

Emitted events

  • product-option.updated: Emitted when product options are updated.

DELETE /admin/product-options/{id}#

Delete a Product Option

Delete a product option.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The product option's ID.

Request examples

Responses

200 OK

idstring
The product option's ID.
objectstring
The name of the deleted object.

Default: "product_option"

deletedboolean
Whether the product option was deleted.
parentobjectOptional
The product's details.

400, 401, 404, 409, 422, 500: an error response is returned.

Emitted events

  • product-option.deleted: Emitted when product options are deleted.

GET /admin/product-options/{id}/values#

List Product Option Values

Retrieve a list of values in a product option. The values can be filtered by fields like id. The values can also be paginated.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The product option's ID.

Query parameters

qstringOptional
Query to apply on the product option value's searchable fields.
idstring | string[]Optional
Filter by a product option value ID.
valuestring | string[]Optional
Filter by a product option value.
option_idstring | string[]Optional
Filter by the value's product option ID.
created_atobjectOptional
Filter by the product option value's creation date. Accepts the filter operators.
updated_atobjectOptional
Filter by the product option value's update date. Accepts the filter operators.
deleted_atobjectOptional
Filter by the product option value's deletion date. Accepts the filter operators.
limitnumberOptional
Limit the number of items returned in the list.
offsetnumberOptional
The number of items to skip when retrieving a list.
orderstringOptional
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
with_deletedbooleanOptional
The product option's with deleted.
fieldsstringOptional
Comma-separated fields that should be included in the returned data. If a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. Without prefix it will replace the entire default fields.
$andobject[]Optional
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
$orobject[]Optional
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.

Request examples

Responses

200 OK

limitnumber
The maximum number of items returned in the list.
offsetnumber
The number of items skipped before retrieving the list.
countnumber
The total number of items in the list.
estimate_countnumberOptional
The estimated count retrieved from the PostgreSQL query planner, which may be inaccurate.
product_option_valuesobject[]
The list of product option values.

400, 401, 404, 409, 422, 500: an error response is returned.


GET /admin/product-options/{id}/values/{value_id}#

Get Product Option Value

Get a product option value by its ID.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The product option's ID.
value_idstring
The product option value's ID.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. If a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. Without prefix it will replace the entire default fields.

Request examples

Responses

200 OK

product_option_valueobject
The product option value's details.

400, 401, 404, 409, 422, 500: an error response is returned.


POST /admin/product-options/{id}/values/{value_id}#

Update Product Option Value

Update a product option value's details.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The product option's ID.
value_idstring
The product option value's ID.

Request body (application/json)

valuestringOptional
The product option's value.
metadataobjectOptional
Key-value pairs that hold additional information about the product option value.

Request examples

Responses

200 OK

product_option_valueobject
The product option value's details.

400, 401, 404, 409, 422, 500: an error response is returned.

Emitted events

  • product-option-value.updated: Emitted when product option values are updated.

DELETE /admin/product-options/{id}/values/{value_id}#

Remove Value from Product Option

Remove a Value from a product option.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The product option's ID.
value_idstring
The value's ID.

Request examples

Responses

200 OK

idstring
The ID of the deleted product option value.
objectstring
The name of the deleted object.

Default: "product_option_value"

deletedboolean
Whether the Product Option Value was deleted.
parentobjectOptional
The product option's details.

400, 401, 404, 409, 422, 500: an error response is returned.

Emitted events

  • product-option-value.deleted: Emitted when product option values are deleted.
Found a problem with this page?Report Issue
Edited Nov 14·Edit this page