Swell Orders API

Customer orders, line items, financial totals, and lifecycle.

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

swell-io-orders-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Swell Backend Account Addresses Orders API
  version: 2025-01
  description: 'Swell Backend API — the server-side REST surface for managing every resource in a Swell commerce store: products, variants, carts, orders, payments, refunds, shipments, returns, subscriptions, accounts (customers), invoices, coupons, promotions, gift cards, content, files, data models, events, and webhooks. Authenticated with a store ID and secret key. The official Node and PHP libraries connect over a custom wire protocol on port 8443 for improved performance; HTTPS REST is available at https://api.swell.store.'
  contact:
    name: Swell Developer Support
    url: https://developers.swell.is
    email: support@swell.is
  license:
    name: API Profile — API Evangelist
    url: https://apievangelist.com
servers:
- url: https://api.swell.store
  description: Production Backend API
security:
- SwellStoreId: []
  SwellSecretKey: []
tags:
- name: Orders
  description: Customer orders, line items, financial totals, and lifecycle.
paths:
  /orders:
    get:
      tags:
      - Orders
      summary: List Orders
      operationId: listOrders
      parameters:
      - $ref: '#/components/parameters/Limit'
      - $ref: '#/components/parameters/Page'
      - $ref: '#/components/parameters/Where'
      - $ref: '#/components/parameters/Sort'
      - $ref: '#/components/parameters/Expand'
      responses:
        '200':
          description: A page of orders.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderList'
    post:
      tags:
      - Orders
      summary: Create Order
      operationId: createOrder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderCreate'
      responses:
        '201':
          description: Order created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
  /orders/{id}:
    parameters:
    - $ref: '#/components/parameters/PathId'
    get:
      tags:
      - Orders
      summary: Retrieve Order
      operationId: getOrder
      responses:
        '200':
          description: Order.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
    patch:
      tags:
      - Orders
      summary: Update Order
      operationId: updateOrder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderUpdate'
      responses:
        '200':
          description: Updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
    delete:
      tags:
      - Orders
      summary: Delete Order
      operationId: deleteOrder
      responses:
        '200':
          description: Deleted.
  /api/account/orders:
    get:
      tags:
      - Orders
      summary: List Account Orders
      operationId: frontendListAccountOrders
      responses:
        '200':
          description: Customer order history.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderList'
  /api/account/orders/{id}:
    parameters:
    - name: id
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Orders
      summary: Retrieve Account Order
      operationId: frontendGetAccountOrder
      responses:
        '200':
          description: Order.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order_2'
components:
  parameters:
    Sort:
      name: sort
      in: query
      description: Sort expression, e.g. "name asc" or "date_created desc".
      schema:
        type: string
    Expand:
      name: expand
      in: query
      description: Include related objects, e.g. expand=account or expand=variants:10.
      schema:
        type: string
    Where:
      name: where
      in: query
      description: MongoDB-style filter object. Supports operators $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $regex, $type, $exists, $and, $or, $nor, $all, $elemMatch, $size.
      schema:
        type: object
    Limit:
      name: limit
      in: query
      description: Records per page (1-1000). Default 15.
      schema:
        type: integer
        minimum: 1
        maximum: 1000
        default: 15
    PathId:
      name: id
      in: path
      required: true
      description: The object ID of the resource.
      schema:
        type: string
        pattern: ^[a-f0-9]{24}$
    Page:
      name: page
      in: query
      description: Result page number, 1-indexed.
      schema:
        type: integer
        minimum: 1
        default: 1
  schemas:
    OrderUpdate:
      $ref: '#/components/schemas/Order'
    Money_2:
      type: number
      format: float
    Order:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/ObjectId'
        number:
          type: string
        account_id:
          $ref: '#/components/schemas/ObjectId'
        status:
          type: string
          enum:
          - pending
          - draft
          - payment_pending
          - delivery_pending
          - hold
          - complete
          - canceled
        items:
          type: array
          items:
            type: object
        billing:
          type: object
        shipping:
          type: object
        sub_total:
          $ref: '#/components/schemas/Money'
        discount_total:
          $ref: '#/components/schemas/Money'
        tax_total:
          $ref: '#/components/schemas/Money'
        shipment_total:
          $ref: '#/components/schemas/Money'
        grand_total:
          $ref: '#/components/schemas/Money'
        payment_balance:
          $ref: '#/components/schemas/Money'
        paid:
          type: boolean
        delivered:
          type: boolean
        refunded:
          type: boolean
        canceled:
          type: boolean
        coupon_code:
          type: string
        giftcards:
          type: array
          items:
            type: object
        comments:
          type: string
        metadata:
          type: object
        test:
          type: boolean
        currency:
          type: string
        date_created:
          type: string
          format: date-time
        date_updated:
          type: string
          format: date-time
    ObjectId:
      type: string
      pattern: ^[a-f0-9]{24}$
    OrderList:
      type: object
      properties:
        count:
          type: integer
        page:
          type: integer
        results:
          type: array
          items:
            $ref: '#/components/schemas/Order'
    Money:
      type: number
      format: float
      description: Currency amount expressed in store currency.
    OrderCreate:
      $ref: '#/components/schemas/Order'
    Order_2:
      type: object
      properties:
        id:
          type: string
        number:
          type: string
        status:
          type: string
        items:
          type: array
          items:
            type: object
        grand_total:
          $ref: '#/components/schemas/Money_2'
        paid:
          type: boolean
        delivered:
          type: boolean
        date_created:
          type: string
          format: date-time
  securitySchemes:
    SwellStoreId:
      type: apiKey
      in: header
      name: X-Store-Id
      description: Your Swell store ID, found in the Developer section of the dashboard.
    SwellSecretKey:
      type: apiKey
      in: header
      name: Authorization
      description: 'Secret API key prefixed with `sk_`. Sent as `Authorization: Basic <base64(store-id:secret-key)>` or equivalent custom header by official libraries.'