Commerce Layer line_items API

resource type

Operations 5

GET /line_items List all line items #
POST /line_items Create a line item #
GET /line_items/{lineItemId} Retrieve a line item #
PATCH /line_items/{lineItemId} Update a line item #
DELETE /line_items/{lineItemId} Delete a line item #

Documentation

Specifications

Schemas & Data

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/commerce-layer-line-items-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no email required.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

commerce-layer-line-items-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Commerce Layer Line Items API
  version: 7.10.1
  contact:
    name: API Support
    url: https://commercelayer.io
    email: support@commercelayer.io
  description: Headless Commerce for Global Brands.
servers:
- url: https://{your_organization_slug}.commercelayer.io/api
  description: API
- url: https://core.commercelayer.io/users/sign_in
  description: Sign in
- url: https://docs.commercelayer.io/api
  description: API reference
security:
- bearerAuth: []
tags:
- name: line_items
  description: resource type
paths:
  /line_items:
    get:
      operationId: GET/line_items
      summary: List all line items
      description: List all line items
      tags:
      - line_items
      responses:
        '200':
          description: A list of line item objects
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/lineItemResponseList'
    post:
      operationId: POST/line_items
      summary: Create a line item
      description: Create a line item
      tags:
      - line_items
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/lineItemCreate'
      responses:
        '201':
          description: The created line item object
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/lineItemResponse'
  /line_items/{lineItemId}:
    get:
      operationId: GET/line_items/lineItemId
      summary: Retrieve a line item
      description: Retrieve a line item
      tags:
      - line_items
      parameters:
      - name: lineItemId
        in: path
        schema:
          type: string
        required: true
        description: The resource's id
      responses:
        '200':
          description: The line item object
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/lineItemResponse'
    patch:
      operationId: PATCH/line_items/lineItemId
      summary: Update a line item
      description: Update a line item
      tags:
      - line_items
      parameters:
      - name: lineItemId
        in: path
        schema:
          type: string
        required: true
        description: The resource's id
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/lineItemUpdate'
      responses:
        '200':
          description: The updated line item object
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/lineItemResponse'
    delete:
      operationId: DELETE/line_items/lineItemId
      summary: Delete a line item
      description: Delete a line item
      tags:
      - line_items
      parameters:
      - name: lineItemId
        in: path
        schema:
          type: string
        required: true
        description: The resource's id
      responses:
        '204':
          description: No content
