Skip to main content
POST
Record an expense
Live capability. Melso runs this in production today. Partner keys reach it once your partner account is enabled. See Availability.
subtotal plus vat_amount must equal total exactly; IRPF withheld is not part of total. Melso proposes the AEAT category and estimates deductibility when you leave them out. To record from a file instead, upload it to Documents and use Read a fiscal document.

Authorizations

Authorization
string
header
required

Your partner secret key, mk_live_… for real companies or mk_test_… for test companies. Keep it on your servers. See Authentication.

Headers

Idempotency-Key
string

A unique key, such as a UUID, that makes a retried create safe. Reusing a key with a different body is refused.

Maximum string length: 255

Path Parameters

company_id
string<uuid>
required

The company's ID. Every company-scoped call works in exactly this company.

Body

application/json
supplier_name
string
required
Required string length: 1 - 200
expense_date
string<date>
required
subtotal
string
required

An amount in euros as a decimal string with two decimals, such as "121.00".

Pattern: ^-?[0-9]+\.[0-9]{2}$
Example:

"121.00"

vat_amount
string
required

An amount in euros as a decimal string with two decimals, such as "121.00".

Pattern: ^-?[0-9]+\.[0-9]{2}$
Example:

"121.00"

total
string
required

An amount in euros as a decimal string with two decimals, such as "121.00".

Pattern: ^-?[0-9]+\.[0-9]{2}$
Example:

"121.00"

supplier_tax_id
string
supplier_country
string
default:ES
document_number
string
Maximum string length: 100
operation_date
string<date>
description
string
Maximum string length: 500
vat_rate
string

A decimal number as a string, such as "21" or "0.5".

Pattern: ^-?[0-9]{1,10}(\.[0-9]{1,6})?$
irpf_rate
string

A decimal number as a string, such as "21" or "0.5".

Pattern: ^-?[0-9]{1,10}(\.[0-9]{1,6})?$
irpf_amount
string

An amount in euros as a decimal string with two decimals, such as "121.00".

Pattern: ^-?[0-9]+\.[0-9]{2}$
Example:

"121.00"

vat_treatment
enum<string>

reverse_charge (inversión del sujeto pasivo) and exempt or not_subject carry no VAT amount.

Available options:
taxable,
exempt,
reverse_charge,
not_subject,
import
category
string

The AEAT expense concept, from G01 to G48, such as G03 (rent) or G05 (company Social Security).

Pattern: ^G[0-9]{2}$
account
string

The PGC account to book it to, such as 621 or 629, for an empresa. It sets the category.

deductible
enum<string>
Available options:
yes,
no,
unsure
file_id
string<uuid>

The document in Documents that supports it.

Response

The expense.

supplier_name
string
required
Required string length: 1 - 200
expense_date
string<date>
required
subtotal
string
required

An amount in euros as a decimal string with two decimals, such as "121.00".

Pattern: ^-?[0-9]+\.[0-9]{2}$
Example:

"121.00"

vat_amount
string
required

An amount in euros as a decimal string with two decimals, such as "121.00".

Pattern: ^-?[0-9]+\.[0-9]{2}$
Example:

"121.00"

total
string
required

An amount in euros as a decimal string with two decimals, such as "121.00".

Pattern: ^-?[0-9]+\.[0-9]{2}$
Example:

"121.00"

deductible
enum<string>
required
Available options:
yes,
no,
unsure
id
string<uuid>
required
version
integer
required
created_at
string<date-time>
required
supplier_tax_id
string
supplier_country
string
default:ES
document_number
string
Maximum string length: 100
operation_date
string<date>
description
string
Maximum string length: 500
vat_rate
string

A decimal number as a string, such as "21" or "0.5".

Pattern: ^-?[0-9]{1,10}(\.[0-9]{1,6})?$
irpf_rate
string

A decimal number as a string, such as "21" or "0.5".

Pattern: ^-?[0-9]{1,10}(\.[0-9]{1,6})?$
irpf_amount
string

An amount in euros as a decimal string with two decimals, such as "121.00".

Pattern: ^-?[0-9]+\.[0-9]{2}$
Example:

"121.00"

vat_treatment
enum<string>

reverse_charge (inversión del sujeto pasivo) and exempt or not_subject carry no VAT amount.

Available options:
taxable,
exempt,
reverse_charge,
not_subject,
import
category
string

The AEAT expense concept, from G01 to G48, such as G03 (rent) or G05 (company Social Security).

Pattern: ^G[0-9]{2}$
account
string

The PGC account to book it to, such as 621 or 629, for an empresa. It sets the category.

file_id
string<uuid>

The document in Documents that supports it.

vat_lines
object[]
items
object[]
category_proposed
boolean

The category is Melso's proposal, not yet confirmed.

booked_account
string

The account it is booked to.

deductible_reason
string | null
deductibility
object

Melso's estimate of deductibility, and the rule it applied.

source
enum<string>
Available options:
upload,
whatsapp,
gmail,
melso,
import
review_reasons
string[]
currency
string
exchange_rate
string | null
updated_at
string<date-time>