Microsoft Dynamics NAV Purchase Orders API

Manage purchase orders and lines

Documentation

Specifications

Other Resources

OpenAPI Specification

navision-purchase-orders-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Business Central Administration Center Accounts Purchase Orders API
  description: REST API for programmatic administration of Dynamics 365 Business Central environments. Enables querying and managing production and sandbox environments, setting up administrative notifications, viewing tenant telemetry, managing apps, scheduling updates, and performing environment operations such as copy, rename, restore, and delete.
  version: '2.28'
  contact:
    name: Microsoft Dynamics Support
    email: bcsupport@microsoft.com
    url: https://dynamics.microsoft.com/support/
  license:
    name: Microsoft APIs Terms of Use
    url: https://learn.microsoft.com/en-us/legal/microsoft-apis/terms-of-use
  termsOfService: https://learn.microsoft.com/en-us/legal/microsoft-apis/terms-of-use
servers:
- url: https://api.businesscentral.dynamics.com/admin/v2.28
  description: Business Central Administration Center
security:
- oauth2: []
- bearerAuth: []
tags:
- name: Purchase Orders
  description: Manage purchase orders and lines
paths:
  /companies({company_id})/purchaseOrders:
    get:
      summary: List Purchase Orders
      description: Returns a list of purchase order objects from the specified company.
      operationId: listPurchaseOrders
      tags:
      - Purchase Orders
      parameters:
      - $ref: '#/components/parameters/company_id'
      - $ref: '#/components/parameters/top'
      - $ref: '#/components/parameters/skip'
      - $ref: '#/components/parameters/filter'
      - $ref: '#/components/parameters/orderby'
      - $ref: '#/components/parameters/select'
      - $ref: '#/components/parameters/expand'
      responses:
        '200':
          description: Successfully retrieved purchase orders
          content:
            application/json:
              schema:
                type: object
                properties:
                  value:
                    type: array
                    items:
                      $ref: '#/components/schemas/PurchaseOrder'
              examples:
                Listpurchaseorders200Example:
                  summary: Default listPurchaseOrders 200 response
                  x-microcks-default: true
                  value:
                    value:
                    - '@odata.etag': example_value
                      id: abc123
                      number: example_value
                      orderDate: '2026-01-15'
                      postingDate: '2026-01-15'
                      vendorId: '500123'
                      vendorNumber: example_value
                      vendorName: example_value
                      payToName: example_value
                      payToVendorId: '500123'
                      payToVendorNumber: example_value
                      shipToName: example_value
                      shipToContact: example_value
                      buyFromAddressLine1: example_value
                      buyFromAddressLine2: example_value
                      buyFromCity: example_value
                      buyFromCountry: example_value
                      buyFromState: example_value
                      buyFromPostCode: example_value
                      currencyId: '500123'
                      currencyCode: example_value
                      pricesIncludeTax: true
                      paymentTermsId: '500123'
                      shipmentMethodId: '500123'
                      purchaser: example_value
                      requestedReceiptDate: '2026-01-15'
                      discountAmount: 42.5
                      discountAppliedBeforeTax: true
                      totalAmountExcludingTax: 42.5
                      totalTaxAmount: 42.5
                      totalAmountIncludingTax: 42.5
                      fullyReceived: true
                      status: Draft
                      lastModifiedDateTime: '2026-01-15T10:30:00Z'
                      purchaseOrderLines:
                      - {}
        '401':
          $ref: '#/components/responses/Unauthorized'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      summary: Create a Purchase Order
      description: Creates a new purchase order in the specified company.
      operationId: createPurchaseOrder
      tags:
      - Purchase Orders
      parameters:
      - $ref: '#/components/parameters/company_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PurchaseOrderCreate'
            examples:
              CreatepurchaseorderRequestExample:
                summary: Default createPurchaseOrder request
                x-microcks-default: true
                value:
                  orderDate: '2026-01-15'
                  vendorId: '500123'
                  vendorNumber: example_value
                  currencyCode: example_value
                  pricesIncludeTax: true
                  requestedReceiptDate: '2026-01-15'
      responses:
        '201':
          description: Purchase order created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PurchaseOrder'
              examples:
                Createpurchaseorder201Example:
                  summary: Default createPurchaseOrder 201 response
                  x-microcks-default: true
                  value:
                    '@odata.etag': example_value
                    id: abc123
                    number: example_value
                    orderDate: '2026-01-15'
                    postingDate: '2026-01-15'
                    vendorId: '500123'
                    vendorNumber: example_value
                    vendorName: example_value
                    payToName: example_value
                    payToVendorId: '500123'
                    payToVendorNumber: example_value
                    shipToName: example_value
                    shipToContact: example_value
                    buyFromAddressLine1: example_value
                    buyFromAddressLine2: example_value
                    buyFromCity: example_value
                    buyFromCountry: example_value
                    buyFromState: example_value
                    buyFromPostCode: example_value
                    currencyId: '500123'
                    currencyCode: example_value
                    pricesIncludeTax: true
                    paymentTermsId: '500123'
                    shipmentMethodId: '500123'
                    purchaser: example_value
                    requestedReceiptDate: '2026-01-15'
                    discountAmount: 42.5
                    discountAppliedBeforeTax: true
                    totalAmountExcludingTax: 42.5
                    totalTaxAmount: 42.5
                    totalAmountIncludingTax: 42.5
                    fullyReceived: true
                    status: Draft
                    lastModifiedDateTime: '2026-01-15T10:30:00Z'
                    purchaseOrderLines:
                    - '@odata.etag': example_value
                      id: abc123
                      documentId: '500123'
                      sequence: 10
                      itemId: '500123'
                      accountId: '500123'
                      lineType: Comment
                      lineObjectNumber: example_value
                      description: A sample description.
                      description2: example_value
                      unitOfMeasureId: '500123'
                      unitOfMeasureCode: example_value
                      quantity: 42.5
                      directUnitCost: 42.5
                      discountAmount: 42.5
                      discountPercent: 42.5
                      discountAppliedBeforeTax: true
                      amountExcludingTax: 42.5
                      taxCode: example_value
                      taxPercent: 42.5
                      totalTaxAmount: 42.5
                      amountIncludingTax: 42.5
                      expectedReceiptDate: '2026-01-15'
                      receivedQuantity: 42.5
                      invoicedQuantity: 42.5
                      invoiceQuantity: 42.5
                      receiveQuantity: 42.5
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /companies({company_id})/purchaseOrders({purchaseOrder_id}):
    get:
      summary: Get a Purchase Order
      description: Retrieves a specific purchase order by ID.
      operationId: getPurchaseOrder
      tags:
      - Purchase Orders
      parameters:
      - $ref: '#/components/parameters/company_id'
      - $ref: '#/components/parameters/purchaseOrder_id'
      - $ref: '#/components/parameters/select'
      - $ref: '#/components/parameters/expand'
      responses:
        '200':
          description: Successfully retrieved purchase order
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PurchaseOrder'
              examples:
                Getpurchaseorder200Example:
                  summary: Default getPurchaseOrder 200 response
                  x-microcks-default: true
                  value:
                    '@odata.etag': example_value
                    id: abc123
                    number: example_value
                    orderDate: '2026-01-15'
                    postingDate: '2026-01-15'
                    vendorId: '500123'
                    vendorNumber: example_value
                    vendorName: example_value
                    payToName: example_value
                    payToVendorId: '500123'
                    payToVendorNumber: example_value
                    shipToName: example_value
                    shipToContact: example_value
                    buyFromAddressLine1: example_value
                    buyFromAddressLine2: example_value
                    buyFromCity: example_value
                    buyFromCountry: example_value
                    buyFromState: example_value
                    buyFromPostCode: example_value
                    currencyId: '500123'
                    currencyCode: example_value
                    pricesIncludeTax: true
                    paymentTermsId: '500123'
                    shipmentMethodId: '500123'
                    purchaser: example_value
                    requestedReceiptDate: '2026-01-15'
                    discountAmount: 42.5
                    discountAppliedBeforeTax: true
                    totalAmountExcludingTax: 42.5
                    totalTaxAmount: 42.5
                    totalAmountIncludingTax: 42.5
                    fullyReceived: true
                    status: Draft
                    lastModifiedDateTime: '2026-01-15T10:30:00Z'
                    purchaseOrderLines:
                    - '@odata.etag': example_value
                      id: abc123
                      documentId: '500123'
                      sequence: 10
                      itemId: '500123'
                      accountId: '500123'
                      lineType: Comment
                      lineObjectNumber: example_value
                      description: A sample description.
                      description2: example_value
                      unitOfMeasureId: '500123'
                      unitOfMeasureCode: example_value
                      quantity: 42.5
                      directUnitCost: 42.5
                      discountAmount: 42.5
                      discountPercent: 42.5
                      discountAppliedBeforeTax: true
                      amountExcludingTax: 42.5
                      taxCode: example_value
                      taxPercent: 42.5
                      totalTaxAmount: 42.5
                      amountIncludingTax: 42.5
                      expectedReceiptDate: '2026-01-15'
                      receivedQuantity: 42.5
                      invoicedQuantity: 42.5
                      invoiceQuantity: 42.5
                      receiveQuantity: 42.5
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    patch:
      summary: Update a Purchase Order
      description: Updates an existing purchase order.
      operationId: updatePurchaseOrder
      tags:
      - Purchase Orders
      parameters:
      - $ref: '#/components/parameters/company_id'
      - $ref: '#/components/parameters/purchaseOrder_id'
      - $ref: '#/components/parameters/ifMatch'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PurchaseOrderUpdate'
            examples:
              UpdatepurchaseorderRequestExample:
                summary: Default updatePurchaseOrder request
                x-microcks-default: true
                value:
                  orderDate: '2026-01-15'
                  vendorId: '500123'
                  vendorNumber: example_value
                  currencyCode: example_value
                  pricesIncludeTax: true
                  requestedReceiptDate: '2026-01-15'
      responses:
        '200':
          description: Purchase order updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PurchaseOrder'
              examples:
                Updatepurchaseorder200Example:
                  summary: Default updatePurchaseOrder 200 response
                  x-microcks-default: true
                  value:
                    '@odata.etag': example_value
                    id: abc123
                    number: example_value
                    orderDate: '2026-01-15'
                    postingDate: '2026-01-15'
                    vendorId: '500123'
                    vendorNumber: example_value
                    vendorName: example_value
                    payToName: example_value
                    payToVendorId: '500123'
                    payToVendorNumber: example_value
                    shipToName: example_value
                    shipToContact: example_value
                    buyFromAddressLine1: example_value
                    buyFromAddressLine2: example_value
                    buyFromCity: example_value
                    buyFromCountry: example_value
                    buyFromState: example_value
                    buyFromPostCode: example_value
                    currencyId: '500123'
                    currencyCode: example_value
                    pricesIncludeTax: true
                    paymentTermsId: '500123'
                    shipmentMethodId: '500123'
                    purchaser: example_value
                    requestedReceiptDate: '2026-01-15'
                    discountAmount: 42.5
                    discountAppliedBeforeTax: true
                    totalAmountExcludingTax: 42.5
                    totalTaxAmount: 42.5
                    totalAmountIncludingTax: 42.5
                    fullyReceived: true
                    status: Draft
                    lastModifiedDateTime: '2026-01-15T10:30:00Z'
                    purchaseOrderLines:
                    - '@odata.etag': example_value
                      id: abc123
                      documentId: '500123'
                      sequence: 10
                      itemId: '500123'
                      accountId: '500123'
                      lineType: Comment
                      lineObjectNumber: example_value
                      description: A sample description.
                      description2: example_value
                      unitOfMeasureId: '500123'
                      unitOfMeasureCode: example_value
                      quantity: 42.5
                      directUnitCost: 42.5
                      discountAmount: 42.5
                      discountPercent: 42.5
                      discountAppliedBeforeTax: true
                      amountExcludingTax: 42.5
                      taxCode: example_value
                      taxPercent: 42.5
                      totalTaxAmount: 42.5
                      amountIncludingTax: 42.5
                      expectedReceiptDate: '2026-01-15'
                      receivedQuantity: 42.5
                      invoicedQuantity: 42.5
                      invoiceQuantity: 42.5
                      receiveQuantity: 42.5
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      summary: Delete a Purchase Order
      description: Deletes a purchase order by ID.
      operationId: deletePurchaseOrder
      tags:
      - Purchase Orders
      parameters:
      - $ref: '#/components/parameters/company_id'
      - $ref: '#/components/parameters/purchaseOrder_id'
      responses:
        '204':
          description: Purchase order deleted successfully
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /companies({company_id})/purchaseOrders({purchaseOrder_id})/purchaseOrderLines:
    get:
      summary: List Purchase Order Lines
      description: Returns a list of purchase order line items.
      operationId: listPurchaseOrderLines
      tags:
      - Purchase Orders
      parameters:
      - $ref: '#/components/parameters/company_id'
      - $ref: '#/components/parameters/purchaseOrder_id'
      - $ref: '#/components/parameters/top'
      - $ref: '#/components/parameters/skip'
      - $ref: '#/components/parameters/filter'
      - $ref: '#/components/parameters/select'
      responses:
        '200':
          description: Successfully retrieved purchase order lines
          content:
            application/json:
              schema:
                type: object
                properties:
                  value:
                    type: array
                    items:
                      $ref: '#/components/schemas/PurchaseOrderLine'
              examples:
                Listpurchaseorderlines200Example:
                  summary: Default listPurchaseOrderLines 200 response
                  x-microcks-default: true
                  value:
                    value:
                    - '@odata.etag': example_value
                      id: abc123
                      documentId: '500123'
                      sequence: 10
                      itemId: '500123'
                      accountId: '500123'
                      lineType: Comment
                      lineObjectNumber: example_value
                      description: A sample description.
                      description2: example_value
                      unitOfMeasureId: '500123'
                      unitOfMeasureCode: example_value
                      quantity: 42.5
                      directUnitCost: 42.5
                      discountAmount: 42.5
                      discountPercent: 42.5
                      discountAppliedBeforeTax: true
                      amountExcludingTax: 42.5
                      taxCode: example_value
                      taxPercent: 42.5
                      totalTaxAmount: 42.5
                      amountIncludingTax: 42.5
                      expectedReceiptDate: '2026-01-15'
                      receivedQuantity: 42.5
                      invoicedQuantity: 42.5
                      invoiceQuantity: 42.5
                      receiveQuantity: 42.5
        '401':
          $ref: '#/components/responses/Unauthorized'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  parameters:
    ifMatch:
      name: If-Match
      in: header
      required: true
      description: ETag value for optimistic concurrency control
      schema:
        type: string
    filter:
      name: $filter
      in: query
      description: OData filter expression
      schema:
        type: string
    orderby:
      name: $orderby
      in: query
      description: OData order by expression
      schema:
        type: string
    expand:
      name: $expand
      in: query
      description: Related entities to expand inline
      schema:
        type: string
    skip:
      name: $skip
      in: query
      description: Number of items to skip
      schema:
        type: integer
        minimum: 0
    company_id:
      name: company_id
      in: path
      required: true
      description: The unique identifier of the company
      schema:
        type: string
        format: uuid
    select:
      name: $select
      in: query
      description: Comma-separated list of properties to include in the response
      schema:
        type: string
    top:
      name: $top
      in: query
      description: Maximum number of items to return
      schema:
        type: integer
        minimum: 0
    purchaseOrder_id:
      name: purchaseOrder_id
      in: path
      required: true
      description: The unique identifier of the purchase order
      schema:
        type: string
        format: uuid
  responses:
    Unauthorized:
      description: Unauthorized - authentication required
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    BadRequest:
      description: Bad request - invalid input
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: A stable error code
            message:
              type: string
              description: A human-readable error message
          example: example_value
    PurchaseOrder:
      type: object
      properties:
        '@odata.etag':
          type: string
          example: example_value
        id:
          type: string
          format: uuid
          description: The unique identifier of the purchase order
          example: abc123
        number:
          type: string
          description: The purchase order number
          maxLength: 20
          example: example_value
        orderDate:
          type: string
          format: date
          description: The order date
          example: '2026-01-15'
        postingDate:
          type: string
          format: date
          description: The posting date
          example: '2026-01-15'
        vendorId:
          type: string
          format: uuid
          description: The vendor ID
          example: '500123'
        vendorNumber:
          type: string
          description: The vendor number
          maxLength: 20
          example: example_value
        vendorName:
          type: string
          description: The vendor name
          maxLength: 100
          example: example_value
        payToName:
          type: string
          maxLength: 100
          example: example_value
        payToVendorId:
          type: string
          format: uuid
          example: '500123'
        payToVendorNumber:
          type: string
          maxLength: 20
          example: example_value
        shipToName:
          type: string
          maxLength: 100
          example: example_value
        shipToContact:
          type: string
          maxLength: 100
          example: example_value
        buyFromAddressLine1:
          type: string
          maxLength: 100
          example: example_value
        buyFromAddressLine2:
          type: string
          maxLength: 50
          example: example_value
        buyFromCity:
          type: string
          maxLength: 30
          example: example_value
        buyFromCountry:
          type: string
          maxLength: 10
          example: example_value
        buyFromState:
          type: string
          maxLength: 20
          example: example_value
        buyFromPostCode:
          type: string
          maxLength: 20
          example: example_value
        currencyId:
          type: string
          format: uuid
          example: '500123'
        currencyCode:
          type: string
          maxLength: 10
          example: example_value
        pricesIncludeTax:
          type: boolean
          example: true
        paymentTermsId:
          type: string
          format: uuid
          example: '500123'
        shipmentMethodId:
          type: string
          format: uuid
          example: '500123'
        purchaser:
          type: string
          maxLength: 20
          example: example_value
        requestedReceiptDate:
          type: string
          format: date
          example: '2026-01-15'
        discountAmount:
          type: number
          format: decimal
          example: 42.5
        discountAppliedBeforeTax:
          type: boolean
          example: true
        totalAmountExcludingTax:
          type: number
          format: decimal
          readOnly: true
          example: 42.5
        totalTaxAmount:
          type: number
          format: decimal
          readOnly: true
          example: 42.5
        totalAmountIncludingTax:
          type: number
          format: decimal
          readOnly: true
          example: 42.5
        fullyReceived:
          type: boolean
          readOnly: true
          example: true
        status:
          type: string
          enum:
          - Draft
          - In Review
          - Open
          - Released
          readOnly: true
          example: Draft
        lastModifiedDateTime:
          type: string
          format: date-time
          readOnly: true
          example: '2026-01-15T10:30:00Z'
        purchaseOrderLines:
          type: array
          items:
            $ref: '#/components/schemas/PurchaseOrderLine'
          example: []
    PurchaseOrderCreate:
      type: object
      properties:
        orderDate:
          type: string
          format: date
          example: '2026-01-15'
        vendorId:
          type: string
          format: uuid
          example: '500123'
        vendorNumber:
          type: string
          maxLength: 20
          example: example_value
        currencyCode:
          type: string
          maxLength: 10
          example: example_value
        pricesIncludeTax:
          type: boolean
          example: true
        requestedReceiptDate:
          type: string
          format: date
          example: '2026-01-15'
    PurchaseOrderLine:
      type: object
      properties:
        '@odata.etag':
          type: string
          example: example_value
        id:
          type: string
          format: uuid
          example: abc123
        documentId:
          type: string
          format: uuid
          example: '500123'
        sequence:
          type: integer
          example: 10
        itemId:
          type: string
          format: uuid
          example: '500123'
        accountId:
          type: string
          format: uuid
          example: '500123'
        lineType:
          type: string
          enum:
          - Comment
          - Account
          - Item
          - Fixed Asset
          - Charge
          example: Comment
        lineObjectNumber:
          type: string
          maxLength: 20
          example: example_value
        description:
          type: string
          maxLength: 100
          example: A sample description.
        description2:
          type: string
          maxLength: 50
          example: example_value
        unitOfMeasureId:
          type: string
          format: uuid
          example: '500123'
        unitOfMeasureCode:
          type: string
          maxLength: 10
          example: example_value
        quantity:
          type: number
          format: decimal
          example: 42.5
        directUnitCost:
          type: number
          format: decimal
          example: 42.5
        discountAmount:
          type: number
          format: decimal
          example: 42.5
        discountPercent:
          type: number
          format: decimal
          example: 42.5
        discountAppliedBeforeTax:
          type: boolean
          example: true
        amountExcludingTax:
          type: number
          format: decimal
          readOnly: true
          example: 42.5
        taxCode:
          type: string
          maxLength: 20
          example: example_value
        taxPercent:
          type: number
          format: decimal
          readOnly: true
          example: 42.5
        totalTaxAmount:
          type: number
          format: decimal
          readOnly: true
          example: 42.5
        amountIncludingTax:
          type: number
          format: decimal
          readOnly: true
          example: 42.5
        expectedReceiptDate:
          type: string
          format: date
          example: '2026-01-15'
        receivedQuantity:
          type: number
          format: decimal
          readOnly: true
          example: 42.5
        invoicedQuantity:
          type: number
          format: decimal
          readOnly: true
          example: 42.5
        invoiceQuantity:
          type: number
          format: decimal
          example: 42.5
        receiveQuantity:
          type: number
          format: decimal
          example: 42.5
    PurchaseOrderUpdate:
      type: object
      properties:
        orderDate:
          type: string
          format: date
          example: '2026-01-15'
        vendorId:
          type: string
          format: uuid
          example: '500123'
        vendorNumber:
          type: string
          maxLength: 20
          example: example_value
        currencyCode:
          type: string
          maxLength: 10
          example: example_value
        pricesIncludeTax:
          type: boolean
          example: true
        requestedReceiptDate:
          type: string
          format: date
          example: '2026-01-15'
  securitySchemes:
    oauth2:
      type: oauth2
      description: OAuth 2.0 authentication via Microsoft Entra ID
      flows:
        authorizationCode:
          authorizationUrl: https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/authorize
          tokenUrl: https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token
          scopes:
            https://api.businesscentral.dynamics.com/.default: Access Business Central Admin APIs
        clientCredentials:
          tokenUrl: https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token
          scopes:
            https://api.businesscentral.dynamics.com/.default: Access Business Central Admin APIs
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
externalDocs:
  description: Administration Center API Documentation
  url: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/administration-center-api