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

Variant Prices API
On this page

Variant Prices

Variant prices let you define multiple pricing tiers for each variant using price keys. A price key represents a pricing tier like “wholesale”, “vip”, or “b2b”. Each variant can have a separate price, sale price, inventory count, and multi-currency overrides for each price key.

Price keys are configured at the store level and referenced by slug in the URL path. Prices are integers in the store’s base currency (cents). The price_keys extension must be enabled on the store to use these endpoints.

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

Endpoints

Method Path Auth Description
GET /v1/variants/{id}/prices Publishable List prices for a variant
PUT /v1/variants/{id}/prices/{slug} Secret Set a variant price
DELETE /v1/variants/{id}/prices/{slug} Secret Delete a variant price

List prices for a variant

GET /v1/variants/{id}/prices

Returns all price key prices for a variant, keyed by price key slug. Each entry includes the price, sale price, inventory, and multi-currency overrides. Only active (non-archived) price keys are included.

If the price_keys extension is not enabled, returns an empty object.

Request

curl https://api.hydrajs.dev/v1/variants/var_def456/prices \
  -H "Authorization: Bearer pk_live_YOUR_KEY"

Response 200

{
	"data": {
		"wholesale": {
			"slug": "wholesale",
			"label": "Wholesale",
			"price": 1999,
			"sale_price": 2499,
			"inventory_quantity": 500,
			"low_stock_threshold": 50,
			"qty_step": 6,
			"taxable": true,
			"currency_prices": { "EUR": 1849, "GBP": 1599 },
			"currency_sale_prices": { "EUR": 2299, "GBP": 1999 }
		},
		"vip": {
			"slug": "vip",
			"label": "VIP",
			"price": 2299,
			"sale_price": null,
			"inventory_quantity": 100,
			"low_stock_threshold": null,
			"qty_step": null,
			"taxable": true,
			"currency_prices": {},
			"currency_sale_prices": {}
		}
	}
}

Extension required

Variant prices require the price_keys extension. If it is not enabled, the list endpoint returns an empty object and write endpoints return 400.


Set a variant price

PUT /v1/variants/{id}/prices/{slug}

Sets the price for a variant under the specified price key slug. Creates the price entry if it does not exist, or updates it if it does. The :slug path parameter must match an active price key configured on the store (e.g. wholesale, vip).

Request body

Field Type Required Description
price integer Yes Price in cents (min 0)
sale_price integer | null No Original price in cents for sale display. Set null to clear
inventory_quantity integer No Stock count for this price tier (min 0, default 0)
low_stock_threshold integer | null No Low-stock threshold (min 0). Set null to disable
qty_step integer | null No Minimum quantity increment (min 1). Set null to clear
taxable boolean No Whether this price tier is taxable (default true)
currency_prices object No Multi-currency prices: { "EUR": 1849, "GBP": 1599 }. Keys are 3-letter ISO currency codes, values are integers in cents
currency_sale_prices object No Multi-currency sale prices. Same format as currency_prices

Prices are integers

All price fields are integers representing the smallest currency unit (e.g. cents for USD). 1999 means $19.99.

Request

curl -X PUT https://api.hydrajs.dev/v1/variants/var_def456/prices/wholesale \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "price": 1999,
    "sale_price": 2499,
    "inventory_quantity": 500,
    "low_stock_threshold": 50,
    "qty_step": 6,
    "currency_prices": { "EUR": 1849, "GBP": 1599 }
  }'

Response 200

{
	"data": {
		"slug": "wholesale",
		"label": "Wholesale",
		"price": 1999,
		"sale_price": 2499,
		"inventory_quantity": 500,
		"low_stock_threshold": 50,
		"qty_step": 6,
		"taxable": true,
		"currency_prices": { "EUR": 1849, "GBP": 1599 },
		"currency_sale_prices": {}
	}
}

Delete a variant price

DELETE /v1/variants/{id}/prices/{slug}

Removes the price entry for a variant under the specified price key slug. Returns 404 if the price entry does not exist.

Request

curl -X DELETE https://api.hydrajs.dev/v1/variants/var_def456/prices/wholesale \
  -H "Authorization: Bearer sk_live_YOUR_KEY"

Response 204

Empty body.


The variant price object

Field Type Description
slug string Price key slug (e.g. wholesale, vip)
label string Human-readable price key label
price integer Price in cents
sale_price integer | null Original price for sale display
inventory_quantity integer Stock count for this price tier
low_stock_threshold integer | null Low-stock webhook threshold
qty_step integer | null Minimum quantity increment
taxable boolean Whether this price tier is taxable
currency_prices object Multi-currency price overrides (e.g. { "EUR": 1849 })
currency_sale_prices object Multi-currency sale price overrides