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

# Create Purchase Invoice

> Create a new purchase invoice

```text Plain Signature wrap theme={null}
path=/v1/purchase-invoices&token=YOUR_TOKEN&email=john@gmail.com&tenant_id=841eaf97-c428-47d1-9f6d-c61cc9df7bee
```


## OpenAPI

````yaml POST /v1/purchase-invoices
openapi: 3.1.0
info:
  title: Accounting+ API
  description: >-
    A comprehensive accounting API that provides endpoints for managing bank
    cash flow vouchers and journal transactions
  version: 1.0.0
servers:
  - url: https://staging-openapi.accountingplus.id
    description: Main API Server
    variables:
      url:
        default: https://staging-openapi.accountingplus.id
        description: The API base URL
security:
  - bearerAuth: []
    signatureKey: []
    dataKey: []
tags:
  - name: Vouchers
    description: Bank cash flow voucher management
  - name: Journals
    description: Journal transaction management
  - name: Purchase Invoices
    description: Purchase invoice management
paths:
  /v1/purchase-invoices:
    post:
      tags:
        - Purchase Invoices
      summary: Create Purchase Invoice
      description: Create a new purchase invoice
      requestBody:
        description: Purchase invoice details
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePurchaseInvoiceRequest'
      responses:
        '200':
          description: Purchase invoice created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePurchaseInvoiceResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  message:
                    type: string
                  traceId:
                    type: string
              examples:
                Invalid Request 1:
                  summary: Multiple tax codes are not allowed
                  value:
                    status: ACC03
                    message: multiple tax codes are not allowed
                    traceId: 123e4567-e89b-12d3-a456-426614174000
                Invalid Request 2:
                  summary: Invalid expired date
                  value:
                    status: ACC03
                    message: expired date should be later or equal to document date
                    traceId: 123e4567-e89b-12d3-a456-426614174000
        '404':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  message:
                    type: string
                  traceId:
                    type: string
              examples:
                Unprocessable Entity 1:
                  summary: Invalid transaction data purchase order
                  value:
                    status: ACC09
                    message: transaction data purchase order not found
                    traceId: 123e4567-e89b-12d3-a456-426614174000
                Unprocessable Entity 2:
                  summary: Invalid master data currency
                  value:
                    status: ACC09
                    message: master data currency not found
                    traceId: 123e4567-e89b-12d3-a456-426614174000
                Unprocessable Entity 3:
                  summary: Invalid parameter data product inventory
                  value:
                    status: ACC09
                    message: parameter data product inventory not found
                    traceId: 123e4567-e89b-12d3-a456-426614174000
                Unprocessable Entity 4:
                  summary: Invalid parameter data other purchasing expenses
                  value:
                    status: ACC09
                    message: parameter data other purchasing expenses not found
                    traceId: 123e4567-e89b-12d3-a456-426614174000
                Unprocessable Entity 5:
                  summary: Invalid parameter data account payable
                  value:
                    status: ACC09
                    message: parameter data account payable not found
                    traceId: 123e4567-e89b-12d3-a456-426614174000
                Unprocessable Entity 6:
                  summary: Invalid parameter data consumption expense
                  value:
                    status: ACC09
                    message: parameter data consumption expense not found
                    traceId: 123e4567-e89b-12d3-a456-426614174000
