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

# Purchase Order - Create

> August 2023: Now supports item_id, kit_id, sku (SKULabs Kit or Item), mpn (Supplier MPN), or barcode (SKULabs Kit or Item barcode) as lookup fields in the item array.



## OpenAPI

````yaml post /purchase_order/create
openapi: 3.0.3
info:
  title: SKULabs API
  description: >-
    Most API keys have "platformGeneric" and "platformApi" scopes included.
    Contact us to convert more routes from "platformUser" (only available to
    users) to "platformGeneric" (available to users and api keys) upon request.
  version: 4.5.0
servers:
  - url: https://api.skulabs.com
  - url: https://app.skulabs.com/s
security: []
tags:
  - name: batch
  - name: customer
    description: Manage customers, tags, and notes
  - name: cycle_count
  - name: distributor
  - name: inventory
    description: Query and modify inventory levels across locations
  - name: inventory_table
  - name: item
    description: Manage items, barcodes, serial numbers, and tags
  - name: kit
    description: Manage kits and their component items
  - name: listing
  - name: location
  - name: oauth
  - name: order
    description: Manage orders, shipments, tags, and statuses
  - name: purchase_order
    description: Manage purchase orders and receiving
  - name: run
  - name: shipments
  - name: shipping
  - name: store
  - name: tag
    description: Create, update, and remove tags
  - name: transfer_order
  - name: warehouse
    description: Manage warehouses and view statistics
  - name: webhook
    description: Manage webhook handlers
