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

# Cancel purchase order

> Mark a purchase order as void (terminal Cancelled). Stops future matching but keeps existing allocations. Already-terminal orders are rejected.



## OpenAPI

````yaml /api-reference/openapi.json post /purchase-orders/{id}/cancel
openapi: 3.1.1
info:
  title: Dolfin API
  description: >-
    Dolfin API for AR & AP. Authenticate using the `x-dolfin-api-key` header
    with the API key distributed to your organisation.
  version: v1
servers:
  - url: https://api.dolfinai.co
    description: Production
security:
  - {}
tags:
  - name: Webhooks
  - name: Users
  - name: TaxRates
  - name: Suppliers
  - name: Supplier Credit Notes
  - name: Bills
  - name: SpendCategories
  - name: Payables
  - name: RecurringInvoices
  - name: Receivables
  - name: Purchase Orders
  - name: Products
  - name: Payments
  - name: Invoices
  - name: Organisations
  - name: Members
  - name: MCP
  - name: Matching
  - name: Invoice Reminders
  - name: Industries
  - name: Gmail
  - name: Delivery Notes
  - name: Customers
  - name: Currencies
  - name: Credit Notes
  - name: Clients
  - name: ClientInvites
  - name: BankPayments
  - name: Bank details
  - name: Auth
  - name: ApprovalPolicies
  - name: ApiKeys
  - name: Agent
paths:
  /purchase-orders/{id}/cancel:
    post:
      tags:
        - Purchase Orders
      summary: Cancel purchase order
      description: >-
        Mark a purchase order as void (terminal Cancelled). Stops future
        matching but keeps existing allocations. Already-terminal orders are
        rejected.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PurchaseOrderResponse'
        '403':
          description: >-
            Organisation.InsufficientRole — caller's organisation role is below
            the level this action requires
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: >-
            PurchaseOrder.NotFound — purchase order does not exist or belongs to
            another organisation
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '409':
          description: >-
            PurchaseOrder.AlreadyTerminal — the purchase order is already closed
            or cancelled and cannot change status
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  schemas:
    PurchaseOrderResponse:
      required:
        - poNumber
        - currency
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the purchase order.
          format: uuid
        organisationId:
          type: string
          description: The organisation that owns the purchase order.
          format: uuid
        supplierId:
          type:
            - 'null'
            - string
          description: The supplier the order is raised against, if assigned.
          format: uuid
        externalRef:
          type:
            - 'null'
            - string
          description: >-
            Caller's own reference for the order (a reverse pointer to the
            platform's record), if any.
        poNumber:
          type: string
          description: >-
            Human purchase-order number printed on the order. Required and
            unique within the organisation.
        currency:
          type: string
          description: ISO 4217 currency code of the order.
        status:
          $ref: '#/components/schemas/PurchaseOrderStatus'
          description: >-
            Lifecycle status: Draft, Open, PartiallyMatched, FullyMatched (all
            derived from matching), or the manual terminal states Closed /
            Cancelled.
        orderDate:
          type:
            - 'null'
            - string
          description: Date the order was raised, if recorded.
          format: date-time
        expectedDeliveryDate:
          type:
            - 'null'
            - string
          description: Expected delivery date, if recorded.
          format: date-time
        lines:
          type: array
          items:
            $ref: '#/components/schemas/PurchaseOrderLineResponse'
          description: The ordered lines, in display order.
        createdAt:
          type: string
          description: When the purchase order was created.
          format: date-time
        updatedAt:
          type: string
          description: When the purchase order was last updated.
          format: date-time
      description: A purchase order and its ordered lines.
    ProblemDetails:
      type: object
      properties:
        type:
          type:
            - 'null'
            - string
        title:
          type:
            - 'null'
            - string
        status:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          format: int32
        detail:
          type:
            - 'null'
            - string
        instance:
          type:
            - 'null'
            - string
    PurchaseOrderStatus:
      enum:
        - Draft
        - Open
        - PartiallyMatched
        - FullyMatched
        - Closed
        - Cancelled
      description: >-
        Lifecycle status of a purchase order. Draft, Open, PartiallyMatched and
        FullyMatched are derived from matching (and reverse as allocations
        change); Closed and Cancelled are manual terminal states a human sets.
    PurchaseOrderLineResponse:
      required:
        - description
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the line.
          format: uuid
        description:
          type: string
          description: Line description.
        sku:
          type:
            - 'null'
            - string
          description: >-
            Product SKU, used as the exact-match key against bill lines.
            Optional.
        quantityOrdered:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: Quantity ordered on this line.
          format: double
        unit:
          type:
            - 'null'
            - string
          description: Unit of measure (e.g. each, kg), if recorded.
        unitPrice:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: Ordered unit price (ex-tax).
          format: double
        taxRate:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: Tax rate applied to the line, as a percentage.
          format: double
        taxAmount:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: Tax amount for the line.
          format: double
        subTotal:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: Net (ex-tax) line total.
          format: double
        sortOrder:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - integer
            - string
          description: Display order of the line within the order.
          format: int32
        matchedQuantity:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Total quantity matched against this line across all bills. Null on
            list responses (not computed there); populated on the detail
            (get-by-id) response.
          format: double
        fullyMatched:
          type:
            - 'null'
            - boolean
          description: >-
            True once the matched quantity covers the whole ordered quantity.
            Null when MatchedQuantity is not computed (list responses) — null
            means 'unknown', not 'unmatched'.
      description: A single ordered line on a purchase order.

````