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

# Update an invoice item

> Updates the amount and description of a pending item. An item already drained onto an invoice cannot be updated.



## OpenAPI

````yaml /openapi/invoices.yaml post /invoice_items/{id}
openapi: 3.0.3
info:
  title: Ionic Invoices API
  version: '2026-05-30'
  description: |
    Invoices and invoice items.

    An invoice item is a pending charge recorded against a customer. When an
    invoice is created for that customer, every pending item in the invoice
    currency is drained onto the new draft as a line. A draft can be edited
    freely; finalizing it assigns a gapless, per-merchant/mode sequential number
    (for example `INV-000001`), applies tax, freezes the lines, and opens the
    invoice. Drafts carry no number, so an abandoned draft never consumes one
    and the finalized sequence is always contiguous.

    All monetary amounts are integers in the currency's minor unit (for example
    cents for USD). Timestamps are Unix epoch seconds. Identifiers are opaque,
    prefixed strings: invoices are `inv_…`, invoice items `ii_…`, and invoice
    lines `il_…`.

    Authentication uses a merchant secret key as a bearer token. Read endpoints
    require the `invoices:read` permission; write endpoints require
    `invoices:write`. The mode of the key (test or live) scopes which invoices
    and invoice items it can see, mutate, and drain. Live invoice numbers use
    `INV-000001` style labels; test invoice numbers use `TEST-INV-000001`.
    Mutating endpoints accept an optional `Idempotency-Key` header.

    Errors are returned as `{ "error": { "code": "...", "message": "..." } }`.
    A malformed path identifier returns 400. Concurrent updates are retried
    automatically; if they still conflict, the API returns 409 and the request
    can be retried.
servers:
  - url: '{baseUrl}/v1'
    variables:
      baseUrl:
        default: https://api.ionicfi.com
        description: API base URL for your environment.
security:
  - secretKey: []
tags:
  - name: Invoices
    description: Create, finalize, and manage invoices.
  - name: Invoice Items
    description: Pending charges that drain onto a customer's next invoice.
paths:
  /invoice_items/{id}:
    parameters:
      - $ref: '#/components/parameters/InvoiceItemId'
    post:
      tags:
        - Invoice Items
      summary: Update an invoice item
      description: >-
        Updates the amount and description of a pending item. An item already
        drained onto an invoice cannot be updated.
      operationId: invoices_items_update
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateInvoiceItemRequest'
      responses:
        '200':
          description: The updated invoice item.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceItem'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/InvoiceItemNotFound'
        '409':
          $ref: '#/components/responses/ItemNotPending'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - secretKey:
            - invoices:write
components:
  parameters:
    InvoiceItemId:
      name: id
      in: path
      required: true
      description: The invoice item id (`ii_…`).
      schema:
        type: string
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        A unique key that makes retries safe: the same key with the same request
        body returns the original response instead of repeating the operation.
      schema:
        type: string
        maxLength: 255
  schemas:
    UpdateInvoiceItemRequest:
      type: object
      required:
        - amount
        - description
      properties:
        amount:
          type: integer
          description: New total amount in minor units, in the item's existing currency.
        description:
          type: string
    InvoiceItem:
      type: object
      required:
        - amount
        - created_at
        - currency
        - customer
        - description
        - id
        - invoice
        - metadata
        - object
        - pending
        - quantity
        - unit_amount
        - updated_at
      properties:
        id:
          type: string
        object:
          type: string
          enum:
            - invoice_item
        customer:
          type: string
        description:
          type: string
        quantity:
          type: integer
        unit_amount:
          type: integer
        amount:
          type: integer
          description: Total amount in minor units.
        currency:
          type: string
        invoice:
          type: string
          nullable: true
          description: The invoice this item was drained onto, or null while pending.
        price:
          type: string
          nullable: true
        pending:
          type: boolean
        metadata:
          type: object
          additionalProperties:
            type: string
        created_at:
          type: integer
          description: Unix epoch seconds.
        updated_at:
          type: integer
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: A stable, machine-readable error code.
            message:
              type: string
  responses:
    BadRequest:
      description: The request was malformed or failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: INVALID_DATA
              message: invalid currency
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The key lacks the required permission, or the merchant is not active.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InvoiceItemNotFound:
      description: No invoice item with that id is visible to this key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: INVOICE_ITEM_NOT_FOUND
              message: invoice item not found
    ItemNotPending:
      description: The invoice item is already assigned to an invoice.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: INVOICE_ITEM_NOT_PENDING
              message: invoice item is already assigned to an invoice
    RateLimited:
      description: Too many requests. Honour the `Retry-After` header before retrying.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: |
        The API could not return a successful response. For a mutating request,
        retrieve the resource before retrying because the operation may have
        completed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    secretKey:
      type: http
      scheme: bearer
      description: 'A merchant secret key (`sk_…`) sent as `Authorization: Bearer <key>`.'

````