components:
  schemas:
    CreatePurchaseInvoiceRequest:
      type: object
      required:
        - vendor_name
        - document_date
        - items
      properties:
        vendor_name:
          type: string
          example: CV Agus System
        document_date:
          type: string
          format: date-time
          example: 30/07/2029
        auto_create_payment:
          description: Set to `true` if you want to create payment automatically
          type: boolean
          example: true
        other_amount:
          type: number
          example: 0
        items:
          type: array
          items:
            type: object
            properties:
              item_code:
                type: string
              item_name:
                type: string
              quantity:
                type: number
              unit_of_measurement:
                type: string
              unit_price:
                type: number
              discount_amount:
                type: number
              tax_code:
                type: string
          example:
            - item_code: '0745114900005'
              item_name: Product A
              quantity: 2
              unit_of_measurement: pcs
              unit_price: 2000
              discount_amount: 0
              tax_code: ''
            - item_code: '0745114900006'
              item_name: Product B
              quantity: 5
              unit_of_measurement: pcs
              unit_price: 1000
              discount_amount: 0
              tax_code: ''
    CreatePurchaseInvoiceResponse:
      type: object
      properties:
        status:
          type: string
          example: '00'
        message:
          type: string
          example: success
        data:
          type: object
          properties:
            aging_days:
              type: integer
              example: 0
            auto_create_payment:
              type: boolean
              example: true
            bank_account_code:
              type: string
              example: '002'
            bank_account_name:
              type: string
              example: Bank
            currency_code:
              type: string
              example: IDR
            currency_name:
              type: string
              example: Rupiah Indonesia
            description:
              type: string
              example: From API Integration id 1754626495
            discount_amount:
              type: number
              example: 0
            document_date:
              type: string
              format: date-time
              example: '2029-07-30T00:00:00Z'
            document_number:
              type: string
              example: 00006/FPB/07/29
            document_status:
              type: string
              example: Final
            due_date:
              type: string
              format: date-time
              nullable: true
            other_amount:
              type: number
              example: 0
            outstanding_amount:
              type: number
              example: 9000
            purchase_order_document_number:
              type: string
              example: ''
            process_status:
              type: string
              example: Lunas
            rounding_amount:
              type: number
              example: 0
            sub_total_amount:
              type: number
              example: 9000
            tax_included_indicator:
              type: boolean
              example: false
            total_amount:
              type: number
              example: 9000
            total_payment:
              type: number
              example: 9000
            total_tax_amount:
              type: number
              example: 0
            vendor_address:
              type: string
              example: Indonesia
            vendor_code:
              type: string
              example: '00006'
            vendor_invoice_number:
              type: string
              example: ''
            vendor_name:
              type: string
              example: CV Agus System
            items:
              type: array
              items:
                type: object
                properties:
                  detail_number:
                    type: string
                  discount_amount:
                    type: number
                  document_number:
                    type: string
                  item_code:
                    type: string
                  item_name:
                    type: string
                  quantity:
                    type: number
                  sub_total_amount:
                    type: number
                  tax_code:
                    type: string
                  tax_name:
                    type: string
                  tax_rate:
                    type: number
                  total_amount:
                    type: number
                  total_tax_amount:
                    type: number
                  unit_of_measurement_code:
                    type: string
                  unit_of_measurement_name:
                    type: string
                  unit_price:
                    type: number
              example:
                - detail_number: '00001'
                  discount_amount: 0
                  document_number: 00006/FPB/07/29
                  item_code: '0745114900005'
                  item_name: Product A
                  quantity: 2
                  sub_total_amount: 4000
                  tax_code: ''
                  tax_name: ''
                  tax_rate: 0
                  total_amount: 4000
                  total_tax_amount: 0
                  unit_of_measurement_code: PCS01
                  unit_of_measurement_name: pcs
                  unit_price: 2000
                - detail_number: '00002'
                  discount_amount: 0
                  document_number: 00006/FPB/07/29
                  item_code: '0745114900006'
                  item_name: Product B
                  quantity: 5
                  sub_total_amount: 5000
                  tax_code: ''
                  tax_name: ''
                  tax_rate: 0
                  total_amount: 5000
                  total_tax_amount: 0
                  unit_of_measurement_code: PCS01
                  unit_of_measurement_name: pcs
                  unit_price: 1000
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Generate a JWT signed with the `client_secret` and include the
        `client_id` as a claim in its payload.
    signatureKey:
      type: apiKey
      in: header
      name: A-Signature
      description: >-
        Generate the signature by creating an `SHA256-HMAC` hash from the plain
        signature above, using the `signature_secret` as the key. Then,
        `Base64-encode` the resulting hash and place the final value in the
        A-Signature header.
    dataKey:
      type: apiKey
      in: header
      name: A-Data
      description: Include the `email` and `tenant_id` in the payload as Base64 encoded.

````