> ## 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

> Updates the `metadata` or the `split` of the invoice with the given `id`. You can change `metadata` at any point in the invoice's lifecycle, including after it is paid or voided. When `metadata` is provided, it replaces the entire existing metadata object. If you omit it, the invoice keeps its current metadata. You can change `split` only while the invoice is in `draft` status. Changing `split` replaces the current rules as a whole, including the rules the invoice inherited from its subscription. The invoice must belong to your organization and to the `live` or `test` mode of the API key used.



## OpenAPI

````yaml reference/main-api.json PATCH /v2/invoices/{id}
openapi: 3.1.0
info:
  title: fintoc-api
  version: v2026-02-01
servers:
  - url: https://api.fintoc.com
security: []
paths:
  /v2/invoices/{id}:
    patch:
      tags:
        - Invoices
      summary: Update an invoice
      description: >-
        Updates the `metadata` or the `split` of the invoice with the given
        `id`. You can change `metadata` at any point in the invoice's lifecycle,
        including after it is paid or voided. When `metadata` is provided, it
        replaces the entire existing metadata object. If you omit it, the
        invoice keeps its current metadata. You can change `split` only while
        the invoice is in `draft` status. Changing `split` replaces the current
        rules as a whole, including the rules the invoice inherited from its
        subscription. The invoice must belong to your organization and to the
        `live` or `test` mode of the API key used.
      operationId: v2.invoices-update
      parameters:
        - name: id
          in: path
          description: Unique identifier of the invoice to update.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                metadata:
                  type: object
                  example:
                    order_id: '1234'
                  description: >-
                    Set of key-value pairs to attach to the invoice, useful for
                    storing additional structured information. Up to 50 keys,
                    with key names up to 40 characters and string values up to
                    500 characters. Sending `metadata` replaces the entire
                    existing object.
                split:
                  type: array
                  description: >-
                    Rules for dividing the payment of the invoice between
                    entities. Replaces the current rules as a whole, so send
                    every entry you want to keep. Only for invoices in `draft`
                    status. Available for organizations with splits enabled.
                    Provide 1 to 10 entries. All entries must use the same
                    `type`. Each `entity_id` can appear only once, and at least
                    one entry must pay the processing fee. For `flat` splits,
                    amounts must add up to the invoice `total`. For `percentage`
                    splits, amounts must add up to `10000` basis points (100%).
                  items:
                    type: object
                    properties:
                      amount:
                        type: integer
                        description: >-
                          Portion of the payment the entity receives. For `flat`
                          splits, use an amount in the smallest unit of the
                          invoice's `currency`. For `percentage` splits, use
                          basis points: `10000` means 100%, and `2550` means
                          25.50%. Must be greater than 0.
                        example: 60000
                      charge_processing_fee:
                        type: boolean
                        description: >-
                          If `true`, the entity pays part of the Fintoc
                          processing fee, based on the entry's share of the
                          total `amount` among entries that set
                          `charge_processing_fee` to `true`. Fintoc deducts that
                          part from the entity's disbursement, and the split
                          amounts do not change. At least one entry must set
                          `charge_processing_fee` to `true`. For `percentage`
                          splits, the first entry that pays the fee also
                          receives the rounding remainder. Defaults to `false`.
                        example: true
                      entity_id:
                        type: string
                        description: >-
                          Unique identifier of the entity that receives this
                          portion of the payment. The entity must have completed
                          splits onboarding, and the entity's country must match
                          the country for the invoice's `currency`.
                        example: ent_xK9mPq2RkV3WnDQG
                      metadata:
                        type: object
                        description: Set of key-value pairs to attach to the split entry.
                      type:
                        type: string
                        enum:
                          - flat
                          - percentage
                        description: >-
                          Unit used to express `amount`. One of `flat` (fixed
                          amount in the smallest unit of the invoice's
                          `currency`) or `percentage` (basis points).
                        example: flat
                    required:
                      - amount
                      - entity_id
                      - type
            examples:
              update_invoice:
                summary: Update the metadata of an invoice
                value:
                  metadata:
                    order_id: '1234'
              update_invoice_split:
                summary: Replace the split of a draft invoice
                value:
                  split:
                    - entity_id: ent_6Qd3kZvNxL8r
                      type: flat
                      amount: 25000
                      charge_processing_fee: true
                    - entity_id: ent_4Pq7sLwXy2Nc
                      type: flat
                      amount: 5000
      responses:
        '200':
          description: >-
            The updated invoice, including its line items and payments. When you
            set `split`, `split` holds the new rules.
          content:
            application/json:
              examples:
                invoice_updated:
                  value:
                    id: inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe
                    object: invoice
                    attempt_count: 0
                    collection_method: charge_automatically
                    created_at: '2026-05-01T12:00:00Z'
                    currency: CLP
                    customer: cus_2bVdWyTnGq4PfLs7DkXjRm0CwIo
                    default_payment_method: pm_2bVdX3StMv9UkQxCIpCoWr5H1Nt
                    hosted_invoice_url: >-
                      https://acme.billing.fintoc.com/invoices/inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe
                    lines:
                      - id: il_2bVdX0PqJs6RhNu9FmZlTo2EyKq
                        object: line_item
                        name: Premium Plan
                        description: A premium plan
                        amount: 30000
                        currency: CLP
                        period_end: '2026-06-01T00:00:00Z'
                        period_start: '2026-05-01T00:00:00Z'
                        quantity: 1
                    metadata:
                      order_id: '1234'
                    mode: live
                    next_payment_attempt_at: null
                    payments: []
                    status: open
                    subscription: sub_2bVdWzKfHr5QgMt8ElYkSn1DxJp
                    total: 30000
                invoice_split_replaced:
                  value:
                    id: inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe
                    object: invoice
                    attempt_count: 0
                    collection_method: charge_automatically
                    created_at: '2026-05-01T12:00:00Z'
                    currency: CLP
                    customer: cus_2bVdWyTnGq4PfLs7DkXjRm0CwIo
                    default_payment_method: pm_2bVdX3StMv9UkQxCIpCoWr5H1Nt
                    hosted_invoice_url: null
                    lines:
                      - id: il_2bVdX0PqJs6RhNu9FmZlTo2EyKq
                        object: line_item
                        name: Premium Plan
                        description: A premium plan
                        amount: 30000
                        currency: CLP
                        period_end: '2026-06-01T00:00:00Z'
                        period_start: '2026-05-01T00:00:00Z'
                        quantity: 1
                    metadata: {}
                    mode: test
                    next_payment_attempt_at: null
                    payments: []
                    split:
                      - entity_id: ent_6Qd3kZvNxL8r
                        type: flat
                        amount: 25000
                        charge_processing_fee: true
                        inherited: false
                        metadata: {}
                      - entity_id: ent_4Pq7sLwXy2Nc
                        type: flat
                        amount: 5000
                        charge_processing_fee: false
                        inherited: false
                        metadata: {}
                    status: draft
                    subscription: sub_2bVdWzKfHr5QgMt8ElYkSn1DxJp
                    total: 30000
              schema:
                $ref: '#/components/schemas/invoice_v2'
        '400':
          description: >-
            The `metadata` violates its format rules, or the `split` is invalid:
            it breaks the split rules, does not add up to the invoice `total`,
            or splits are not available for your organization.
          content:
            application/json:
              examples:
                invalid_metadata:
                  value:
                    error:
                      type: invalid_request_error
                      code: invalid_metadata
                      param: metadata
                      message: Array values not permitted in Metadata
                      doc_url: https://docs.fintoc.com/reference/errors
                split_sum_mismatch:
                  value:
                    error:
                      type: invalid_request_error
                      code: split_sum_mismatch
                      param: split.amount
                      message: >-
                        the sum of the split amounts (90000) must be equal to
                        the invoice amount (100000)
                      doc_url: https://docs.fintoc.com/reference/errors
              schema:
                $ref: '#/components/schemas/error_object_v2'
        '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, or
            belongs to a different mode than the API key.
          content:
            application/json:
              examples:
                invoice_not_found:
                  value:
                    error:
                      type: invalid_request_error
                      code: missing_resource
                      param: id
                      message: 'No such invoice: inv_fake_id'
                      doc_url: https://docs.fintoc.com/reference/errors
              schema:
                $ref: '#/components/schemas/error_object_v2'
        '409':
          description: You can change `split` only while the invoice is in `draft` status.
          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
              schema:
                $ref: '#/components/schemas/error_object_v2'
      security:
        - api_key: []
