Skip to main content
POST
/
api
/
v3
/
admin
/
products
/
{product_id}
/
variants
Spree Admin SDK
import { createAdminClient } from '@spree/admin-sdk'

const client = createAdminClient({
  baseUrl: 'https://your-store.com',
  secretKey: 'sk_xxx',
})

const variant = await client.products.variants.create('prod_86Rf07xd4z', {
  sku: 'TSHIRT-L-NAVY',
  options: [
    { name: 'size', value: 'Large' },
    { name: 'color', value: 'navy' },
  ],
  prices: [
    { currency: 'USD', amount: 29.99, compare_at_amount: 34.99 },
    { currency: 'EUR', amount: 27.99 },
  ],
  stock_items: [
    { stock_location_id: 'sloc_UkLWZg9DAJ', count_on_hand: 25 },
  ],
})
{
  "id": "variant_EfhxLZ9ck8",
  "product_id": "prod_UkLWZg9DAJ",
  "sku": "NEW-SKU-001",
  "options_text": "Size: XL",
  "track_inventory": true,
  "media_count": 0,
  "thumbnail_url": null,
  "purchasable": false,
  "in_stock": false,
  "backorderable": false,
  "weight": 0,
  "height": null,
  "width": null,
  "depth": null,
  "price": {
    "id": "price_EfhxLZ9ck8",
    "amount": "24.99",
    "amount_in_cents": 2499,
    "compare_at_amount": null,
    "compare_at_amount_in_cents": null,
    "currency": "USD",
    "display_amount": "$24.99",
    "display_compare_at_amount": null,
    "price_list_id": null
  },
  "original_price": null,
  "option_values": [
    {
      "id": "optval_gbHJdmfrXB",
      "option_type_id": "opt_gbHJdmfrXB",
      "name": "xl",
      "label": "XL",
      "position": 1,
      "color_code": null,
      "option_type_name": "size",
      "option_type_label": "Size",
      "image_url": null,
      "metadata": {},
      "created_at": "2026-05-21T18:11:49.443Z",
      "updated_at": "2026-05-21T18:11:49.443Z"
    }
  ],
  "metadata": {},
  "position": 3,
  "cost_price": null,
  "cost_currency": "USD",
  "barcode": null,
  "weight_unit": "lb",
  "dimensions_unit": null,
  "deleted_at": null,
  "created_at": "2026-05-21T18:11:49.446Z",
  "updated_at": "2026-05-21T18:11:49.447Z",
  "tax_category_id": "taxcat_UkLWZg9DAJ",
  "available_stock": 0,
  "reserved_quantity": 0,
  "total_on_hand": 0,
  "product_name": "Product 512416"
}

Documentation Index

Fetch the complete documentation index at: https://spreecommerce.org/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

x-spree-api-key
string
header
required

Secret API key for admin access

Authorization
string
header
required

JWT token for admin user authentication

Headers

x-spree-api-key
string
required
Authorization
string
required

Bearer token for admin authentication

Path Parameters

product_id
string
required

Product ID

Body

application/json
sku
string
Example:

"SKU-001"

price
number
Example:

29.99

compare_at_price
number
Example:

39.99

cost_price
number
Example:

10

cost_currency
string
Example:

"USD"

weight
number
height
number
width
number
depth
number
weight_unit
string
dimensions_unit
string
track_inventory
boolean
tax_category_id
string
options
object[]

One pair per option type the variant participates in (e.g. size + color). Option types and values are auto-created if missing.

position
integer
barcode
string
prices
object[]

Per-currency prices. Upserted by currency.

stock_items
object[]

Per-stock-location inventory. Upserted by stock_location_id.

Response

variant created