Skip to main content
POST
Relate one product to another

Authorizations

Authorization
string
header
required

Use a project API key from Settings > API Access. Send it as Authorization: Bearer wpk_.... See authentication and scopes for setup and permissions.

Headers

Idempotency-Key
string

Reuse this key for retries of the same write. Scoped to this API key; retained for 30 days, after which the key may be reused. Different requests with the same key return 409.

Required string length: 1 - 128
Pattern: ^[!-~]+$

Body

application/json
relation_type
string
required

One of cross_sell, up_sell, related, replacement, accessory, bundle_item, grouped_item.

position
integer | null

Order within the product's relations of this type. Appended when omitted.

Required range: 0 <= x <= 2147483647
quantity
integer
default:1

Quantity for bundle items.

Required range: 1 <= x <= 2147483647
is_required
boolean
default:true

Whether this item is required in a bundle.

product
integer | null

The product the relation starts from.

Required range: 0 < x <= 9223372036854776000
product_sku
string | null

Same as product, addressed by SKU. Send one of the two.

Required string length: 1 - 255

The product it points to. Relations are one-directional.

Required range: 0 < x <= 9223372036854776000

Same as related_product, addressed by SKU. Send one of the two.

Required string length: 1 - 255

Response

Created

id
integer
required
product
integer
required
relation_type
string
required
position
integer
required
quantity
integer
required
is_required
boolean
required