Expenses

Correct a recorded expense

Corrects one line — the day, the supplier, the amount, the category, the payment channel, the note, the category’s extra fields or a journey’s distance — while it may still be edited: a line in no nota spese, or in one that is draft or rejected. A line inside a report that has already left is refused, and can be corrected only once that report comes back. Name only what changes; null clears a field that may be empty. The caller corrects their own lines, and whoever manages the company’s expenses anybody’s. If the line sits in an open report, that report’s totals follow it in the same call. ⚠ A CAR JOURNEY (km) IS PRICED BY THE SERVER: give distance_km and never an amount or a currency — it is re-priced at the rate frozen onto the line when it was filed. ⚠ metadata REPLACES the extra fields as a whole: send every field that should stay (spese_get_expense with detailed shows them). The kind of a line cannot change.

patch/api/v1/rest/spese/expenses/{id}

Request

  • Base URL: https://api.custodo.ai
  • URL: https://api.custodo.ai/api/v1/rest/spese/expenses/{id}
  • Auth: HTTP bearer

Path parameters

idstring uuid required

The expense id, from spese_list_expenses or spese_get_expense.

Headers

X-Tenant-Idstring uuid

The organisation to act in. An API key is bound to exactly one, so this is optional for a key and must match the one it was minted for.

Request body

spent_onstring

The day the money was spent, YYYY-MM-DD.

supplierstring nullable

Who was paid, as written on the receipt. null clears it.

amount_centsinteger nullable

Integer cents in the line’s currency (48,00 € is 4800). null clears it and the line is incomplete again. Refused on a km line.

currencystring

ISO-4217, three letters. The line is converted again at the rate published for its day. Refused on a km line.

category_idstring uuid nullable

From spese_list_categories. A TOP-LEVEL one. null clears it — send subcategory_id: null with it when the line has a sub-category.

subcategory_idstring uuid nullable

A child of category_id, which must be given alongside it. null clears it.

payment_channel_idstring uuid nullable

From spese_list_channels. Changing it decides again, and freezes again, whether the company owes the money back. null clears it.

notestring nullable

Anything worth recording. null clears it.

distance_kmnumber

Kilometres driven, on a km line only. Refused on every other kind.

metadataobject

The category’s extra fields, keyed by their name from spese_list_categories. It REPLACES the whole set — a field left out is cleared — and anything the category does not declare is refused.

Response

Done. data is the tool’s own answer.

oktrue required
dataunknown required

Changes

No recorded changes to this operation across all 1 revision of this API.