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

# Import an invoice



## OpenAPI

````yaml https://public.leanpay.fr/openapi/leanpay_api_documentation.swagger.yaml post /invoices
openapi: 3.1.1
info:
  version: 1.0.0
  title: LeanPay Api documentation
  contact:
    email: integration@leanpay.fr
servers:
  - url: https://api.leanpay.fr/v1/public
security: []
tags:
  - name: clients
    description: Routes related to clients
  - name: invoices
    description: Routes related to invoices
  - name: credit-notes
    description: Routes related to credit notes
  - name: misc-operations
    description: Routes related to misc operations
  - name: contacts
    description: Routes related to client contacts
  - name: addresses
    description: Routes related to client addresses
  - name: payments
    description: Routes related to invoice payments
  - name: portal-payments
    description: >-
      Routes related to portal payments (online payments made by debtors from
      the customer portal)
  - name: paybacks
    description: Routes related to credit note paybacks
  - name: links
    description: Routes related to invoice/credit note links
  - name: comments
    description: Routes related to comments
  - name: deleted-elements
    description: Routes related to deleted elements
  - name: client-properties
    description: Routes related to client properties
paths:
  /invoices:
    post:
      tags:
        - invoices
      summary: Import an invoice
      requestBody:
        description: Invoice object to import
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceCreate'
      responses:
        '200':
          description: Returns the imported invoice
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceResponse'
        '400':
          description: Response sent when the invoice object provided is invalid
        '404':
          description: Client not found
        '409':
          description: Invoice already exist
      security:
        - authorization: []
components:
  schemas:
    InvoiceCreate:
      type: object
      properties:
        clientId:
          type: string
          format: uuid
        externalId:
          type:
            - string
            - 'null'
          maxLength: 80
        reference:
          type: string
          maxLength: 80
        amount:
          type: integer
          minimum: 0
        netAmount:
          type: integer
          minimum: 0
        sentDate:
          type: string
          format: date
          deprecated: true
          description: use issueDate instead
        issueDate:
          type: string
          format: date
        dueDate:
          type: string
          format: date
      required:
        - clientId
        - reference
        - amount
        - netAmount
        - issueDate
        - dueDate
    InvoiceResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
        tenantId:
          type: string
          format: uuid
        clientId:
          type: string
          format: uuid
        externalId:
          type:
            - string
            - 'null'
        reference:
          type: string
        amount:
          type: integer
        remainingAmount:
          type: integer
        paidAmount:
          type: integer
        offsetAmount:
          type: integer
        sentDate:
          type: string
          format: date-time
          deprecated: true
          description: use issueDate instead
        issueDate:
          type: string
          format: date-time
        dueDate:
          type: string
          format: date-time
        status:
          type: string
          description: Invoice status
          enum:
            - due
            - overdue
            - paid
            - disputed
            - offset
            - payment_in_progress
            - upcoming_payment
            - recovery
        upcomingPaymentDate:
          type:
            - string
            - 'null'
          format: date-time
        dueDates:
          type: array
          items:
            $ref: '#/components/schemas/DueDateOutput'
        payments:
          type: array
          items:
            $ref: '#/components/schemas/PaymentOrPaybackOutput'
        creditNoteLinks:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceToCreditNoteLinkOutput'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    DueDateOutput:
      allOf:
        - $ref: '#/components/schemas/AmountAndDefaultCurrencyAmount'
        - type: object
          properties:
            dueDate:
              type: string
              format: date-time
            currency:
              type: string
          required:
            - dueDate
            - currency
    PaymentOrPaybackOutput:
      allOf:
        - $ref: '#/components/schemas/AmountAndDefaultCurrencyAmount'
        - type: object
          properties:
            date:
              type: string
              format: date-time
            externalId:
              type:
                - string
                - 'null'
              maxLength: 80
          required:
            - date
    InvoiceToCreditNoteLinkOutput:
      allOf:
        - $ref: '#/components/schemas/AmountAndDefaultCurrencyAmountNullable'
        - type: object
          properties:
            date:
              type: string
              format: date-time
            externalId:
              type: string
              maxLength: 80
            creditNote:
              type: object
              properties:
                id:
                  type: string
                  format: uuid
                externalId:
                  type:
                    - string
                    - 'null'
          required:
            - date
    AmountAndDefaultCurrencyAmount:
      type: object
      properties:
        amount:
          type: number
          minimum: 0
        defaultCurrencyAmount:
          type: number
          minimum: 0
    AmountAndDefaultCurrencyAmountNullable:
      type: object
      properties:
        amount:
          type:
            - number
            - 'null'
          minimum: 0
        defaultCurrencyAmount:
          type:
            - number
            - 'null'
          minimum: 0
  securitySchemes:
    authorization:
      type: apiKey
      name: Authorization
      in: header

````