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

# Create new invoice

> Create a new invoice with automatic numbering and PDF generation



## OpenAPI

````yaml post /v1/invoices
openapi: 3.0.0
info:
  title: Invoices API
  version: 1.0.0
  description: API documentation for Invoices management package
servers: []
security:
  - bearerAuth: []
paths:
  /v1/invoices:
    post:
      tags:
        - Invoices
      summary: Create new invoice
      description: Create a new invoice with automatic numbering and PDF generation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceInput'
      responses:
        '201':
          description: Invoice created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceResponse'
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    InvoiceInput:
      type: object
      required:
        - status
        - party_type
        - due_date
        - currency
        - iban
        - customer_id
      properties:
        description:
          type: string
          example: Monthly services
        status:
          type: string
          enum:
            - draft
            - pending
            - paid
            - sent
            - overdue
          example: draft
        party_type:
          type: string
          enum:
            - receiver
            - sender
          example: receiver
        due_date:
          type: string
          format: date-time
          example: '2024-04-01T00:00:00Z'
        currency:
          type: string
          minLength: 3
          maxLength: 3
          example: CHF
        iban:
          type: string
          example: CH93 0076 2011 6238 5295 7
        customer_id:
          type: string
          format: uuid
          example: 550e8400-e29b-41d4-a716-446655440000
        name_from:
          type: string
          example: Sender Company AG
        address_from:
          type: string
          example: Bahnhofstrasse 1
        zip_from:
          type: string
          example: '8001'
        city_from:
          type: string
          example: Zürich
        country_from:
          type: string
          example: Switzerland
        name_to:
          type: string
          example: Receiver GmbH
        address_to:
          type: string
          example: Hauptstrasse 10
        zip_to:
          type: string
          example: '3000'
        city_to:
          type: string
          example: Bern
        country_to:
          type: string
          example: Switzerland
        shipping:
          type: number
          example: 10
        discount:
          type: number
          minimum: 0
          maximum: 100
          example: 5
        vat:
          type: number
          minimum: 0
          maximum: 100
          example: 7.7
        items:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceInputItems'
        active:
          type: boolean
          default: true
        metadata:
          type: object
          additionalProperties: true
          example:
            department: IT
            project_code: P123
    InvoiceResponse:
      type: object
      properties:
        invoice: adccd1bc-84df-447e-bca0-44be1d466094
        items:
          type: array
          items: e882e10d-d3a6-4549-9ae3-89ae72788d6e
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Error code
          example: invalid_input
        message:
          type: string
          description: Error message
          example: Invalid input data
        details:
          type: object
          description: Additional error details
    InvoiceInputItems:
      type: object
      required:
        - title
        - quantity
        - unit_price
      properties:
        title:
          type: string
        description:
          type: string
        quantity:
          type: number
        unit_price:
          type: number
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````