Skip to content

Update

client.invoices.update(stringid, InvoiceUpdateParams { current_invoice_version, line_items, tags } body, RequestOptionsoptions?): InvoiceUpdateResponse { data }
PATCH/invoices/{id}

Updates an invoice

ParametersExpand Collapse
id: string

Invoice ID

body: InvoiceUpdateParams { current_invoice_version, line_items, tags }
current_invoice_version: number

The current version of the invoice. Must match the stored version for the update to succeed (optimistic concurrency).

line_items?: LineItems
create?: Array<Create>

Line items to add to the invoice

description: string

Description of the line item

product_id: string

ID of the product/catalog item

type: "payin" | "payout"

The type of the line item

Accepts one of the following:
"payin"
"payout"
user: ID { id } | ExternalID { external_id }

Identifies a user by Fragment-generated id or external_id (request body).

Accepts one of the following:
ID { id }
id: string

FRAGMENT generated ID of the user

ExternalID { external_id }
external_id: string

External ID of the user

Deprecatedamount?: string

Deprecated: use price instead. Total amount in smallest currency unit.

currency_code?: "ADA" | "BTC" | "DAI" | 176 more

Currency code (ISO 4217 or crypto)

Accepts one of the following:
"ADA"
"BTC"
"DAI"
"ETH"
"SOL"
"USDC"
"USDT"
"USDG"
"EURC"
"CADC"
"CADT"
"XLM"
"UNI"
"BCH"
"LTC"
"AAVE"
"LINK"
"MATIC"
"PTS"
"AED"
"AFN"
"ALL"
"AMD"
"ANG"
"AOA"
"ARS"
"AUD"
"AWG"
"AZN"
"BAM"
"BBD"
"BDT"
"BGN"
"BHD"
"BIF"
"BMD"
"BND"
"BOB"
"BRL"
"BSD"
"BTN"
"BWP"
"BYR"
"BZD"
"CAD"
"CDF"
"CHF"
"CLP"
"CNY"
"COP"
"CRC"
"CUC"
"CUP"
"CVE"
"CZK"
"DJF"
"DKK"
"DOP"
"DZD"
"EGP"
"ERN"
"ETB"
"EUR"
"FJD"
"FKP"
"GBP"
"GEL"
"GGP"
"GHS"
"GIP"
"GMD"
"GNF"
"GTQ"
"GYD"
"HKD"
"HNL"
"HRK"
"HTG"
"HUF"
"IDR"
"ILS"
"IMP"
"INR"
"IQD"
"IRR"
"ISK"
"JMD"
"JOD"
"JPY"
"KES"
"KGS"
"KHR"
"KMF"
"KPW"
"KRW"
"KWD"
"KYD"
"KZT"
"LAK"
"LBP"
"LKR"
"LRD"
"LSL"
"LYD"
"MAD"
"MDL"
"MGA"
"MKD"
"MMK"
"MNT"
"MOP"
"MUR"
"MVR"
"MWK"
"MXN"
"MYR"
"MZN"
"NAD"
"NGN"
"NIO"
"NOK"
"NPR"
"NZD"
"OMR"
"PAB"
"PEN"
"PGK"
"PHP"
"PKR"
"PLN"
"PYG"
"QAR"
"RON"
"RSD"
"RUB"
"RWF"
"SAR"
"SBD"
"SCR"
"SDG"
"SEK"
"SGD"
"SHP"
"SLL"
"SOS"
"SPL"
"SRD"
"SVC"
"SYP"
"STN"
"SZL"
"THB"
"TJS"
"TMT"
"TND"
"TOP"
"TRY"
"TTD"
"TVD"
"TWD"
"TZS"
"UAH"
"UGX"
"USD"
"UYU"
"UZS"
"VEF"
"VND"
"VUV"
"WST"
"XAF"
"XCD"
"XOF"
"XPF"
"YER"
"ZAR"
"ZMW"
"LOGICAL"
"CUSTOM"
price?: Price { amount, quantity, unit_price }

Price breakdown. Provide amount, or unit_price + quantity, or all three.

amount?: string

Total amount in smallest currency unit. Required if unit_price and quantity are not provided.

quantity?: number

Number of units for this line item.

minimum1
unit_price?: string

Price per unit in smallest currency unit.

tags?: Array<Tag>

Optional metadata tags for this line item

key: string

