Expenses

Record an expense

Files a line against the caller’s own name — whoever the credential belongs to is who gets reimbursed, and this tool cannot file on somebody else’s behalf. amount_cents is integer cents (42,00 € is 4200) and may be omitted when nobody has read the receipt yet: an incomplete line is accepted on purpose and only refused later, at the moment somebody tries to put it in a nota spese. ⚠ A CAR JOURNEY (kind: "km") IS PRICED BY THE SERVER: give distance_km and never an amount or a currency — the company’s kilometric rate, or the traveller’s own, is applied and frozen onto the line. No receipt image can be attached through this tool; photographing the giustificativo is something the person does in the app, and the line waits for it.

post/api/v1/rest/spese/expenses

Request

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

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

kind'receipt' | 'km' | 'document' required

receipt a purchase, km a car journey, document an invoice or booking.

spent_onstring required

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

supplierstring

Who was paid, as written on the receipt. Not matched against any list.

amount_centsinteger

Integer cents in currency. Omit when it is not known yet. Never on a km line.

currencystring

ISO-4217, three letters. Omit for the company’s own currency, which is the normal case. A foreign-currency line is converted later at the published rate.

category_idstring uuid

From spese_list_categories. A TOP-LEVEL one.

subcategory_idstring uuid

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

payment_channel_idstring uuid

From spese_list_channels. It decides whether the company owes the money back, and the answer is frozen onto the line as it is written.

notestring

Anything worth recording — who was at the table, what the trip was for.

distance_kmnumber

Kilometres driven. Required on a km line and refused on every other kind.

metadataobject

The extra fields the chosen category (and sub-category) declares, keyed by their name from spese_list_categories, each of the type it declares. A key the category does not declare, a value of the wrong type or one outside a field’s list is refused with the reason and nothing is written; a line with no category takes no fields.

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.