Skip to content

Update

invoices.update(strid, InvoiceUpdateParams**kwargs) -> InvoiceUpdateResponse
PATCH/invoices/{id}

Updates an invoice

ParametersExpand Collapse
id: str

Invoice ID

current_invoice_version: float

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

line_items: Optional[LineItems]
create: Optional[Iterable[LineItemsCreate]]

Line items to add to the invoice

description: str

Description of the line item

product_id: str

ID of the product/catalog item

type: Literal["payin", "payout"]

The type of the line item

Accepts one of the following:
"payin"
"payout"
user: LineItemsCreateUser

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

Accepts one of the following:
class LineItemsCreateUserID:
id: str

FRAGMENT generated ID of the user

class LineItemsCreateUserExternalID:
external_id: str

External ID of the user

Deprecatedamount: Optional[str]

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

currency_code: Optional[Literal["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: Optional[LineItemsCreatePrice]

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

amount: Optional[str]

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

quantity: Optional[int]

Number of units for this line item.

minimum1
unit_price: Optional[str]

Price per unit in smallest currency unit.

tags: Optional[Iterable[LineItemsCreateTag]]

Optional metadata tags for this line item

key: str

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

value: str

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

delete: Optional[Iterable[LineItemsDelete]]

Line items to remove from the invoice

id: str

ID of the line item to delete

update: Optional[Iterable[LineItemsUpdate]]

Existing line items to update

id: str

ID of the line item to update

description: Optional[str]
price: Optional[LineItemsUpdatePrice]
quantity: int

Number of units for this line item.

minimum1
unit_price: str

Price per unit in smallest currency unit.

amount: Optional[str]

Total amount in smallest currency unit.

tags: Optional[LineItemsUpdateTags]
create: Optional[Iterable[LineItemsUpdateTagsCreate]]

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

key: str

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

value: str

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

delete: Optional[Iterable[LineItemsUpdateTagsDelete]]

Tags to remove by key

key: str

Tag key to delete

set: Optional[Iterable[LineItemsUpdateTagsSet]]

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

key: str

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

value: str

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

update: Optional[Iterable[LineItemsUpdateTagsUpdate]]

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: str

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

value: str

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

tags: Optional[Tags]
create: Optional[Iterable[TagsCreate]]

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

key: str

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

value: str

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

delete: Optional[Iterable[TagsDelete]]

Tags to remove by key

key: str

Tag key to delete

set: Optional[Iterable[TagsSet]]

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

key: str

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

value: str

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

update: Optional[Iterable[TagsUpdate]]

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: str

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

value: str

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

ReturnsExpand Collapse
class InvoiceUpdateResponse:
data: Invoice

Invoice object

id: str

Unique identifier for the invoice

created: datetime

ISO 8601 timestamp when the invoice was created

formatdate-time
Deprecatedstatus: Literal["active"]

Deprecated: The status of the invoice

tags: List[Tag]

Metadata tags for this invoice

key: str

Tag key

value: str

Tag value

version: float

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

workspace_id: str

Workspace ID this invoice belongs to

line_items: Optional[List[LineItem]]

List of line items associated with this invoice

id: str

Unique identifier for the line item

Deprecatedamount: str

Deprecated: use price.amount instead. Total amount in smallest currency unit (represented as string for bigint)

currency_code: Literal["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"
description: str

Description of the line item

price: LineItemPrice

Price breakdown containing amount, unit price, and quantity

amount: str

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

quantity: int

Quantity of units for this line item

unit_price: str

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

product_id: str

ID of the product/catalog item

tags: List[LineItemTag]

Metadata tags for this line item

key: str

Tag key

value: str

Tag value

type: Literal["payin", "payout"]

The type of the line item

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

External ID of the user associated with this line item

modified: Optional[datetime]

ISO 8601 timestamp when the invoice was last modified

formatdate-time

Update

from fragment import Fragment

client = Fragment()
invoice = client.invoices.update(
    id="inv_1234567890",
    current_invoice_version=3,
)
print(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"
  }
}