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

# Create orders

> Create new order and add order content. Status for new orders will always be set to **unpaid**



## OpenAPI

````yaml post /v1/orders
openapi: 3.1.0
info:
  title: Quickbutik API
  version: 1.0.0
  description: >-
    Use the Quickbutik API to access and manage stores, products, orders, and
    more.
  contact:
    name: Quickbutik API Support
    url: https://quickbutik.com/support
  license:
    name: Proprietary
  x-fiddle-import-file: true
servers:
  - url: https://api.quickbutik.com
    description: Production server
security:
  - BasicAuth: []
tags:
  - name: Orders
    description: Order management operations
  - name: Products
    description: Product catalog management
  - name: Categories
    description: Product category management
  - name: Payment Methods
    description: Available payment methods
  - name: Shipping Methods
    description: Available shipping methods
  - name: Metadata
    description: Custom metadata management
  - name: Settings
    description: Store settings and configuration
  - name: Scripts
    description: Storefront script management
paths:
  /v1/orders:
    post:
      tags:
        - Orders
      summary: Create orders
      description: >-
        Create new order and add order content. Status for new orders will
        always be set to **unpaid**
      operationId: create-orders
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/OrderCreate'
      responses:
        '200':
          $ref: '#/components/responses/OrderCreateSuccess'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    OrderCreate:
      type: object
      required:
        - order_id
        - customer
        - payment
        - products
      properties:
        order_id:
          type: string
          example: create
          description: Must be the value **create** to create a new order.
        customer:
          type: object
          description: Customer details for the new order.
          properties:
            type:
              type: string
              enum:
                - consumer
                - business
              example: consumer
              description: Customer type
            email:
              type: string
              format: email
              example: customer@example.com
              description: Customer email address
            phone:
              type: string
              example: '+46701234567'
              description: Customer phone number
            login_create:
              type: boolean
              example: false
              description: Create customer account
            billing_details:
              $ref: '#/components/schemas/AddressDetails'
            shipping_details:
              allOf:
                - $ref: '#/components/schemas/AddressDetails'
                - type: object
                  properties:
                    company_name:
                      type: string
                      description: Required if customer.type is business
            newsletter_subscribe:
              type: boolean
              example: true
              description: Subscribe customer to newsletter
            note:
              type: string
              description: Customer note
        payment:
          type: object
          description: Payment information for the new order.
          properties:
            method:
              type: string
              example: MySaleChannel
              description: Payment method identifier
            transaction_id:
              type: string
              example: TX-2024-0001
              description: Order reference from the payment method
            currency:
              type: string
              enum:
                - SEK
                - DKK
                - EUR
                - GBP
                - NOK
                - USD
                - PLN
                - CZK
                - CAD
              example: SEK
              description: Order currency
            log:
              type: string
              description: Additional payment information
        shipping:
          type: object
          description: Shipping method for the new order.
          properties:
            id:
              type: integer
              example: 1
              description: Shipping method ID
            name:
              type: string
              example: Postnord Parcel
              description: >-
                Shipping method name (optional, falls back to the method's
                title)
            price:
              type: number
              example: 49
              description: Shipping cost (optional, falls back to the method's price)
        products:
          type: array
          description: Products to add to the order. Required when creating an order.
          items:
            type: object
            properties:
              product_id:
                type: integer
                description: Product ID
              variant_id:
                type: integer
                description: Product variant ID
              sku:
                type: string
                description: Product SKU
              qty:
                type: integer
                minimum: 1
                default: 1
                description: Product quantity
              price:
                type: number
                description: Custom price for this order item (overrides the catalog price)
        discount_add:
          $ref: '#/components/schemas/OrderDiscountAdd'
        metadata:
          type: object
          additionalProperties:
            type: string
          description: Custom metadata for the order
      example:
        - order_id: create
          customer:
            type: consumer
            email: customer@example.com
            phone: '+46701234567'
            login_create: false
            newsletter_subscribe: true
            note: Leave at the front door
            billing_details:
              firstname: Kalle
              lastname: Ankasson
              address: Gladagatan 10
              address2: ''
              city: Ankeborg
              zipcode: '12345'
              country: SE
            shipping_details:
              firstname: Kalle
              lastname: Ankasson
              address: Gladagatan 10
              address2: ''
              city: Ankeborg
              zipcode: '12345'
              country: SE
              company_name: ''
          payment:
            method: MySaleChannel
            transaction_id: TX-2024-0001
            currency: SEK
            log: Paid via external sales channel
          shipping:
            id: 1
            name: Postnord Parcel
            price: 49
          products:
            - product_id: 12345
              variant_id: 67890
              sku: SHIRT-123
              qty: 2
              price: 199
          discount_add:
            amount: 50
          metadata:
            external_ref: ERP-55213
    AddressDetails:
      type: object
      properties:
        company_name:
          type: string
          example: Bolaget AB
        firstname:
          type: string
          example: Kalle
        lastname:
          type: string
          example: Ankasson
        address:
          type: string
          example: Gladagatan 10
        address2:
          type: string
        city:
          type: string
          example: Ankeborg
        zipcode:
          type: string
          example: '12345'
        country:
          type: string
          example: SE
          description: Two-letter country code (ISO 3166-1 alpha-2 format)
    OrderDiscountAdd:
      type: object
      description: Optional. Set only if you would like to add a discount for this order
      properties:
        amount:
          type: number
          description: Optional. Enter discount value
    Error:
      type: object
      properties:
        code:
          type: integer
          example: 404
        error:
          type: string
          example: Resource not found
  responses:
    OrderCreateSuccess:
      description: Order created successfully
      content:
        application/json:
          schema:
            type: object
            properties:
              results:
                type: object
                description: >-
                  Results object containing response for each order creation
                  attempt. Keys are dynamically generated as create_1, create_2,
                  etc.
                additionalProperties:
                  type: object
                  properties:
                    success:
                      type: integer
                      example: 1
                      description: >-
                        Indicates if order was created successfully (1 =
                        success, 0 = failure)
                    new_order_id:
                      type: integer
                      example: 10462
                      description: The ID of the newly created order
                    checkout_url:
                      type: string
                      example: https://example.quickbutik.com/checkout/order/abc123
                      description: URL to the checkout page for the order
                    variants:
                      type: array
                      items:
                        type: object
                      description: Created product variants (optional)
                    notices:
                      type: array
                      items:
                        type: string
                      description: Optional warning or error messages
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized - Invalid or missing authentication
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: >
        **Basic Authentication with API Keys**


        The Quickbutik API uses Basic Authentication where you use your API key
        as both the username and password.


        **How it works:**

        1. Format your credentials as `api_key:api_key` (using the SAME API key
        for both username and password)

        2. Base64 encode the formatted string

        3. Include in the Authorization header as: `Authorization: Basic
        ENCODED_STRING`


        **Example:**

        - API Key: `sk_live_abc123`

        - Formatted: `sk_live_abc123:sk_live_abc123`

        - Base64 Encoded: `c2tfbGl2ZV9hYmMxMjM6c2tfbGl2ZV9hYmMxMjM=`

        - Header: `Authorization: Basic
        c2tfbGl2ZV9hYmMxMjM6c2tfbGl2ZV9hYmMxMjM=`


        **cURL Example:**

        ```bash

        curl https://api.quickbutik.com/v1/orders -u your_api_key:your_api_key

        ```


        All API requests must be made over HTTPS. Requests made over HTTP will
        be rejected.


        API keys can be generated in the Quickbutik Control Panel under Settings
        → API.

````