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

# Delete invoice

> Deletes (voids) the invoice with the given id, unposting any associated transactions. Posted invoices in closed fiscal years cannot be deleted.

<Warning>
  Deleting a posted invoice also removes its accounting transactions. Once the
  invoice's fiscal year is closed, the invoice can no longer be deleted; use
  [annulment](/api/invoices/annul) instead to reverse it.
</Warning>


## OpenAPI

````yaml DELETE /v1/invoices/{invoiceId}
openapi: 3.1.0
info:
  title: infinity.swiss Open API
  version: '1.0'
  summary: ''
servers:
  - url: https://api.infinity.swiss
security:
  - apiKey: []
paths:
  /v1/invoices/{invoiceId}:
    parameters:
      - schema:
          type: string
        name: invoiceId
        in: path
        description: The id of the specific invoice.
        required: true
    delete:
      tags: []
      summary: Delete invoice
      description: >-
        Deletes (voids) the invoice with the given id, unposting any associated
        transactions. Posted invoices in closed fiscal years cannot be deleted.
      operationId: delete-invoice-by-id-v1
      responses:
        '200':
          description: The invoice was deleted successfully.
        '401':
          $ref: '#/components/responses/Unauthorised'
        '403':
          $ref: '#/components/responses/InvoicePostingForbidden'
        '404':
          $ref: '#/components/responses/CustomerInvoiceNotFound'
components:
  responses:
    Unauthorised:
      description: >-
        An unauthorised request was submitted. You may be using an incorrect or
        expired API token, or are attempting to access a document outside of the
        scope of the token.
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                x-stoplight:
                  id: 08hkw8ukmi2lp
                description: Specific error code
          examples:
            Unauthorised request:
              value:
                code: general/unauthorised
    InvoicePostingForbidden:
      description: >-
        The requested transition is not allowed. This may happen when the
        relevant fiscal year or VAT period is not editable, or when the invoice
        is in a state that does not permit the operation.
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                description: |-
                  The specific error code for this request. May include:
                  - `fiscal-year/not-found`
                  - `fiscal-year/closed`
                  - `vat-period/closed`
                  - `customer-invoice/is-draft`
                  - `customer-invoice/is-annulled`
                  - `customer-invoice/cannot-annul`
                  - `customer-invoice/cannot-modify`
    CustomerInvoiceNotFound:
      description: >-
        No invoice or estimate with the given id could be found in this
        organisation. Also returned when the id refers to the other kind of
        document, e.g. an estimate id on an invoice endpoint.
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                description: Specific error code.
          examples:
            Not found:
              value:
                code: customer-invoice/not-found
  securitySchemes:
    apiKey:
      name: x-api-token
      type: apiKey
      in: header
      description: >-
        API token for authentication. Obtain from your Infinity account
        settings.

````