Create a line item

How to create a line item via API

To create a new line item, send a POST request to the /api/line_items endpoint, passing the resource arguments in the request body.

Request

POST https://yourdomain.commercelayer.io/api/line_items

Arguments

Body Parameter
Type
Required

type

string

Required

attributes.sku_code

string

Optional

attributes.bundle_code

string

Optional

attributes.quantity

integer

Required

attributes._external_price

boolean

Optional

attributes._update_quantity

boolean

Optional

attributes._reserve_stock

boolean

Optional

attributes._reset_restocked_quantity

boolean

Optional

attributes.unit_amount_cents

integer

Required, unless computed

attributes.compare_at_amount_cents

integer

Optional

attributes.name

string

Optional

attributes.image_url

string

Optional

attributes.item_type

string

Optional

attributes.frequency

string

Optional

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.order

object

Required

relationships.item

object

Optional

relationships.tags

array

Optional

Example

The following request creates a new line item:

Last updated