paths:
  /purchase_order/create:
    post:
      tags:
        - purchase_order
      summary: Purchase Order - Create
      description: >-
        August 2023: Now supports item_id, kit_id, sku (SKULabs Kit or Item),
        mpn (Supplier MPN), or barcode (SKULabs Kit or Item barcode) as lookup
        fields in the item array.
      operationId: post_purchase_order_create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                number:
                  type: string
                  description: PO number
                store_id:
                  type: string
                  description: Store ID
                  example: 507f1f77bcf86cd799439011
                distributor_id:
                  type: string
                  description: Distributor ID
                warehouse_id:
                  type: string
                  description: Warehouse ID
                items:
                  type: array
                  items:
                    $ref: '#/components/schemas/PurchaseOrderItem'
                  description: Line items
                subtotal:
                  type: number
                  description: Subtotal
                tax:
                  type: number
                  description: Tax amount
                tax_per:
                  type: number
                  description: Tax percentage
                total:
                  type: number
                  description: Total
                memo:
                  type: string
                  description: Memo
                terms:
                  type: string
                  description: Payment terms
                shipping:
                  type: number
                  description: Shipping cost
                method:
                  type: string
                  description: Payment method
                discount:
                  type: number
                  description: Discount amount
                discount_per:
                  type: number
                  description: Discount percentage
                dropship_address:
                  type: object
                  properties: {}
                  description: Dropship address
                status:
                  type: string
                  enum:
                    - closed
                    - created
                    - receiving
                    - acknowledged
                    - sent
                    - edited
                    - transit
                    - accepting
                  description: Initial PO status
                due_date:
                  type: string
                  format: date
                  description: Due date
                  example: '2025-01-15'
                dropshipped:
                  type: boolean
                  description: Dropshipped flag
              required:
                - number
      responses:
        '200':
          description: Purchase order created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the operation succeeded
                  _id:
                    type: string
                    description: ID of the created purchase order
                    example: 507f1f77bcf86cd799439011
                  number:
                    anyOf:
                      - type: string
                      - type: number
                    description: PO number (may be auto-generated)
                  errors:
                    type: array
                    items:
                      type: string
                    description: Array of validation error messages
                  add_results:
                    type: array
                    items:
                      nullable: true
                    description: >-
                      Results from auto-adding serial numbers (pallet
                      processing)
                  skulabs_warning:
                    type: object
                    properties: {}
                    description: Non-fatal warning from background operations
                required:
                  - success
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: Detailed error message
                      code:
                        type: string
                        description: Machine-readable error code
                      overview:
                        type: string
                        description: Short human-friendly description
                      statusCode:
                        type: number
                        description: HTTP status code
                      origin:
                        type: string
                        description: Error source
                      skulabsTraceId:
                        type: string
                        description: Trace ID for support
                      type:
                        type: string
                        enum:
                          - error
                          - notice
                          - success
                        description: Error severity for UI handling
                      user_error:
                        type: boolean
                        description: Whether the error was caused by user input
                      display:
                        type: string
                        enum:
                          - notification
                          - panel
                        description: Suggested UI display mode for the error
                    required:
                      - message
                      - statusCode
                required:
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: Detailed error message
                      code:
                        type: string
                        description: Machine-readable error code
                      overview:
                        type: string
                        description: Short human-friendly description
                      statusCode:
                        type: number
                        description: HTTP status code
                      origin:
                        type: string
                        description: Error source
                      skulabsTraceId:
                        type: string
                        description: Trace ID for support
                      type:
                        type: string
                        enum:
                          - error
                          - notice
                          - success
                        description: Error severity for UI handling
                      user_error:
                        type: boolean
                        description: Whether the error was caused by user input
                      display:
                        type: string
                        enum:
                          - notification
                          - panel
                        description: Suggested UI display mode for the error
                    required:
                      - message
                      - statusCode
                required:
                  - error
        '403':
          description: Forbidden. Insufficient permissions.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: Detailed error message
                      code:
                        type: string
                        description: Machine-readable error code
                      overview:
                        type: string
                        description: Short human-friendly description
                      statusCode:
                        type: number
                        description: HTTP status code
                      origin:
                        type: string
                        description: Error source
                      skulabsTraceId:
                        type: string
                        description: Trace ID for support
                      type:
                        type: string
                        enum:
                          - error
                          - notice
                          - success
                        description: Error severity for UI handling
                      user_error:
                        type: boolean
                        description: Whether the error was caused by user input
                      display:
                        type: string
                        enum:
                          - notification
                          - panel
                        description: Suggested UI display mode for the error
                    required:
                      - message
                      - statusCode
                required:
                  - error
        '429':
          description: Too many requests. Rate limit exceeded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: Detailed error message
                      code:
                        type: string
                        description: Machine-readable error code
                      overview:
                        type: string
                        description: Short human-friendly description
                      statusCode:
                        type: number
                        description: HTTP status code
                      origin:
                        type: string
                        description: Error source
                      skulabsTraceId:
                        type: string
                        description: Trace ID for support
                      type:
                        type: string
                        enum:
                          - error
                          - notice
                          - success
                        description: Error severity for UI handling
                      user_error:
                        type: boolean
                        description: Whether the error was caused by user input
                      display:
                        type: string
                        enum:
                          - notification
                          - panel
                        description: Suggested UI display mode for the error
                    required:
                      - message
                      - statusCode
                required:
                  - error
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: Detailed error message
                      code:
                        type: string
                        description: Machine-readable error code
                      overview:
                        type: string
                        description: Short human-friendly description
                      statusCode:
                        type: number
                        description: HTTP status code
                      origin:
                        type: string
                        description: Error source
                      skulabsTraceId:
                        type: string
                        description: Trace ID for support
                      type:
                        type: string
                        enum:
                          - error
                          - notice
                          - success
                        description: Error severity for UI handling
                      user_error:
                        type: boolean
                        description: Whether the error was caused by user input
                      display:
                        type: string
                        enum:
                          - notification
                          - panel
                        description: Suggested UI display mode for the error
                    required:
                      - message
                      - statusCode
                required:
                  - error
      security:
        - SKULabsToken: []
      servers:
        - url: https://api.skulabs.com
components:
  schemas:
    PurchaseOrderItem:
      type: object
      properties:
        item_id:
          type: string
          description: Item ID
        kit_id:
          type: string
          description: Kit ID (when the PO line is a kit)
        sku:
          type: string
          description: Item SKU
        name:
          type: string
          description: Item name
        quantity:
          type: number
          description: Ordered quantity
        received:
          type: number
          description: Received quantity
        cost:
          type: number
          description: Unit cost
        rate:
          type: number
          description: Unit rate
        type:
          type: string
          enum:
            - item
            - kit
          description: Line item type
        serial_numbers:
          type: array
          items:
            type: string
          description: Serial/lot numbers received
        description:
          type: string
          description: Item description/notes
        unit:
          type: string
          description: Unit of measure
  securitySchemes:
    SKULabsToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````