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

# Creates a purchase order



## OpenAPI

````yaml /swagger.yaml post /purchase_orders
openapi: 3.0.1
info:
  title: Fohlio REST API
  description: This is the documentation for the Fohlio REST API.
  version: 1.0.0
servers:
  - url: /openapi
  - url: https://app.fohlio.com/be/openapi
security: []
paths:
  /purchase_orders:
    post:
      tags:
        - Purchase Order
      summary: Creates a purchase order
      operationId: purchase_orders#create
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/requestBodyPurchaseOrderCreate'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/purchaseOrder'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
        - apiKey: []
components:
  schemas:
    requestBodyPurchaseOrderCreate:
      type: object
      properties:
        project_id:
          type: integer
        items:
          type: array
          items:
            type: object
            properties:
              project_model_id:
                type: integer
              name:
                type: string
              description:
                type: string
              unit_type:
                type: string
              quantity:
                type: number
              price:
                type: number
              taxable:
                type: boolean
            required:
              - project_model_id
        label:
          type: string
        vendor_id:
          type: integer
        shipping_client_id:
          type: integer
        billing_client_id:
          type: integer
        document_template_id:
          type: integer
        notes:
          type: string
        shipping_cost:
          type: number
        packing_cost:
          type: number
        duties_cost:
          type: number
        install_cost:
          type: number
        sales_tax:
          type: number
        other_cost:
          type: number
      required:
        - project_id
        - items
    purchaseOrder:
      type: object
      properties:
        id:
          type: integer
        rev_num:
          type: string
          nullable: true
        last_revision_num:
          type: string
          nullable: true
        project_id:
          type: integer
        creator_id:
          type: integer
        label:
          type: string
        status:
          type: string
          enum:
            - draft
            - review
            - approved
            - rejected
            - open
            - shipment_created
            - arrival_expected
            - received_partially
            - closed
        common_status:
          type: string
          enum:
            - draft
            - review
            - approved
            - rejected
            - open
            - shipment_created
            - arrival_expected
            - received_partially
            - closed
        project_name:
          type: string
        purchase_order_date:
          type: string
          format: date
          nullable: true
        delivery_date:
          type: string
          format: date
          nullable: true
        sent_date:
          type: string
          format: date
          nullable: true
        ship_via:
          type: string
          nullable: true
        note:
          type: string
          nullable: true
        payment_terms:
          type: string
          nullable: true
        currency:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        vendor_id:
          type: integer
        vendor_address_id:
          type: integer
          nullable: true
        vendor_contact_id:
          type: integer
          nullable: true
        shipping_client_id:
          type: integer
          nullable: true
        shipping_client_address_id:
          type: integer
          nullable: true
        shipping_client_contact_id:
          type: integer
          nullable: true
        billing_client_id:
          type: integer
          nullable: true
        billing_client_address_id:
          type: integer
          nullable: true
        billing_client_contact_id:
          type: integer
          nullable: true
        vendor:
          $ref: '#/components/schemas/contact'
        shipping_client:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/contact'
        billing_client_client:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/contact'
        amount:
          type: number
        total:
          type: number
        shipping_cost:
          type: number
        packing_cost:
          type: number
        duties_cost:
          type: number
        install_cost:
          type: number
        other_cost:
          type: number
        sales_tax:
          type: number
        invoiced_amount:
          type: number
        paid_amount:
          type: number
        due_amount:
          type: number
        items:
          type: array
          items:
            $ref: '#/components/schemas/lineItem'
        client_invoice_ids:
          type: array
          items:
            type: integer
        supplier_invoice_ids:
          type: array
          items:
            type: integer
        shipment_ids:
          type: array
          items:
            type: integer
    error:
      type: object
      properties:
        error:
          type: string
    contact:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        data:
          type: object
          additionalProperties: true
          description: The details of the contact encoded in JSON format.
        addresses:
          type: array
          items:
            $ref: '#/components/schemas/contactAddress'
        people:
          type: array
          items:
            $ref: '#/components/schemas/contactPerson'
        categories:
          type: array
          items:
            $ref: '#/components/schemas/contactCategory'
    lineItem:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        unit_type:
          type: string
          nullable: true
        quantity:
          type: number
        price:
          type: number
        taxable:
          type: boolean
        second_taxable:
          type: boolean
          nullable: true
        project_item_id:
          type: integer
          nullable: true
    contactAddress:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        phone:
          type: string
          nullable: true
        post_code:
          type: string
          nullable: true
        address_line_1:
          type: string
          nullable: true
        address_line_2:
          type: string
          nullable: true
        city:
          type: string
          nullable: true
        state:
          type: string
          nullable: true
        country:
          type: string
          nullable: true
        priority:
          type: boolean
    contactPerson:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
          nullable: true
        email:
          type: string
          nullable: true
        phone:
          type: string
          nullable: true
        position:
          type: string
          nullable: true
        note:
          type: string
          nullable: true
        priority:
          type: boolean
    contactCategory:
      type: object
      properties:
        id:
          type: integer
        type:
          type: string
          enum:
            - client
            - supplier
            - general_contractor
            - manufacture
            - warehouse
  securitySchemes:
    apiKey:
      type: apiKey
      name: authorization
      in: header

````