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

# Create a purchase order

> This endpoint is available to Group API Keys only.

Creates a new purchase order in draft status with the specified line items. The quantities specified in the line items are expected to be in the same unit of measure as the configured unit of measure for the inventory code.

A **purchase order** tracks an order placed by a clinic to a supplier for inventory items. Each purchase order contains one or more line items identifying the inventory being ordered, the quantity, and the price. Purchase orders are created in draft status and can later be finalized in the pims web ui.



## OpenAPI

````yaml post /ext/v2/purchase-orders/
openapi: 3.1.0
info:
  description: ''
  title: NinjaAPI
  version: 2.0.0
servers:
  - url: https://connect.vetcove.com/
security: []
paths:
  /ext/v2/purchase-orders/:
    post:
      tags:
        - Inventory
      summary: Create a purchase order
      description: >-
        This endpoint is available to Group API Keys only.


        Creates a new purchase order in draft status with the specified line
        items. The quantities specified in the line items are expected to be in
        the same unit of measure as the configured unit of measure for the
        inventory code.


        A **purchase order** tracks an order placed by a clinic to a supplier
        for inventory items. Each purchase order contains one or more line items
        identifying the inventory being ordered, the quantity, and the price.
        Purchase orders are created in draft status and can later be finalized
        in the pims web ui.
      operationId: purchase_order_create
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PurchaseOrderCreateSchema'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalPurchaseOrderSchema'
          description: Created
      security:
        - ExternalAPIAuth: []
components:
  schemas:
    PurchaseOrderCreateSchema:
      properties:
        clinic_id:
          description: The ID of the clinic this purchase order belongs to
          title: Clinic Id
          type: integer
        order_datetime:
          description: The datetime when the order was placed
          format: date-time
          title: Order Datetime
          type: string
        po_number:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            An optional purchase order number. If omitted, one is
            auto-generated.
          title: Po Number
        purchase_order_items:
          description: The line items to include in the purchase order
          items:
            $ref: '#/components/schemas/PurchaseOrderItemCreateSchema'
          minItems: 1
          title: Purchase Order Items
          type: array
        supplier:
          description: The name of the supplier for this order
          title: Supplier
          type: string
      required:
        - clinic_id
        - order_datetime
        - supplier
        - purchase_order_items
      title: PurchaseOrderCreateSchema
      type: object
    ExternalPurchaseOrderSchema:
      properties:
        clinic_id:
          description: The ID of the clinic this purchase order belongs to
          title: Clinic Id
          type: integer
        created:
          description: The datetime this object was created.
          format: date-time
          title: Created
          type: string
        effective_total:
          description: The effective total of the order, in cents
          title: Effective Total
          type: integer
        id:
          description: The unique identifier for the purchase order
          title: Id
          type: integer
        modified:
          description: >-
            The datetime this object was last modified; changes to related
            entities will not update this field.
          format: date-time
          title: Modified
          type: string
        order_datetime:
          description: The datetime when the order was placed
          format: date-time
          title: Order Datetime
          type: string
        po_number:
          description: The purchase order number
          title: Po Number
          type: string
        purchase_order_items:
          description: The line items included in this purchase order
          items:
            $ref: '#/components/schemas/ExternalPurchaseOrderItemSchema'
          title: Purchase Order Items
          type: array
        raw_total:
          description: The raw total of the order, in cents
          title: Raw Total
          type: integer
        status:
          $ref: '#/components/schemas/PurchaseOrderStatus'
          description: The current status of the purchase order
        supplier:
          description: The name of the supplier for this order
          title: Supplier
          type: string
      required:
        - created
        - modified
        - id
        - clinic_id
        - order_datetime
        - po_number
        - supplier
        - status
        - raw_total
        - effective_total
        - purchase_order_items
      title: ExternalPurchaseOrderSchema
      type: object
    PurchaseOrderItemCreateSchema:
      properties:
        inventory_id:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          description: >-
            The inventory id identifying the item to order. Must provide exactly
            one of inventory_shortcode or inventory_id, not both
          title: Inventory Id
        inventory_shortcode:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The inventory shortcode (human-readable code) identifying the item
            to order. Must provide exactly one of inventory_shortcode or
            inventory_id, not both. Inventory shortcodes are deprecated for new
            integrations; supported during a deprecation window for existing
            callers.
          title: Inventory Shortcode
        quantity:
          anyOf:
            - exclusiveMinimum: 0
              type: number
            - type: string
          description: The quantity to order (must be greater than 0)
          title: Quantity
        sku:
          default: ''
          description: An optional SKU identifier for this item
          title: Sku
          type: string
        total_price:
          default: 0
          description: The total price for this line item, in cents
          minimum: 0
          title: Total Price
          type: integer
      required:
        - quantity
      title: PurchaseOrderItemCreateSchema
      type: object
    ExternalPurchaseOrderItemSchema:
      properties:
        created:
          description: The datetime this object was created.
          format: date-time
          title: Created
          type: string
        id:
          description: The unique identifier for the purchase order item
          title: Id
          type: integer
        inventory_id:
          anyOf:
            - type: integer
            - type: 'null'
          description: The inventory id for this item
          title: Inventory Id
        inventory_shortcode:
          default: ''
          description: The inventory shortcode (human-readable code) for this item
          title: Inventory Shortcode
          type: string
        modified:
          description: >-
            The datetime this object was last modified; changes to related
            entities will not update this field.
          format: date-time
          title: Modified
          type: string
        quantity:
          anyOf:
            - type: number
            - type: string
          description: The quantity ordered
          title: Quantity
        sku:
          description: The SKU identifier for this item
          title: Sku
          type: string
        total_price:
          description: The total price for this line item, in cents
          title: Total Price
          type: integer
        unit_of_measure:
          description: The unit of measure for this item
          title: Unit Of Measure
          type: string
      required:
        - created
        - modified
        - id
        - inventory_id
        - sku
        - quantity
        - total_price
        - unit_of_measure
      title: ExternalPurchaseOrderItemSchema
      type: object
    PurchaseOrderStatus:
      enum:
        - DRAFT
        - PENDING
        - PARTIALLY_RECEIVED
        - FULLY_RECEIVED
        - CANCELED
        - RETURNED
        - CLOSED
      title: PurchaseOrderStatus
      type: string
  securitySchemes:
    ExternalAPIAuth:
      scheme: bearer
      type: http

````