> ## 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.

# Create a Line Item

> Creates a Line Item



## OpenAPI

````yaml /api-reference/platform.yaml post /api/v2/platform/line_items
openapi: 3.0.3
info:
  title: Platform API
  contact:
    name: Vendo Connect Inc.
    url: https://getvendo.com
    email: sales@getvendo.com
  description: Spree Platform API
  version: v2
servers:
  - url: http://{defaultHost}
    variables:
      defaultHost:
        default: localhost:3000
security: []
tags:
  - name: Addresses
  - name: Adjustments
  - name: Classifications
  - name: Countries
  - name: CMS Pages
  - name: CMS Sections
  - name: Digital Assets
  - name: Digital Links
  - name: Line Items
  - name: Menus
  - name: Menu Items
  - name: Option Types
  - name: Option Values
  - name: Orders
  - name: Payments
  - name: Payment Methods
  - name: Products
  - name: Promotions
  - name: Promotion Actions
  - name: Promotion Categories
  - name: Promotion Rules
  - name: Roles
  - name: Shipments
  - name: Shipping Categories
  - name: Shipping Methods
  - name: States
  - name: Stock Items
  - name: Stock Locations
  - name: Store Credit Categories
  - name: Store Credit Types
  - name: Store Credits
  - name: Tax Categories
  - name: Tax Rates
  - name: Taxons
  - name: Taxonomies
  - name: Users
  - name: Variants
  - name: Vendors
  - name: Webhook Events
  - name: Webhook Subscribers
  - name: Wishlists
  - name: Wished Items
  - name: Zones
paths:
  /api/v2/platform/line_items:
    post:
      tags:
        - Line Items
      summary: Create a Line Item
      description: Creates a Line Item
      operationId: create-line-item
      parameters:
        - name: include
          in: query
          description: >-
            Select which associated resources you would like to fetch, see: <a
            href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>
          example: order,tax_category,variant.product,digital_links
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_line_item_params'
      responses:
        '201':
          description: Record created
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    data:
                      id: '27'
                      type: line_item
                      attributes:
                        quantity: 1
                        price: '10.0'
                        created_at: '2022-11-08T19:34:20.312Z'
                        updated_at: '2022-11-08T19:34:20.352Z'
                        currency: USD
                        cost_price: '17.0'
                        adjustment_total: '0.0'
                        additional_tax_total: '0.0'
                        promo_total: '0.0'
                        included_tax_total: '0.0'
                        pre_tax_amount: '10.0'
                        taxable_adjustment_total: '0.0'
                        non_taxable_adjustment_total: '0.0'
                        public_metadata: {}
                        private_metadata: {}
                        display_discounted_amount: $10.00
                        display_amount: $10.00
                        display_final_amount: $10.00
                        display_subtotal: $10.00
                        display_pre_tax_amount: $10.00
                        display_price: $10.00
                        display_adjustment_total: $0.00
                        display_additional_tax_total: $0.00
                        display_promo_total: $0.00
                        display_total: $10.00
                        display_included_tax_total: $0.00
                      relationships:
                        order:
                          data:
                            id: '31'
                            type: order
                        tax_category:
                          data:
                            id: '72'
                            type: tax_category
                        variant:
                          data:
                            id: '187'
                            type: variant
                        adjustments:
                          data: []
                        inventory_units:
                          data: []
                        digital_links:
                          data: []
              schema:
                $ref: '#/components/schemas/resource'
        '422':
          description: Invalid request
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: >-
                      Variant can't be blank, Price is not a number, Currency
                      Must match order currency
                    errors:
                      variant:
                        - can't be blank
                      price:
                        - is not a number
                      currency:
                        - Must match order currency
              schema:
                $ref: '#/components/schemas/validation_errors'
      security:
        - bearer_auth: []
components:
  schemas:
    create_line_item_params:
      type: object
      properties:
        line_item:
          type: object
          required:
            - order_id
            - variant_id
            - quantity
          properties:
            order_id:
              type: string
              example: '1'
            variant_id:
              type: string
              example: '1'
            quantity:
              type: integer
              example: 2
            public_metadata:
              type: object
            private_metadata:
              type: object
      required:
        - line_item
      x-internal: false
    resource:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/resource_properties'
      required:
        - data
      x-internal: false
    validation_errors:
      type: object
      properties:
        error:
          type: string
        errors:
          type: object
      required:
        - error
        - errors
      x-internal: false
    resource_properties:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
        attributes:
          type: object
        relationships:
          type: object
      required:
        - id
        - type
        - attributes
      x-internal: false
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer

````