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

# Create purchase order

> Creates a new purchase order



## OpenAPI

````yaml /openapi-public.json post /v1/purchase-orders
openapi: 3.0.1
info:
  title: Light API
  version: 1.0.0
servers: []
security:
  - apiKeyAuth: []
  - bearerAuth: []
paths:
  /v1/purchase-orders:
    post:
      tags:
        - v1 - Purchase Orders
      summary: Create purchase order
      description: Creates a new purchase order
      operationId: createPurchaseOrder
      requestBody:
        content:
          application/json;charset=UTF-8:
            schema:
              $ref: '#/components/schemas/ExternalCreatePurchaseOrderRequestV1Model'
      responses:
        default:
          description: default response
          content:
            application/json;charset=UTF-8:
              schema:
                $ref: '#/components/schemas/ExternalPurchaseOrderV1Model'
components:
  schemas:
    ExternalCreatePurchaseOrderRequestV1Model:
      type: object
      properties:
        vendorId:
          type: string
          format: uuid
          nullable: true
        companyEntityId:
          type: string
          format: uuid
          nullable: true
        ownerId:
          type: string
          format: uuid
          nullable: true
        currency:
          type: string
          nullable: true
          example: USD
        vendorEmail:
          type: string
          nullable: true
        purchaseOrderDate:
          type: string
          format: date
          nullable: true
        deliveryAddress:
          type: string
          nullable: true
        deliveryDate:
          type: string
          format: date
          nullable: true
        description:
          type: string
          nullable: true
        lines:
          type: array
          items:
            $ref: '#/components/schemas/ExternalCreatePurchaseOrderLineRequestV1Model'
        customProperties:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/ExternalSetCustomPropertyRequestV1Model'
    ExternalPurchaseOrderV1Model:
      type: object
      properties:
        id:
          type: string
          format: uuid
        companyId:
          type: string
          format: uuid
        createdBy:
          type: string
          format: uuid
        companyEntityId:
          type: string
          format: uuid
        purchaseRequestId:
          type: string
          format: uuid
        state:
          type: string
          description: >-
            ⚠️ This enum is not exhaustive; new values may be added in the
            future.
          enum:
            - IN_DRAFT
            - RESET_PENDING
            - APPROVED_ACCOUNTING_ENTRY_PENDING
            - OPEN
            - CLOSE_PENDING
            - CLOSED
            - CANCEL_PENDING
            - CANCELLED
        totalAmount:
          type: integer
          format: int64
        totalNetAmount:
          type: integer
          format: int64
        totalTaxAmount:
          type: integer
          format: int64
        erpNumber:
          type: string
        description:
          type: string
        currency:
          type: string
          example: USD
        ownerId:
          type: string
          format: uuid
        vendorId:
          type: string
          format: uuid
        vendorEmail:
          type: string
        deliveryAddress:
          type: string
        deliveryDate:
          type: string
          format: date
        documentKey:
          type: string
        failureContext:
          $ref: '#/components/schemas/ExternalUiClientExceptionV1Model'
        editStatus:
          type: string
          description: >-
            ⚠️ This enum is not exhaustive; new values may be added in the
            future.
          enum:
            - ALL_EDITS_ALLOWED
            - ALL_EDITS_LOCKED
        purchaseOrderDate:
          type: string
          format: date
        erpSyncedAt:
          type: string
          format: date-time
        lockedAt:
          type: string
          format: date-time
        closedAt:
          type: string
          format: date-time
        cancelledAt:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        lines:
          type: array
          items:
            $ref: '#/components/schemas/ExternalPurchaseOrderLineV1Model'
        customProperties:
          type: array
          items:
            $ref: '#/components/schemas/ExternalCustomPropertyV1Model'
    ExternalCreatePurchaseOrderLineRequestV1Model:
      type: object
      properties:
        description:
          type: string
        costCenterId:
          type: string
          format: uuid
        accountId:
          type: string
          format: uuid
        taxCodeId:
          type: string
          format: uuid
        quantity:
          type: number
        unitPrice:
          type: integer
          format: int64
        customProperties:
          type: array
          items:
            $ref: '#/components/schemas/ExternalSetCustomPropertyRequestV1Model'
    ExternalSetCustomPropertyRequestV1Model:
      type: object
      properties:
        groupId:
          type: string
          description: ID of the custom property group.
          format: uuid
        valueIds:
          type: array
          description: >-
            IDs of the selected custom property values. It behaves as a PUT
            operation, so if empty the existing ones will be effectively
            deleted.
          items:
            type: string
            description: >-
              IDs of the selected custom property values. It behaves as a PUT
              operation, so if empty the existing ones will be effectively
              deleted.
            format: uuid
        inlineValues:
          type: array
          description: >-
            Inline custom property values (used for TEXT/NUMERIC/DATE/etc.
            groups). It behaves as a PUT operation, so if empty or null the
            existing ones will be effectively deleted.
          nullable: true
          items:
            type: string
            description: >-
              Inline custom property values (used for TEXT/NUMERIC/DATE/etc.
              groups). It behaves as a PUT operation, so if empty or null the
              existing ones will be effectively deleted.
            nullable: true
      description: >-
        List of custom properties to set on the vendor. Replaces the existing
        set.
      nullable: true
    ExternalUiClientExceptionV1Model:
      type: object
      properties:
        name:
          type: string
          description: The error name
        type:
          type: string
          description: >-
            The error type


            ⚠️ This enum is not exhaustive; new values may be added in the
            future.
          nullable: false
          deprecated: false
          enum:
            - BAD_REQUEST
            - UNAUTHORIZED
            - FORBIDDEN
            - NOT_FOUND
            - CONFLICT
            - UNPROCESSABLE_CONTENT
        errors:
          type: array
          description: List of errors providing details about what went wrong
          items:
            $ref: '#/components/schemas/ExternalUiClientExceptionErrorV1Model'
      description: Failure context when vendor onboarding fails.
      nullable: true
    ExternalPurchaseOrderLineV1Model:
      type: object
      properties:
        id:
          type: string
          format: uuid
        companyId:
          type: string
          format: uuid
        purchaseOrderId:
          type: string
          format: uuid
        description:
          type: string
        costCenterId:
          type: string
          format: uuid
        accountId:
          type: string
          format: uuid
        taxCodeId:
          type: string
          format: uuid
        quantity:
          type: number
        unitPrice:
          type: integer
          format: int64
        amount:
          type: integer
          format: int64
        netAmount:
          type: integer
          format: int64
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        customProperties:
          type: array
          items:
            $ref: '#/components/schemas/ExternalCustomPropertyV1Model'
    ExternalCustomPropertyV1Model:
      type: object
      properties:
        groupId:
          type: string
          description: ID of the custom property group
          format: uuid
        groupInternalName:
          type: string
          description: Internal name of the custom property group
        values:
          type: array
          description: >-
            List of values. Note that this will be a single value unless the
            group input type supports multiple values
          items:
            $ref: '#/components/schemas/ExternalCustomPropertyValueV1Model'
      description: Custom properties set on the vendor.
      nullable: true
    ExternalUiClientExceptionErrorV1Model:
      type: object
      properties:
        type:
          type: string
          description: A string code identifying the error type
        message:
          type: string
          description: A human-readable message providing more details about the error
        path:
          type: array
          description: >-
            Optional path of the error when the error is for a specific field.
            Used mostly on BAD_REQUEST errors, that path will match the field
            name on the request object
          nullable: true
          items:
            type: string
            description: >-
              Optional path of the error when the error is for a specific field.
              Used mostly on BAD_REQUEST errors, that path will match the field
              name on the request object
            nullable: true
        context:
          type: object
          additionalProperties:
            type: object
            description: >-
              Optional context providing additional information about the error.
              This can include any relevant data that might help in
              understanding or resolving the error
            nullable: true
          description: >-
            Optional context providing additional information about the error.
            This can include any relevant data that might help in understanding
            or resolving the error
          nullable: true
      description: List of errors providing details about what went wrong
    ExternalCustomPropertyValueV1Model:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the object
          format: uuid
        groupId:
          type: string
          description: ID of the custom property group
          format: uuid
        groupInternalName:
          type: string
          description: Internal name of the custom property group
        companyId:
          type: string
          description: ID of the company
          format: uuid
        internalName:
          type: string
          description: Internal name of the custom property value
        label:
          type: string
          description: Label of the custom property value
        context:
          type: string
          description: Context/description of the custom property value
          nullable: true
        createdAt:
          type: string
          description: Timestamp when the custom property value was created
          format: date-time
        updatedAt:
          type: string
          description: Timestamp when the custom property value was last updated
          format: date-time
      description: >-
        List of values. Note that this will be a single value unless the group
        input type supports multiple values
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      description: >-
        Basic authentication header of the form **Basic** **<api_key>**, where
        **<api_key>** is your api key.
      name: Authorization
      in: header
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````