components:
  schemas:
    lineItemResponseList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/lineItemResponse/properties/data'
    lineItemCreate:
      required:
      - data
      type: object
      properties:
        data:
          type: object
          required:
          - type
          - attributes
          properties:
            type:
              type: string
              description: The resource's type
              enum:
              - line_items
            attributes:
              type: object
              properties:
                sku_code:
                  type: string
                  description: The code of the associated SKU.
                  example: TSHIRTMM000000FFFFFFXLXX
                bundle_code:
                  type: string
                  description: The code of the associated bundle.
                  example: BUNDLEMM000000FFFFFFXLXX
                quantity:
                  type: integer
                  description: The line item quantity.
                  example: 4
                _external_price:
                  type: boolean
                  description: When creating or updating a new line item, set this attribute to '1' if you want to inject the unit_amount_cents price from an external source. Any successive price computation will be done externally, until the attribute is reset to '0'.
                  example: true
                _update_quantity:
                  type: boolean
                  description: When creating a new line item, set this attribute to '1' if you want to update the line item quantity (if present) instead of creating a new line item for the same SKU.
                  example: true
                _reserve_stock:
                  type: boolean
                  description: Send this attribute if you want to reserve the stock for the line item's SKUs quantity. Stock reservations expiration depends on the inventory model's cutoff. When used on update the existing active stock reservations are renewed. Cannot be passed by sales channels.
                  example: true
                _reset_restocked_quantity:
                  type: boolean
                  description: Send this attribute if you want to reset the quantity restocked by a return or by an order/shipment cancel. This will allow for multiple returns, albeit you need to adjust the stock manually. Cannot be passed by sales channels.
                  example: true
                unit_amount_cents:
                  type: integer
                  description: The unit amount of the line item, in cents. Can be specified only via an integration application, or when the item is missing, otherwise is automatically computed by using one of the available methods. Cannot be passed by sales channels.
                  example: 10000
                compare_at_amount_cents:
                  type: integer
                  description: The compared price amount, in cents. Useful to display a percentage discount.
                  example: 13000
                name:
                  type: string
                  description: The name of the line item. When blank, it gets populated with the name of the associated item (if present).
                  example: Men's Black T-shirt with White Logo (XL)
                image_url:
                  type: string
                  description: The image_url of the line item. When blank, it gets populated with the image_url of the associated item (if present, SKU only).
                  example: https://img.yourdomain.com/skus/xYZkjABcde.png
                item_type:
                  type: string
                  description: The type of the associated item. One of 'skus', 'bundles', 'gift_cards', 'shipments', 'payment_methods', 'adjustments', 'discount_engine_items', 'percentage_discount_promotions', 'free_shipping_promotions', 'buy_x_pay_y_promotions', 'free_gift_promotions', 'fixed_price_promotions', 'external_promotions', 'fixed_amount_promotions', or 'flex_promotions'.
                  example: skus
                  enum:
                  - skus
                  - bundles
                  - gift_cards
                  - shipments
                  - payment_methods
                  - adjustments
                  - discount_engine_items
                  - percentage_discount_promotions
                  - free_shipping_promotions
                  - buy_x_pay_y_promotions
                  - free_gift_promotions
                  - fixed_price_promotions
                  - external_promotions
                  - fixed_amount_promotions
                  - flex_promotions
                frequency:
                  type: string
                  description: The frequency which generates a subscription. Must be supported by existing associated subscription_model.
                  example: monthly
                reference:
                  type: string
                  description: A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
                  example: ANY-EXTERNAL-REFEFERNCE
                reference_origin:
                  type: string
                  description: Any identifier of the third party system that defines the reference code.
                  example: ANY-EXTERNAL-REFEFERNCE-ORIGIN
                metadata:
                  type: object
                  description: Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
                  example:
                    foo: bar
              required:
              - quantity
            relationships:
              type: object
              properties:
                order:
                  required:
                  - data
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - orders
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
                item:
                  required:
                  - data
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - skus
                          - bundles
                          - gift_cards
                          - shipments
                          - payment_methods
                          - adjustments
                          - discount_engine_items
                          - percentage_discount_promotions
                          - free_shipping_promotions
                          - buy_x_pay_y_promotions
                          - free_gift_promotions
                          - fixed_price_promotions
                          - external_promotions
                          - fixed_amount_promotions
                          - flex_promotions
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
                  oneOf:
                  - $ref: '#/components/schemas/sku'
                  - $ref: '#/components/schemas/bundle'
                  - $ref: '#/components/schemas/giftCard'
                  - $ref: '#/components/schemas/shipment'
                  - $ref: '#/components/schemas/paymentMethod'
                  - $ref: '#/components/schemas/adjustment'
                  - $ref: '#/components/schemas/discountEngineItem'
                  - $ref: '#/components/schemas/percentageDiscountPromotion'
                  - $ref: '#/components/schemas/freeShippingPromotion'
                  - $ref: '#/components/schemas/buyXPayYPromotion'
                  - $ref: '#/components/schemas/freeGiftPromotion'
                  - $ref: '#/components/schemas/fixedPricePromotion'
                  - $ref: '#/components/schemas/externalPromotion'
                  - $ref: '#/components/schemas/fixedAmountPromotion'
                  - $ref: '#/components/schemas/flexPromotion'
                tags:
                  required:
                  - data
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - tags
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
              required:
              - order
    paymentMethod:
      type: object
      properties:
        data:
          type: object
          required:
          - type
          - attributes
          properties:
            type:
              type: string
              description: The resource's type
              enum:
              - payment_methods
            attributes:
              type: object
              properties:
                name:
                  type: string
                  description: The payment method's internal name.
                  example: Stripe Payment
                  nullable: true
                payment_source_type:
                  type: string
                  description: The payment source type. One of 'adyen_payments', 'axerve_payments', 'braintree_payments', 'checkout_com_payments', 'external_payments', 'klarna_payments', 'paypal_payments', 'satispay_payments', 'stripe_payments', or 'wire_transfers'.
                  example: stripe_payments
                  nullable: false
                  enum:
                  - adyen_payments
                  - axerve_payments
                  - braintree_payments
                  - checkout_com_payments
                  - external_payments
                  - klarna_payments
                  - paypal_payments
                  - satispay_payments
                  - stripe_payments
                  - wire_transfers
                currency_code:
                  type: string
                  description: The international 3-letter currency code as defined by the ISO 4217 standard.
                  example: EUR
                  nullable: true
                moto:
                  type: boolean
                  description: Send this attribute if you want to mark the payment as MOTO, must be supported by payment gateway.
                  example: false
                  nullable: true
                require_capture:
                  type: boolean
                  description: Send this attribute if you want to require the payment capture before fulfillment.
                  example: true
                  nullable: true
                auto_place:
                  type: boolean
                  description: Send this attribute if you want to automatically place the order upon authorization performed asynchronously.
                  example: true
                  nullable: true
                auto_capture:
                  type: boolean
                  description: Send this attribute if you want to automatically capture the payment upon authorization.
                  example: false
                  nullable: true
                price_amount_cents:
                  type: integer
                  description: The payment method's price, in cents.
                  example: 0
                  nullable: false
                price_amount_float:
                  type: number
                  description: The payment method's price, float.
                  example: 0.0
                  nullable: true
                formatted_price_amount:
                  type: string
                  description: The payment method's price, formatted.
                  example: €0,00
                  nullable: true
                auto_capture_max_amount_cents:
                  type: integer
                  description: Send this attribute if you want to limit automatic capture to orders for which the total amount is equal or less than the specified value, in cents.
                  example: 0
                  nullable: true
                auto_capture_max_amount_float:
                  type: number
                  description: The automatic capture max amount, float.
                  example: 0.0
                  nullable: true
                formatted_auto_capture_max_amount:
                  type: string
                  description: The automatic capture max amount, formatted.
                  example: €0,00
                  nullable: true
                disabled_at:
                  type: string
                  description: Time at which this resource was disabled.
                  example: '2018-01-01T12:00:00.000Z'
                  nullable: true
                created_at:
                  type: string
                  description: Time at which the resource was created.
                  example: '2018-01-01T12:00:00.000Z'
                  nullable: false
                updated_at:
                  type: string
                  description: Time at which the resource was last updated.
                  example: '2018-01-01T12:00:00.000Z'
                  nullable: false
                reference:
                  type: string
                  description: A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
                  example: ANY-EXTERNAL-REFEFERNCE
                  nullable: true
                reference_origin:
                  type: string
                  description: Any identifier of the third party system that defines the reference code.
                  example: ANY-EXTERNAL-REFEFERNCE-ORIGIN
                  nullable: true
                metadata:
                  type: object
                  description: Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
                  example:
                    foo: bar
                  nullable: true
            relationships:
              type: object
              properties:
                market:
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - markets
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
                payment_gateway:
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - payment_gateways
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
                store:
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - stores
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
                attachments:
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - attachments
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
                event_stores:
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - event_stores
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
    giftCard:
      type: object
      properties:
        data:
          type: object
          required:
          - type
          - attributes
          properties:
            type:
              type: string
              description: The resource's type
              enum:
              - gift_cards
            attributes:
              type: object
              properties:
                status:
                  type: string
                  description: The gift card status. One of 'draft' (default), 'inactive', 'active', or 'redeemed'.
                  example: draft
                  nullable: false
                  enum:
                  - draft
                  - inactive
                  - active
                  - redeemed
                code:
                  type: string
                  description: The gift card code UUID. If not set, it's automatically generated.
                  example: 32db311a-75d9-4c17-9e34-2be220137ad6
                  nullable: true
                currency_code:
                  type: string
                  description: The international 3-letter currency code as defined by the ISO 4217 standard.
                  example: EUR
                  nullable: true
                initial_balance_cents:
                  type: integer
                  description: The gift card initial balance, in cents.
                  example: 15000
                  nullable: false
                initial_balance_float:
                  type: number
                  description: The gift card initial balance, float.
                  example: 150.0
                  nullable: false
                formatted_initial_balance:
                  type: string
                  description: The gift card initial balance, formatted.
                  example: €150,00
                  nullable: false
                balance_cents:
                  type: integer
                  description: The gift card balance, in cents.
                  example: 15000
                  nullable: false
                balance_float:
                  type: number
                  description: The gift card balance, float.
                  example: 150.0
                  nullable: false
                formatted_balance:
                  type: string
                  description: The gift card balance, formatted.
                  example: €150,00
                  nullable: false
                balance_max_cents:
                  type: integer
                  description: The gift card balance max, in cents.
                  example: 100000
                  nullable: true
                balance_max_float:
                  type: number
                  description: The gift card balance max, float.
                  example: 1000.0
                  nullable: true
                formatted_balance_max:
                  type: string
                  description: The gift card balance max, formatted.
                  example: €1000,00
                  nullable: true
                balance_log:
                  type: array
                  description: The gift card balance log. Tracks all the gift card transactions.
                  example:
                  - datetime: '2019-12-23T12:00:00.000Z'
                    balance_change_cents: -10000
                  - datetime: '2020-02-01T12:00:00.000Z'
                    balance_change_cents: 5000
                  nullable: false
                  items:
                    type: object
                usage_log:
                  type: object
                  description: The gift card usage log. Tracks all the gift card usage actions by orders.
                  example:
                    eNoKkhmbNp:
                    - action: use
                      amount_cents: -1000
                      balance_cents: 4000
                      order_number: '11111'
                      datetime: '2020-02-01T12:00:00.000Z'
                  nullable: false
                single_use:
                  type: boolean
                  description: Indicates if the gift card can be used only one.
                  example: false
                  nullable: true
                rechargeable:
                  type: boolean
                  description: Indicates if the gift card can be recharged.
                  example: true
                  nullable: true
                distribute_discount:
                  type: boolean
                  description: Indicates if redeemed gift card amount is distributed for tax calculation.
                  example: true
                  nullable: true
                image_url:
                  type: string
                  description: The URL of an image that represents the gift card.
                  example: https://img.yourdomain.com/gift_cards/32db311a.png
                  nullable: true
                expires_at:
                  type: string
                  description: Time at which the gift card will expire.
                  example: '2018-01-01T12:00:00.000Z'
                  nullable: true
                recipient_email:
                  type: string
                  description: The email address of the associated recipient. When creating or updating a gift card, this is a shortcut to find or create the associated recipient by email.
                  example: john@example.com
                  nullable: true
                created_at:
                  type: string
                  description: Time at which the resource was created.
                  example: '2018-01-01T12:00:00.000Z'
                  nullable: false
                updated_at:
                  type: string
                  description: Time at which the resource was last updated.
                  example: '2018-01-01T12:00:00.000Z'
                  nullable: false
                reference:
                  type: string
                  description: A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
                  example: ANY-EXTERNAL-REFEFERNCE
                  nullable: true
                reference_origin:
                  type: string
                  description: Any identifier of the third party system that defines the reference code.
                  example: ANY-EXTERNAL-REFEFERNCE-ORIGIN
                  nullable: true
                metadata:
                  type: object
                  description: Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
                  example:
                    foo: bar
                  nullable: true
            relationships:
              type: object
              properties:
                market:
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - markets
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
                gift_card_recipient:
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - gift_card_recipients
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
                attachments:
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - attachments
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
                events:
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - events
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
                tags:
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - tags
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
                event_stores:
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - event_stores
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
    percentageDiscountPromotion:
      type: object
      properties:
        data:
          type: object
          required:
          - type
          - attributes
          properties:
            type:
              type: string
              description: The resource's type
              enum:
              - percentage_discount_promotions
            attributes:
              type: object
              properties:
                name:
                  type: string
                  description: The promotion's internal name.
                  example: Personal promotion
                  nullable: false
                type:
                  type: string
                  description: The promotion's type.
                  example: percentage_discount_promotions
                  nullable: false
                  enum:
                  - percentage_discount_promotions
                  - free_shipping_promotions
                  - buy_x_pay_y_promotions
                  - free_gift_promotions
          

# --- truncated at 32 KB (231 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/commerce-layer/refs/heads/main/openapi/commerce-layer-line-items-api-openapi.yml