Hydra is now in beta|Get started free|Follow our journey on X.com

Product Types API
On this page

Product Types

Product types categorize products (e.g. “Footwear”, “Apparel”, “Electronics”). Types are created automatically when assigned to a product, but you can also pre-define them so they appear in autocomplete before any products use them.

Base URL: https://api.hydrajs.dev

Endpoints

Method Path Auth Description
GET /v1/product-types Publishable List product types
POST /v1/product-types Secret Create a product type
POST /v1/product-types/rename Secret Rename a product type
POST /v1/product-types/remove Secret Remove a product type

List product types

GET /v1/product-types

Returns all product types with their product counts. Includes both pre-defined types and types discovered from products.

Request

curl https://api.hydrajs.dev/v1/product-types \
  -H "Authorization: Bearer pk_live_YOUR_KEY"

Response 200

{
	"data": [
		{ "name": "Apparel", "product_count": 45 },
		{ "name": "Footwear", "product_count": 12 },
		{ "name": "Accessories", "product_count": 8 }
	]
}

Create a product type

POST /v1/product-types

Pre-defines a product type so it appears in autocomplete before any products use it. Names are unique per store (case-insensitive).

Request body

Field Type Required Description
name string Yes Product type name (1-255 chars)

Request

curl -X POST https://api.hydrajs.dev/v1/product-types \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Footwear"}'

Response 201

{
	"data": {
		"name": "Footwear",
		"product_count": 0
	}
}

Rename a product type

POST /v1/product-types/rename

Renames a product type and updates all products that use it.

Request body

Field Type Required Description
from string Yes Current product type name
to string Yes New product type name (1-255 chars)

Request

curl -X POST https://api.hydrajs.dev/v1/product-types/rename \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"from": "Shoes", "to": "Footwear"}'

Response 204

Empty body.


Remove a product type

POST /v1/product-types/remove

Removes a product type and clears it from all products that use it.

Request body

Field Type Required Description
name string Yes Product type name to remove

Request

curl -X POST https://api.hydrajs.dev/v1/product-types/remove \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Footwear"}'

Response 204

Empty body.


The product type object

Field Type Description
name string Product type name
product_count integer Number of products using this type