curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/expenses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"supplier_name": "Coworking Delicias S.L.",
"supplier_tax_id": "B50123456",
"document_number": "F-2026-0912",
"expense_date": "2026-10-01",
"subtotal": "200.00",
"vat_rate": "21",
"vat_amount": "42.00",
"total": "242.00",
"category": "G03",
"deductible": "yes"
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/expenses"
payload = {
"supplier_name": "Coworking Delicias S.L.",
"supplier_tax_id": "B50123456",
"document_number": "F-2026-0912",
"expense_date": "2026-10-01",
"subtotal": "200.00",
"vat_rate": "21",
"vat_amount": "42.00",
"total": "242.00",
"category": "G03",
"deductible": "yes"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
supplier_name: 'Coworking Delicias S.L.',
supplier_tax_id: 'B50123456',
document_number: 'F-2026-0912',
expense_date: '2026-10-01',
subtotal: '200.00',
vat_rate: '21',
vat_amount: '42.00',
total: '242.00',
category: 'G03',
deductible: 'yes'
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/expenses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"supplier_name": "<string>",
"expense_date": "2023-12-25",
"subtotal": "121.00",
"vat_amount": "121.00",
"total": "121.00",
"deductible": "yes",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"created_at": "2023-11-07T05:31:56Z",
"supplier_tax_id": "<string>",
"supplier_country": "ES",
"document_number": "<string>",
"operation_date": "2023-12-25",
"description": "<string>",
"vat_rate": "<string>",
"irpf_rate": "<string>",
"irpf_amount": "121.00",
"vat_treatment": "taxable",
"category": "<string>",
"account": "<string>",
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vat_lines": [
{
"rate": "<string>",
"base": "121.00",
"vat": "121.00"
}
],
"items": [
{
"description": "<string>",
"quantity": "<string>",
"unit_price": "<string>",
"amount": "121.00"
}
],
"category_proposed": true,
"booked_account": "<string>",
"deductible_reason": "<string>",
"deductibility": {
"estimate": "likely",
"rule": "<string>"
},
"source": "upload",
"review_reasons": [
"<string>"
],
"currency": "<string>",
"exchange_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "lines[0].vat_rate must be 21, 10, 4 or 0",
"code": "invalid_invoice",
"request_id": "req_01JAB3K9X2"
}{
"error": "invalid token",
"code": "unauthorized",
"request_id": "req_01JAB3K9X2"
}{
"error": "Review and approve in the authenticated web application",
"code": "person_required",
"request_id": "req_01JAB3K9X2"
}{
"error": "invoice not found",
"code": "not_found",
"request_id": "req_01JAB3K9X2"
}Record an expense
Records a purchase invoice or receipt from its details.
curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/expenses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"supplier_name": "Coworking Delicias S.L.",
"supplier_tax_id": "B50123456",
"document_number": "F-2026-0912",
"expense_date": "2026-10-01",
"subtotal": "200.00",
"vat_rate": "21",
"vat_amount": "42.00",
"total": "242.00",
"category": "G03",
"deductible": "yes"
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/expenses"
payload = {
"supplier_name": "Coworking Delicias S.L.",
"supplier_tax_id": "B50123456",
"document_number": "F-2026-0912",
"expense_date": "2026-10-01",
"subtotal": "200.00",
"vat_rate": "21",
"vat_amount": "42.00",
"total": "242.00",
"category": "G03",
"deductible": "yes"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
supplier_name: 'Coworking Delicias S.L.',
supplier_tax_id: 'B50123456',
document_number: 'F-2026-0912',
expense_date: '2026-10-01',
subtotal: '200.00',
vat_rate: '21',
vat_amount: '42.00',
total: '242.00',
category: 'G03',
deductible: 'yes'
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/expenses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"supplier_name": "<string>",
"expense_date": "2023-12-25",
"subtotal": "121.00",
"vat_amount": "121.00",
"total": "121.00",
"deductible": "yes",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"created_at": "2023-11-07T05:31:56Z",
"supplier_tax_id": "<string>",
"supplier_country": "ES",
"document_number": "<string>",
"operation_date": "2023-12-25",
"description": "<string>",
"vat_rate": "<string>",
"irpf_rate": "<string>",
"irpf_amount": "121.00",
"vat_treatment": "taxable",
"category": "<string>",
"account": "<string>",
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vat_lines": [
{
"rate": "<string>",
"base": "121.00",
"vat": "121.00"
}
],
"items": [
{
"description": "<string>",
"quantity": "<string>",
"unit_price": "<string>",
"amount": "121.00"
}
],
"category_proposed": true,
"booked_account": "<string>",
"deductible_reason": "<string>",
"deductibility": {
"estimate": "likely",
"rule": "<string>"
},
"source": "upload",
"review_reasons": [
"<string>"
],
"currency": "<string>",
"exchange_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "lines[0].vat_rate must be 21, 10, 4 or 0",
"code": "invalid_invoice",
"request_id": "req_01JAB3K9X2"
}{
"error": "invalid token",
"code": "unauthorized",
"request_id": "req_01JAB3K9X2"
}{
"error": "Review and approve in the authenticated web application",
"code": "person_required",
"request_id": "req_01JAB3K9X2"
}{
"error": "invoice not found",
"code": "not_found",
"request_id": "req_01JAB3K9X2"
}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
Your partner secret key, mk_live_… for real companies or mk_test_…
for test companies. Keep it on your servers. See
Authentication.
Headers
A unique key, such as a UUID, that makes a retried create safe. Reusing a key with a different body is refused.
255Path Parameters
The company's ID. Every company-scoped call works in exactly this company.
Body
1 - 200An amount in euros as a decimal string with two decimals, such as "121.00".
^-?[0-9]+\.[0-9]{2}$"121.00"
An amount in euros as a decimal string with two decimals, such as "121.00".
^-?[0-9]+\.[0-9]{2}$"121.00"
An amount in euros as a decimal string with two decimals, such as "121.00".
^-?[0-9]+\.[0-9]{2}$"121.00"
100500A decimal number as a string, such as "21" or "0.5".
^-?[0-9]{1,10}(\.[0-9]{1,6})?$A decimal number as a string, such as "21" or "0.5".
^-?[0-9]{1,10}(\.[0-9]{1,6})?$An amount in euros as a decimal string with two decimals, such as "121.00".
^-?[0-9]+\.[0-9]{2}$"121.00"
reverse_charge (inversión del sujeto pasivo) and exempt or not_subject carry no VAT amount.
taxable, exempt, reverse_charge, not_subject, import The AEAT expense concept, from G01 to G48, such as G03 (rent) or G05 (company Social Security).
^G[0-9]{2}$The PGC account to book it to, such as 621 or 629, for an empresa. It sets the category.
yes, no, unsure The document in Documents that supports it.
Response
The expense.
1 - 200An amount in euros as a decimal string with two decimals, such as "121.00".
^-?[0-9]+\.[0-9]{2}$"121.00"
An amount in euros as a decimal string with two decimals, such as "121.00".
^-?[0-9]+\.[0-9]{2}$"121.00"
An amount in euros as a decimal string with two decimals, such as "121.00".
^-?[0-9]+\.[0-9]{2}$"121.00"
yes, no, unsure 100500A decimal number as a string, such as "21" or "0.5".
^-?[0-9]{1,10}(\.[0-9]{1,6})?$A decimal number as a string, such as "21" or "0.5".
^-?[0-9]{1,10}(\.[0-9]{1,6})?$An amount in euros as a decimal string with two decimals, such as "121.00".
^-?[0-9]+\.[0-9]{2}$"121.00"
reverse_charge (inversión del sujeto pasivo) and exempt or not_subject carry no VAT amount.
taxable, exempt, reverse_charge, not_subject, import The AEAT expense concept, from G01 to G48, such as G03 (rent) or G05 (company Social Security).
^G[0-9]{2}$The PGC account to book it to, such as 621 or 629, for an empresa. It sets the category.
The document in Documents that supports it.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The category is Melso's proposal, not yet confirmed.
The account it is booked to.
Melso's estimate of deductibility, and the rule it applied.
Show child attributes
Show child attributes
upload, whatsapp, gmail, melso, import