> ## Documentation Index
> Fetch the complete documentation index at: https://developers.loyaltylion.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Order

Add a new order to LoyaltyLion. This may trigger rules and award points to a
customer. Merchants using a supported platform such as Shopify should usually
*not* use this endpoint, as LoyaltyLion will retrieve orders from the platform
via webhooks instead.


## OpenAPI

````yaml /api-reference/v2/openapi.json POST /v2/orders
openapi: 3.1.1
info:
  title: LoyaltyLion Admin API
  version: v2
servers:
  - url: https://api.loyaltylion.com
security: []
tags:
  - name: identity
  - name: activities
  - name: orders
  - name: transactions
  - name: customers
  - name: webhooks
  - name: emails
  - name: sites
  - name: reviews
  - name: rewards
  - name: integrations
  - name: gatsby
paths:
  /v2/orders:
    post:
      tags:
        - orders
      operationId: orders.createOrder
      parameters:
        - name: site_id
          in: query
          description: >-
            Create the order in the specified site. This is only required for
            programs that have multiple sites. Programs with only a single site
            can omit this parameter, and the order will be created in the
            program's only site
          schema:
            type: number
      requestBody:
        description: Body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrdersCreateOrderRequestBody'
      responses:
        '201':
          description: '201'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrdersCreateOrderResponseBody'
        '400':
          $ref: '#/components/responses/ClientErrorBadRequest'
        '401':
          description: '401'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties:
                          type: string
                    required:
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '403':
          description: '403'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties:
                          type: string
                    required:
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
      security:
        - ProgramApiKey:
            - write_orders
        - SiteTokenSecret: []
components:
  schemas:
    OrdersCreateOrderRequestBody:
      required:
        - customer_id
      type: object
      properties:
        customer_id:
          type: string
          description: >-
            The ID of the customer in your platform or ecommerce store who
            placed the order
        customer_email:
          description: The email address of the customer who placed the order
          type: string
        merchant_id:
          type:
            - string
            - number
          description: The ID of the order in your platform or ecommerce store
        total:
          type:
            - string
            - number
          description: >-
            The total amount of order as a decimal string without formatting,
            e.g. `99.99`
        total_shipping:
          type:
            - string
            - number
          description: >-
            The total shipping amount for the order as a decimal string without
            formatting, e.g. `3.49`
        total_paid:
          type: string
          description: >-
            The total amount paid for the order as a decimal string without
            formatting, e.g. `9.99`
        payment_status:
          type: string
          enum:
            - not_paid
            - partially_paid
            - paid
        merchant_number:
          type: string
          description: A optional order number to identify this order in your system
        number:
          type:
            - - string
              - number
            - 'null'
        discount_codes:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                description: >-
                  The discount code as entered by the customer, for example,
                  `AU7X-8Q7L`
              amount:
                type: string
                description: >-
                  The amount of the discount as a decimal string without
                  currency formatting, e.g. 19.99
            required:
              - code
              - amount
          anyOf:
            - anyOf:
                - type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          code:
                            type:
                              - string
                              - 'null'
                          amount:
                            type:
                              - - string
                                - number
                              - 'null'
                        additionalProperties: false
                      - type: string
                - type: object
                  properties:
                    code:
                      type:
                        - string
                        - 'null'
                    amount:
                      type:
                        - - string
                          - number
                        - 'null'
                  additionalProperties: false
            - type: 'null'
        claimed_reward_ids:
          type: array
          items:
            type: number
          description: >-
            A list of LoyaltyLion claimed reward IDs that were used with this
            order
          anyOf:
            - type: array
              items:
                type: number
            - type: 'null'
        date:
          type: string
          description: >-
            An `ISO 8601` timestamp representing the date of the order. Defaults
            to now if not provided
        ip_address:
          type: string
          description: >-
            The IP address of the customer who placed the order. Used to track
            referrals
        user_agent:
          type: string
          description: >-
            The user agent of the customer who placed the order. Used to track
            referrals
        referral_id:
          type: string
          description: A LoyaltyLion referral ID, used to link this order to a referral
        tracking_id:
          type: string
          description: >-
            A LoyaltyLion tracking ID, used to link this order to a tracking
            source
        guest:
          type: boolean
          description: Whether this order was placed by a guest customer
          anyOf:
            - type: boolean
            - type: string
              const: '1'
            - type: string
              const: '0'
            - type: 'null'
      additionalProperties: false
    OrdersCreateOrderResponseBody:
      type: string
      const: ''
  responses:
    ClientErrorBadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  message:
                    type: string
                  details:
                    type: object
                    additionalProperties:
                      type: string
                required:
                  - message
            required:
              - error
  securitySchemes:
    ProgramApiKey:
      type: http
      scheme: bearer
      description: >-
        An API key linked to a Program in LoyaltyLion, with a set of permissions
        (scopes). API keys can be created manually, or acquired through an
        OAuth2 flow. The API key should be provided as a `Bearer` token in the
        `Authorization` header
    SiteTokenSecret:
      type: http
      scheme: basic
      description: >-
        [DEPRECATED] Authenticate using a LoyaltyLion site's `token` as
        username, and its `secret` as the password. This authentication method
        is deprecated and will be removed in future. Use the `ProgramApiKey`
        authentication method instead

````