## Update **patch** `/transactions/{transaction_ref}` Updates a transaction. ### Path Parameters - `transaction_ref: string` Transaction `id` or `external_id`. ### Body Parameters - `current_transaction_version: number` Current version of the transaction. Must match the stored version. - `allocations: optional object { create, update }` Allocation updates. - `create: optional array of object { amount, invoice_id, type, user }` Allocations to create. - `amount: string` Allocation amount, as a non-negative string in the smallest currency unit, such as cents for USD. - `invoice_id: string` Invoice to allocate against. - `type: "invoice_payin" or "invoice_payout"` Type of allocation. - `"invoice_payin"` - `"invoice_payout"` - `user: object { id } or object { external_id }` Identifies a user by `id` or `external_id`. - `ID object { id }` - `id: string` FRAGMENT generated unique ID. - `ExternalID object { external_id }` - `external_id: string` User-provided unique ID. - `update: optional array of object { id, amount }` Allocations to update. - `id: string` Allocation to update. - `amount: string` Updated allocation amount, as a non-negative string in the smallest currency unit, such as cents for USD. - `tags: optional object { create, delete, set, update }` Tag updates. - `create: optional array of object { key, value }` Tags to create. The tag key must not already exist. - `key: string` Tag key. Must not contain #, /, or :. Max 50 characters. - `value: string` Tag value. Must not contain #, /, or :. Max 200 characters. - `delete: optional array of object { key }` Tags to remove. - `key: string` Tag key to delete. - `set: optional array of object { key, value }` Tags to set. Creates a new tag or updates an existing tag. - `key: string` Tag key. Must not contain #, /, or :. Max 50 characters. - `value: string` Tag value. Must not contain #, /, or :. Max 200 characters. - `update: optional array of object { key, value }` Tags to update. The tag key must already exist. - `key: string` Tag key. Must not contain #, /, or :. Max 50 characters. - `value: string` Tag value. Must not contain #, /, or :. Max 200 characters. ### Returns - `data: Transaction` Transaction object. - `id: string` FRAGMENT generated unique ID. - `account: object { id, external_id }` External account for the transaction. - `id: string` FRAGMENT generated unique ID. - `external_id: string` User-provided unique ID. - `allocations: array of object { amount, invoice_id, type, user }` Allocations applied to the transaction. - `amount: string` Allocated amount, as a non-negative string in the smallest currency unit, such as cents for USD. - `invoice_id: string` Invoice the allocation is applied against. - `type: "invoice_payin" or "invoice_payout"` Type of allocation. - `"invoice_payin"` - `"invoice_payout"` - `user: object { id, external_id }` User associated with the allocation. - `id: string` FRAGMENT generated unique ID. - `external_id: string` User-provided unique ID. - `amount: string` Transaction amount, as a string in the smallest currency unit, such as cents for USD. - `created: string` Timestamp when the transaction was created. Uses ISO 8601 format. - `currency: "ADA" or "BTC" or "DAI" or 176 more` ISO 4217 or crypto currency code. - `"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"` - `external_id: string` User-provided unique ID. - `posted: string` Timestamp when the transaction was posted. Uses ISO 8601 format. - `tags: array of object { key, value }` Tags for the transaction. - `key: string` Tag key. - `value: string` Tag value. - `unallocated_amount: string` Amount not yet allocated, as a string. - `version: number` Current version of the transaction. - `modified: optional string` Timestamp when the transaction was last modified. Uses ISO 8601 format. ### Example ```http curl https://api.us-west-2.fragment.dev/billing/transactions/$TRANSACTION_REF \ -X PATCH \ -H 'Content-Type: application/json' \ -d '{ "current_transaction_version": 0, "tags": { "set": [ { "key": "department", "value": "engineering" } ] } }' ``` #### Response ```json { "data": { "id": "txn_dHhuX2ZyYWdfMDAx", "account": { "id": "ext_account_YWJjMTIz", "external_id": "acct_external_123" }, "allocations": [ { "amount": "1000", "invoice_id": "inv_abc123", "type": "invoice_payin", "user": { "id": "user_abc123", "external_id": "user_ext_001" } } ], "amount": "-1000", "created": "2024-01-13T00:00:00Z", "currency": "USD", "external_id": "bank_txn_123", "posted": "2024-01-13T00:00:00Z", "tags": [ { "key": "department", "value": "engineering" } ], "unallocated_amount": "-1000", "version": 1, "modified": "2024-01-13T00:00:00Z" } } ```