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

# Update an invoice line item

> Updates a line item of a draft invoice and recalculates the invoice total. All body fields are optional; send only the fields you want to change. The invoice must be in `draft` status and any new currency must match the invoice currency.

**`v2`** · Base URL `https://api.fintoc.com/v2`


## OpenAPI

````yaml reference/fintoc-api-v2.json PATCH /invoices/{invoice_id}/lines/{id}
openapi: 3.1.0
info:
  title: fintoc-api-v2
  version: v2026-02-01
servers:
  - url: https://api.fintoc.com/v2
security: []
paths:
  /invoices/{invoice_id}/lines/{id}:
    patch:
      tags:
        - Invoices
      summary: Update an invoice line item
      description: >-
        Updates a line item of a draft invoice and recalculates the invoice
        total. All body fields are optional; send only the fields you want to
        change. The invoice must be in `draft` status and any new currency must
        match the invoice currency.
      operationId: invoice-lines-update
      parameters:
        - name: invoice_id
          in: path
          description: The `id` of the invoice the line item belongs to.
          required: true
          schema:
            type: string
        - name: id
          in: path
          description: The `id` of the line item to update.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: integer
                  example: 80000
                  description: >-
                    New amount of the line item, in the smallest unit of
                    `currency` (for example, `30000` for $30000 CLP, since CLP
                    has no minor unit, or `3000` for $30.00 MXN). Must be
                    greater than 0.
                currency:
                  type: string
                  enum:
                    - CLP
                    - MXN
                  example: CLP
                  description: >-
                    New currency of the line item, as an ISO 4217 code. Must
                    match the invoice currency.
                period_end:
                  type: string
                  format: date-time
                  example: '2026-06-01T00:00:00Z'
                  description: >-
                    New ISO 8601 timestamp marking the end of the billing period
                    covered by the line item. Must remain after `period_start`.
                period_start:
                  type: string
                  format: date-time
                  example: '2026-05-01T00:00:00Z'
                  description: >-
                    New ISO 8601 timestamp marking the start of the billing
                    period covered by the line item.
                quantity:
                  type: integer
                  example: 2
                  description: >-
                    New number of units billed by the line item. Must be greater
                    than 0.
                name:
                  type: string
                  example: Premium Plan
                  description: New display name for the line item shown on the invoice.
                description:
                  type: string
                  example: A premium plan
                  description: >-
                    New additional details about the line item shown on the
                    invoice.
            examples:
              update_line_item:
                summary: Update amount and quantity
                value:
                  amount: 80000
                  quantity: 2
      responses:
        '200':
          description: >-
            The updated line item. The invoice total already reflects the new
            amount.
          content:
            application/json:
              examples:
                line_item_updated:
                  value:
                    id: il_2bVdX0PqJs6RhNu9FmZlTo2EyKq
                    object: line_item
                    name: Premium Plan
                    description: A premium plan
                    amount: 80000
                    currency: CLP
                    period_end: '2026-06-01T00:00:00Z'
                    period_start: '2026-05-01T00:00:00Z'
                    quantity: 2
              schema:
                $ref: '#/components/schemas/invoice_line_item'
        '400':
          description: >-
            Invalid request. One of the following is true: `amount` or
            `quantity` is not a positive integer; `currency` is unknown or does
            not match the invoice currency; a date is malformed; or the
            requested `period_end` is before the requested `period_start`.
          content:
            application/json:
              examples:
                invalid_currency:
                  value:
                    error:
                      type: invalid_request_error
                      code: invalid_currency
                      message: 'Invalid currency: XYZ'
                invalid_period:
                  value:
                    error:
                      type: invalid_request_error
                      code: invalid_period
                      message: period_end must be greater than period_start
              schema:
                $ref: '#/components/schemas/error_object'
        '401':
          description: Invalid or missing API key.
          content:
            application/json:
              examples:
                invalid_api_key:
                  value:
                    error:
                      type: authentication_error
                      code: invalid_api_key
                      message: 'Invalid API Key: invalid-*oken'
              schema:
                $ref: '#/components/schemas/error_object'
        '404':
          description: >-
            The invoice does not exist, belongs to another organization, belongs
            to a different mode than the API key, or the line item does not
            belong to the invoice.
          content:
            application/json:
              examples:
                line_item_not_found:
                  value:
                    error:
                      type: invalid_request_error
                      code: missing_resource
                      param: id
                      message: 'No such invoicing/invoice_line_item: il_fake'
                      doc_url: https://docs.fintoc.com/reference/errors
              schema:
                $ref: '#/components/schemas/error_object'
        '409':
          description: >-
            The line item cannot be updated: the invoice is not in `draft`
            status, or a partial update would leave `period_end` before
            `period_start`.
          content:
            application/json:
              examples:
                invoice_not_editable:
                  value:
                    error:
                      type: invalid_request_error
                      code: invoice_not_editable
                      message: Invoice may only be edited when in draft status
                invalid_resulting_period:
                  value:
                    error:
                      type: invalid_request_error
                      code: invalid_period
                      message: period_end must be greater than period_start
              schema:
                $ref: '#/components/schemas/error_object'
      security:
        - api_key: []
components:
  schemas:
    invoice_line_item:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the line item.
          example: il_2bVdX0PqJs6RhNu9FmZlTo2EyKq
        object:
          const: line_item
          description: Type of the object. Always `line_item`.
        amount:
          type: integer
          description: >-
            Amount of the line item, in the smallest unit of `currency` (for
            example, `30000` for $30000 CLP, since CLP has no minor unit, or
            `3000` for $30.00 MXN).
          example: 30000
        currency:
          type: string
          enum:
            - CLP
            - MXN
          description: >-
            Currency of the line item, as an ISO 4217 code. Always matches the
            invoice currency.
          example: CLP
        description:
          type:
            - string
            - 'null'
          description: >-
            Additional details about the line item shown on the invoice. `null`
            when the line item has no description.
          example: A premium plan
        name:
          type: string
          description: Display name for the line item shown on the invoice.
          example: Premium Plan
        period_end:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            ISO 8601 datetime in UTC marking the end of the billing period
            covered by the line item. `null` for line items on invoices not tied
            to a subscription.
          example: '2026-06-01T00:00:00Z'
        period_start:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            ISO 8601 datetime in UTC marking the start of the billing period
            covered by the line item. `null` for line items on invoices not tied
            to a subscription.
          example: '2026-05-01T00:00:00Z'
        quantity:
          type: integer
          description: Number of units billed by the line item.
          example: 1
      required:
        - id
        - object
        - name
        - description
        - amount
        - currency
        - period_end
        - period_start
        - quantity
    error_object:
      type: object
      properties:
        error:
          type: object
          description: Details of the error that caused the request to fail.
          properties:
            code:
              type: string
              description: >-
                Machine-readable code identifying the specific error, for
                example `invalid_api_key`. Not returned by every error.
              example: invalid_api_key
            doc_url:
              type: string
              description: >-
                URL of a documentation page with more details about the error.
                Not returned by every error.
              example: https://docs.fintoc.com/reference/errors
            message:
              type: string
              description: Human-readable message describing the error.
              example: 'Invalid API Key: invalid-*oken'
            param:
              type:
                - string
                - 'null'
              description: >-
                Name of the request parameter that caused the error. `null` when
                the error cannot be tied to a single parameter, and not returned
                by every error.
              example: amount
            type:
              type: string
              description: >-
                Category of the error, for example `invalid_request_error`,
                `authentication_error`, or `api_error`.
              example: invalid_request_error
          required:
            - type
            - message
  securitySchemes:
    api_key:
      type: apiKey
      name: Authorization
      in: header

````