Tag key. Must be a valid safe string (no special characters like #, /, :). Max 50 characters.

value: string

Tag value. Must be a valid safe string (no special characters like #, /, :). Max 200 characters.

delete?: Array<Delete>

Line items to remove from the invoice

id: string

ID of the line item to delete

update?: Array<Update>

Existing line items to update

id: string

ID of the line item to update

description?: string
price?: Price { quantity, unit_price, amount }
quantity: number

Number of units for this line item.

minimum1
unit_price: string

Price per unit in smallest currency unit.

amount?: string

Total amount in smallest currency unit.

tags?: Tags { create, delete, set, update }
create?: Array<Create>

Tags to add. Prefer set unless you specifically want create-only validation.

key: string

Tag key. Must be a valid safe string (no special characters like #, /, :). Max 50 characters.

value: string

Tag value. Must be a valid safe string (no special characters like #, /, :). Max 200 characters.

delete?: Array<Delete>

Tags to remove by key

key: string

Tag key to delete

set?: Array<Set>

Tags to create or overwrite without requiring the caller to distinguish between create and update.

key: string

Tag key. Must be a valid safe string (no special characters like #, /, :). Max 50 characters.

value: string

Tag value. Must be a valid safe string (no special characters like #, /, :). Max 200 characters.

update?: Array<Update>

Tags to update. The key identifies the existing tag; the value is the new value. Prefer set unless you specifically want update-only validation.

key: string

Tag key. Must be a valid safe string (no special characters like #, /, :). Max 50 characters.

value: string

Tag value. Must be a valid safe string (no special characters like #, /, :). Max 200 characters.

tags?: Tags
create?: Array<Create>

Tags to add. Prefer set unless you specifically want create-only validation.

key: string

Tag key. Must be a valid safe string (no special characters like #, /, :). Max 50 characters.

value: string

Tag value. Must be a valid safe string (no special characters like #, /, :). Max 200 characters.

delete?: Array<Delete>

Tags to remove by key

key: string

Tag key to delete

set?: Array<Set>

Tags to create or overwrite without requiring the caller to distinguish between create and update.

key: string

Tag key. Must be a valid safe string (no special characters like #, /, :). Max 50 characters.

value: string

Tag value. Must be a valid safe string (no special characters like #, /, :). Max 200 characters.

update?: Array<Update>

Tags to update. The key identifies the existing tag; the value is the new value. Prefer set unless you specifically want update-only validation.

key: string

Tag key. Must be a valid safe string (no special characters like #, /, :). Max 50 characters.

value: string

Tag value. Must be a valid safe string (no special characters like #, /, :). Max 200 characters.

ReturnsExpand Collapse
InvoiceUpdateResponse { data }
data: Invoice { id, created, status, 5 more }

Invoice object

id: string

Unique identifier for the invoice

created: string

ISO 8601 timestamp when the invoice was created

formatdate-time
Deprecatedstatus: "active"

Deprecated: The status of the invoice

tags: Array<Tag>

Metadata tags for this invoice

key: string

Tag key

value: string

Tag value

version: number

The current version of the invoice. Pass this value when updating to ensure thread safety.

workspace_id: string

Workspace ID this invoice belongs to

line_items?: Array<LineItem>

List of line items associated with this invoice

id: string

Unique identifier for the line item

Deprecatedamount: string

Deprecated: use price.amount instead. Total amount in smallest currency unit (represented as string for bigint)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UGX"
"USD"
"UYU"
"UZS"
"VEF"
"VND"
"VUV"
"WST"
"XAF"
"XCD"
"XOF"
"XPF"
"YER"
"ZAR"
"ZMW"
"LOGICAL"
"CUSTOM"
description: string

Description of the line item

price: Price { amount, quantity, unit_price }

Price breakdown containing amount, unit price, and quantity

amount: string

Total amount in smallest currency unit (represented as string for bigint)

quantity: number

Quantity of units for this line item

unit_price: string

Unit price in smallest currency unit (represented as string for bigint)

product_id: string

ID of the product/catalog item

tags: Array<Tag>

Metadata tags for this line item

key: string

Tag key

value: string

Tag value

type: "payin" | "payout"

The type of the line item

Accepts one of the following:
"payin"
"payout"
user_id: string

External ID of the user associated with this line item

modified?: string

ISO 8601 timestamp when the invoice was last modified

formatdate-time

Update

import Fragment from '@fragment-dev/ts-node';

const client = new Fragment();

const invoice = await client.invoices.update('inv_1234567890', { current_invoice_version: 3 });

console.log(invoice.data);
{
  "data": {
    "id": "inv_1234567890",
    "created": "2024-01-13T00:00:00Z",
    "status": "active",
    "tags": [
      {
        "key": "region",
        "value": "us-east"
      }
    ],
    "version": 1,
    "workspace_id": "ws_1234567890",
    "line_items": [
      {
        "id": "item_1234567890",
        "amount": "1000",
        "currency_code": "USD",
        "description": "Professional services for January 2026",
        "price": {
          "amount": "1000",
          "quantity": 1,
          "unit_price": "1000"
        },
        "product_id": "prod_1234567890",
        "tags": [
          {
            "key": "region",
            "value": "us-east"
          }
        ],
        "type": "payout",
        "user_id": "user_ext_456"
      }
    ],
    "modified": "2024-01-13T00:00:00Z"
  }
}
Returns Examples
{
  "data": {
    "id": "inv_1234567890",
    "created": "2024-01-13T00:00:00Z",
    "status": "active",
    "tags": [
      {
        "key": "region",
        "value": "us-east"
      }
    ],
    "version": 1,
    "workspace_id": "ws_1234567890",
    "line_items": [
      {
        "id": "item_1234567890",
        "amount": "1000",
        "currency_code": "USD",
        "description": "Professional services for January 2026",
        "price": {
          "amount": "1000",
          "quantity": 1,
          "unit_price": "1000"
        },
        "product_id": "prod_1234567890",
        "tags": [
          {
            "key": "region",
            "value": "us-east"
          }
        ],
        "type": "payout",
        "user_id": "user_ext_456"
      }
    ],
    "modified": "2024-01-13T00:00:00Z"
  }
}