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

# Update an invoice

> Patches descriptive metadata on an existing invoice (description, purchase order number). Line items are managed through the dedicated line item endpoints.



## OpenAPI

````yaml /api-reference/v2/specs/2026-04-01.json patch /invoices/{id}
openapi: 3.1.0
info:
  title: Alguna Public API
  version: '2026-04-01'
servers:
  - url: https://api.alguna.io
security:
  - bearerAuth: []
tags:
  - name: Billing Events and Metrics
  - name: Credit Notes
  - name: Credits
  - name: Customer Portal Sessions
  - name: Customers
  - name: Insights
  - name: Invoices
  - name: Payments
  - name: Plans
  - name: Product Bundles
  - name: Products
  - name: Refunds
  - name: Revenue Schedules
  - name: Subscription Changes
  - name: Subscription Versions
  - name: Subscriptions
  - name: Wallet Grants
  - name: Wallets
paths:
  /invoices/{id}:
    patch:
      tags:
        - Invoices
      summary: Update an invoice
      description: >-
        Patches descriptive metadata on an existing invoice (description,
        purchase order number). Line items are managed through the dedicated
        line item endpoints.
      operationId: update-invoice
      parameters:
        - in: header
          name: Alguna-Version
          required: true
          schema:
            enum:
              - '2026-04-01'
            type: string
        - in: header
          name: Idempotency-Key
          schema:
            description: >-
              A unique string used to ensure the request is processed exactly
              once. If you retry a request with the same idempotency key within
              24 hours, the original response is returned without re-executing
              the operation.
            example: ik_a1b2c3d4e5f6
            maxLength: 255
            type: string
        - in: path
          name: id
          required: true
          schema:
            description: Unique identifier for the invoice
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateInvoiceRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceResponse'
          description: Success
          headers:
            Idempotency-Key:
              description: Echo of the idempotency key provided in the request
              schema:
                type: string
            Idempotent-Replayed:
              description: >-
                Whether this response was replayed from a previous request
                (true) or freshly executed (false)
              schema:
                type: boolean
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: >-
            Conflict — a request with this idempotency key is currently being
            processed
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
components:
  schemas:
    UpdateInvoiceRequest:
      properties:
        description:
          description: Invoice description or memo
          nullable: true
          type: string
        purchase_order_number:
          description: Purchase order number
          nullable: true
          type: string
      type: object
    InvoiceResponse:
      properties:
        amount_paid:
          description: Amount that has been paid
          example: '0.00'
          type: string
        amount_remaining:
          description: Remaining amount due
          example: '110.00'
          type: string
        billing_period:
          description: Formatted billing period string
          type: string
        billing_period_end:
          description: End of the billing period
          format: date-time
          nullable: true
          type: string
        billing_period_start:
          description: Start of the billing period
          format: date-time
          nullable: true
          type: string
        created_at:
          description: Timestamp when the invoice was created
          format: date-time
          type: string
        currency:
          description: ISO 4217 currency code
          example: USD
          type: string
        customer_id:
          description: Customer this invoice belongs to
          type: string
        description:
          description: Invoice description or memo
          type: string
        due_date:
          description: Date the invoice payment is due
          format: date-time
          nullable: true
          type: string
        external_id:
          description: Identifier in the external payment provider
          type: string
        external_provider:
          description: External payment provider name
          type: string
        external_reference:
          description: Customer-facing invoice reference number
          type: string
        external_url:
          description: URL to the invoice in the external system
          type: string
        id:
          description: Unique identifier for the invoice
          type: string
        invoicing_date:
          description: Date the invoice is scheduled for processing
          format: date-time
          nullable: true
          type: string
        issue_date:
          description: Date the invoice was issued
          format: date-time
          nullable: true
          type: string
        line_items:
          description: Line items on this invoice
          items:
            $ref: '#/components/schemas/LineItemResponse'
          type: array
        paid_date:
          description: Date the invoice was paid
          format: date-time
          nullable: true
          type: string
        purchase_order_number:
          description: Purchase order number
          nullable: true
          type: string
        status:
          description: Current status of the invoice
          enum:
            - draft
            - upcoming
            - pending_approval
            - scheduled
            - processing
            - issued
            - void
            - paid
            - canceled
            - overdue
          type: string
        subtotal:
          description: Sum of all line item totals before tax
          example: '100.00'
          type: string
        tax:
          description: Total tax amount
          example: '10.00'
          type: string
        total:
          description: Total amount including tax
          example: '110.00'
          type: string
        updated_at:
          description: Timestamp when the invoice was last updated
          format: date-time
          type: string
      required:
        - amount_paid
        - amount_remaining
        - billing_period
        - created_at
        - currency
        - customer_id
        - description
        - id
        - line_items
        - status
        - subtotal
        - tax
        - total
        - updated_at
      type: object
    ErrorResponse:
      properties:
        detail:
          type: string
        status:
          format: int64
          type: integer
      required:
        - status
        - detail
      type: object
    LineItemResponse:
      properties:
        billing_period_end:
          description: End of the billing period for this line item
          format: date-time
          nullable: true
          type: string
        billing_period_start:
          description: Start of the billing period for this line item
          format: date-time
          nullable: true
          type: string
        description:
          description: Description of the line item
          type: string
        id:
          description: Unique identifier for the line item
          type: string
        is_editable:
          description: Whether this line item can be manually edited
          type: boolean
        product_id:
          description: Associated product identifier
          nullable: true
          type: string
        quantity:
          description: Quantity of the line item
          example: '1'
          type: string
        total_price:
          description: Total price before tax (quantity x unit price)
          example: '100.00'
          type: string
        unit_price:
          description: Unit price of the line item
          example: '100.00'
          type: string
      required:
        - description
        - id
        - is_editable
        - quantity
        - total_price
        - unit_price
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: API Key
      description: API key authentication. Pass your API key as a Bearer token.
      scheme: bearer
      type: http

````