Product Types API Routes

Products can be organized into types. Each type has a name and a value.

Products are organized into the same type if they have the same value.

These API routes allow admin users to manage product types.

GET /admin/product-types#

List Product Types

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

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

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.
offsetnumberOptional
The number of items to skip when retrieving a list.
limitnumberOptional
Limit the number of items returned in the 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 -.
qstringOptional
Search term to filter the product type's searchable properties.
idstring | string[]Optional
Filter by a product type's ID.
valuestring | string[]Optional
Filter by a type's value.
created_atobjectOptional
Filter by the type's creation date. Accepts the filter operators.
updated_atobjectOptional
Filter by the type's update date. Accepts the filter operators.
deleted_atobjectOptional
Filter by the type's deletion date. Accepts the filter operators.
$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.
with_deletedbooleanOptional
Whether to include deleted records in the result.
external_idstring | string[]Optional
Filter by an external 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.
product_typesobject[]
The list of product types.
estimate_countnumberOptional
The estimated count retrieved from the PostgreSQL query planner, which may be inaccurate.

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


POST /admin/product-types#

Create Product Type

Create a product type.

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

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 body (application/json)

metadataobjectOptional
The product's metadata, used to store custom key-value pairs. Learn more in the Manage Metadata section.
valuestring
The product type's value.
external_idstringOptional
The ID of the product type in an external or third-party system.

Request examples

Responses

200 OK

product_typeobject
The product type's details.

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

Emitted events

  • product-type.created: Emitted when product types are created.

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

Get a Product Type

Retrieve a product type by its ID. You can expand the product type'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 type'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_typeobject
The product type's details.

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


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

Update a Product Type

Update a product type's details.

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

Path parameters

idstring
The product type'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 body (application/json)

valuestringOptional
The product type's value.
metadataobjectOptional
The product type's metadata. Can hold custom key-value pairs. Learn more in the Manage Metadata section.
external_idstringOptional
The product type's external ID used to link it with external systems.

Request examples

Responses

200 OK

product_typeobject
The product type's details.

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

Emitted events

  • product-type.updated: Emitted when product types are updated.

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

Delete a Product Type

Delete a product type. This doesn't delete products of this type.

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

Path parameters

idstring
The product type's ID.

Request examples

Responses

200 OK

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

Default: "product_type"

deletedboolean
Whether the product type was deleted.

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

Emitted events

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