components:
  schemas:
    invoice_v2:
      type: object
      properties:
        id:
          type:
            - string
            - 'null'
          description: >-
            Unique identifier of the invoice. `null` on the preview invoice
            carried by an `invoice.upcoming` event, since Fintoc has not created
            that invoice yet.
          example: inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe
        object:
          const: invoice
          description: Type of the object. Always `invoice`.
        attempt_count:
          type: integer
          description: >-
            Number of automatic charge attempts Fintoc has made on the invoice.
            `0` until the invoice is finalized and charged for the first time.
          example: 1
        collection_method:
          type: string
          enum:
            - charge_automatically
            - send_invoice
          description: >-
            The way Fintoc collects the invoice. `charge_automatically` means
            Fintoc charges `default_payment_method` once the invoice is
            finalized. `send_invoice` means Fintoc leaves the invoice open for
            you to collect, through `hosted_invoice_url` or outside Fintoc.
            Subscription invoices inherit the collection method when issued and
            keep that collection method even if the subscription changes later.
          example: send_invoice
        created_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            ISO 8601 timestamp of when the invoice was created. `null` on the
            preview invoice carried by an `invoice.upcoming` event, since that
            invoice does not exist yet.
          example: '2026-05-01T12:00:00Z'
        currency:
          type: string
          enum:
            - CLP
            - MXN
          description: >-
            Currency of the invoice, as an ISO 4217 code. Every line item uses
            this currency.
          example: CLP
        customer:
          type: string
          description: '`id` of the customer the invoice bills.'
          example: cus_2bVdWyTnGq4PfLs7DkXjRm0CwIo
        default_payment_method:
          type:
            - string
            - 'null'
          description: >-
            `id` of the payment method Fintoc charges when the invoice is
            finalized. `null` for invoices without one, such as subscription
            invoices.
          example: pm_2c4mDhAbCdEfGhIjKlMnOpQrStu
        external_payment:
          type: boolean
          description: >-
            Whether the invoice was settled with a payment collected outside
            Fintoc. `false` for invoices Fintoc collected, and for invoices that
            are not yet paid.
          example: false
        hosted_invoice_url:
          type:
            - string
            - 'null'
          description: >-
            URL of the hosted invoice page, where your customer can view and pay
            the invoice. `null` for invoices that are not `open`. In `test`
            mode, the URL points to the test mode portal.
          example: >-
            https://acme.billing.fintoc.com/invoices/inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe
        lines:
          type: array
          description: Line items that make up the invoice total.
          items:
            $ref: '#/components/schemas/invoice_line_item'
        metadata:
          type: object
          description: >-
            Set of key-value pairs attached to the invoice. `{}` when the
            invoice has no metadata.
        mode:
          type: string
          enum:
            - live
            - test
          description: >-
            Mode of the invoice. `live` invoices use real data; `test` invoices
            use fake data for integration testing. An API key only sees invoices
            that share its mode.
          example: live
        next_payment_attempt_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            ISO 8601 timestamp of the next scheduled automatic charge attempt.
            `null` when no further attempt is scheduled. Also `null` on the
            preview invoice carried by an `invoice.upcoming` event, where
            `lines[].period_start` marks the charge date.
          example: '2026-05-02T12:00:00Z'
        payments:
          type: array
          description: >-
            Payment attempts to collect the invoice. If a Mexican direct debit
            charge fails validation before reaching the bank, Fintoc adds no
            payment. Examples include an amount out of range, an exceeded limit,
            or an inactive mandate. Fintoc doesn't retry the charge or send
            `invoice.payment_failed`.
          items:
            type: object
            properties:
              amount:
                type: integer
                description: >-
                  Amount of the payment, 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 payment, as an ISO 4217 code. Always matches
                  the invoice currency.
                example: CLP
              payment_intent:
                type: string
                description: '`id` of the payment intent created to collect the invoice.'
                example: pi_2bVdX2RsLu8TjPwBHoBnVq4G0Ms
              status:
                type: string
                enum:
                  - pending
                  - succeeded
                  - failed
                description: Status of the payment attempt.
                example: succeeded
            required:
              - amount
              - currency
              - payment_intent
              - status
        reason:
          type:
            - string
            - 'null'
          enum:
            - split_amount_mismatch
            - null
          description: >-
            Reason the invoice reports `inconsistent`. `split_amount_mismatch`
            means the `flat` split amounts do not add up to `total`, or a
            `percentage` split leaves an entity with no amount, so Fintoc cannot
            finalize the invoice. For every other status, the value is `null`.
          example: null
        split:
          type:
            - array
            - 'null'
          description: >-
            Rules for dividing the payment between entities. The rules come from
            the subscription when the invoice is issued, or from the invoice
            creation request. `null` when the invoice has no split.
          items:
            type: object
            properties:
              amount:
                type: integer
                description: >-
                  Portion of the payment the entity receives. For `flat` splits,
                  an amount in the smallest unit of `currency`. For `percentage`
                  splits, basis points, where `10000` means 100%, so `2550`
                  means 25.50%.
                example: 8500
              charge_processing_fee:
                type: boolean
                description: >-
                  If `true`, the entity pays part of the Fintoc processing fee,
                  based on the entry's share of the total `amount` among entries
                  that set `charge_processing_fee` to `true`. The fee is
                  deducted at disbursement and does not change the split
                  amounts.
                example: true
              entity_id:
                type: string
                description: >-
                  Unique identifier of the entity that receives this portion of
                  the payment.
                example: ent_xK9mPq2RkV3WnDQG
              inherited:
                type: boolean
                description: >-
                  If `true`, the split rule comes from the invoice's
                  subscription. If `false`, you declared the split rule on the
                  invoice, replacing the subscription's rule for this cycle
                  only.
                example: true
              metadata:
                type: object
                description: Set of key-value pairs you attached to the split entry.
              type:
                type: string
                enum:
                  - flat
                  - percentage
                description: >-
                  How `amount` is expressed. `flat` for a fixed amount in the
                  smallest unit of `currency`, or `percentage` for basis points.
                example: percentage
            required:
              - amount
              - charge_processing_fee
              - entity_id
              - inherited
              - metadata
              - type
        split_applied:
          type:
            - array
            - 'null'
          description: >-
            Portion of the latest payment attempt assigned to each entity. A
            redirected portion is credited to `redirected_to_entity_id` instead.
            `null` when the invoice has no split or has not been charged yet.
          items:
            type: object
            properties:
              calculated_amount:
                type: integer
                description: >-
                  Amount of this portion, in the smallest unit of `currency`.
                  Fintoc credits the portion to `entity_id`, or to
                  `redirected_to_entity_id` when `redirected` is `true`. For
                  `percentage` splits, the amount is calculated from the split's
                  basis points, and any rounding remainder goes to the first
                  entity with `charge_processing_fee` set to `true`.
                example: 25500
              charge_processing_fee:
                type: boolean
                description: >-
                  If `true`, the entity credited with this portion pays part of
                  the Fintoc processing fee, based on the entry's share of the
                  total `calculated_amount` among entries that set
                  `charge_processing_fee` to `true`. The fee is deducted at
                  disbursement and is not deducted from `calculated_amount`.
                example: true
              entity_id:
                type: string
                description: >-
                  Unique identifier of the entity you assigned this portion to.
                  When `redirected` is `true`, Fintoc credited the portion to
                  `redirected_to_entity_id` instead.
                example: ent_xK9mPq2RkV3WnDQG
              redirected:
                type: boolean
                description: >-
                  If `true`, Fintoc credited this portion to your organization's
                  root entity instead of `entity_id`. See `redirection_reason`
                  for why Fintoc redirected the portion. The amount does not
                  change.
                example: false
              redirected_to_entity_id:
                type:
                  - string
                  - 'null'
                description: >-
                  Unique identifier of the entity that received the portion
                  instead of `entity_id`. `null` unless `redirected` is `true`.
              redirection_reason:
                type:
                  - string
                  - 'null'
                enum:
                  - not_operational
                  - not_found
                  - null
                description: >-
                  Reason Fintoc redirected the portion. `not_operational` when
                  the entity has not completed its splits onboarding or is
                  paused, and `not_found` when the entity no longer exists.
                  `null` unless `redirected` is `true`.
            required:
              - calculated_amount
              - charge_processing_fee
              - entity_id
              - redirected
              - redirected_to_entity_id
              - redirection_reason
        status:
          type: string
          enum:
            - draft
            - open
            - paid
            - void
            - uncollectible
            - inconsistent
          description: >-
            Status of the invoice. Invoices start as `draft`, become `open` when
            finalized, and end as `paid`, `void`, or `uncollectible`. An
            `uncollectible` invoice is no longer expected to be paid. A draft
            whose `split` can no longer be applied to `total` reports
            `inconsistent` until you update `split` or `lines`. The `reason`
            field explains why. The preview invoice carried by an
            `invoice.upcoming` event reports `draft` and never appears when you
            list invoices.
          example: draft
        subscription:
          type:
            - string
            - 'null'
          description: >-
            `id` of the subscription the invoice belongs to. `null` for invoices
            not tied to a subscription.
          example: sub_2bVdWzKfHr5QgMt8ElYkSn1DxJp
        total:
          type: integer
          description: >-
            Total amount of the invoice, in the smallest unit of `currency` (for
            example, `30000` for $30000 CLP, since CLP has no minor unit, or
            `3000` for $30.00 MXN). Equals the sum of the line item amounts.
          example: 30000
      required:
        - id
        - hosted_invoice_url
        - object
        - attempt_count
        - collection_method
        - created_at
        - currency
        - customer
        - default_payment_method
        - external_payment
        - lines
        - metadata
        - mode
        - next_payment_attempt_at
        - payments
        - split
        - split_applied
        - status
        - reason
        - subscription
        - total
    error_object_v2:
      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
    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
    invoice_line_item:
      type: object
      properties:
        id:
          type:
            - string
            - 'null'
          description: >-
            Unique identifier of the line item. `null` on line items carried by
            an `invoice.upcoming` event, since the invoice they belong to does
            not exist yet.
          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'
          maxLength: 200
          description: >-
            Additional details about the line item shown on the invoice. Up to
            200 characters. `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
  securitySchemes:
    api_key:
      type: apiKey
      name: Authorization
      in: header

````