curl --request PUT \
--url https://api.melso.ai/v1/companies/{company_id}/income/{income_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_name": "<string>",
"issue_date": "2023-12-25",
"vat_lines": [
{
"rate": "<string>",
"base": "121.00",
"vat": "121.00"
}
],
"expected_version": 2,
"customer_tax_id": "<string>",
"customer_country": "ES",
"document_number": "<string>",
"operation_date": "2023-12-25",
"description": "<string>",
"vat_treatment": "taxable",
"irpf_rate": "<string>",
"irpf_amount": "121.00",
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/income/{income_id}"
payload = {
"customer_name": "<string>",
"issue_date": "2023-12-25",
"vat_lines": [
{
"rate": "<string>",
"base": "121.00",
"vat": "121.00"
}
],
"expected_version": 2,
"customer_tax_id": "<string>",
"customer_country": "ES",
"document_number": "<string>",
"operation_date": "2023-12-25",
"description": "<string>",
"vat_treatment": "taxable",
"irpf_rate": "<string>",
"irpf_amount": "121.00",
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_name: '<string>',
issue_date: '2023-12-25',
vat_lines: [{rate: '<string>', base: '121.00', vat: '121.00'}],
expected_version: 2,
customer_tax_id: '<string>',
customer_country: 'ES',
document_number: '<string>',
operation_date: '2023-12-25',
description: '<string>',
vat_treatment: 'taxable',
irpf_rate: '<string>',
irpf_amount: '121.00',
file_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/income/{income_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"customer_name": "<string>",
"issue_date": "2023-12-25",
"vat_lines": [
{
"rate": "<string>",
"base": "121.00",
"vat": "121.00"
}
],
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subtotal": "121.00",
"vat_amount": "121.00",
"total": "121.00",
"version": 123,
"created_at": "2023-11-07T05:31:56Z",
"customer_tax_id": "<string>",
"customer_country": "ES",
"document_number": "<string>",
"operation_date": "2023-12-25",
"description": "<string>",
"vat_treatment": "taxable",
"irpf_rate": "<string>",
"irpf_amount": "121.00",
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency": "<string>",
"exchange_rate": "<string>",
"source": "upload",
"review_reasons": [
"<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": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}Replace an income
Replaces the income with the body you send, at exactly expected_version.
curl --request PUT \
--url https://api.melso.ai/v1/companies/{company_id}/income/{income_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_name": "<string>",
"issue_date": "2023-12-25",
"vat_lines": [
{
"rate": "<string>",
"base": "121.00",
"vat": "121.00"
}
],
"expected_version": 2,
"customer_tax_id": "<string>",
"customer_country": "ES",
"document_number": "<string>",
"operation_date": "2023-12-25",
"description": "<string>",
"vat_treatment": "taxable",
"irpf_rate": "<string>",
"irpf_amount": "121.00",
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/income/{income_id}"
payload = {
"customer_name": "<string>",
"issue_date": "2023-12-25",
"vat_lines": [
{
"rate": "<string>",
"base": "121.00",
"vat": "121.00"
}
],
"expected_version": 2,
"customer_tax_id": "<string>",
"customer_country": "ES",
"document_number": "<string>",
"operation_date": "2023-12-25",
"description": "<string>",
"vat_treatment": "taxable",
"irpf_rate": "<string>",
"irpf_amount": "121.00",
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_name: '<string>',
issue_date: '2023-12-25',
vat_lines: [{rate: '<string>', base: '121.00', vat: '121.00'}],
expected_version: 2,
customer_tax_id: '<string>',
customer_country: 'ES',
document_number: '<string>',
operation_date: '2023-12-25',
description: '<string>',
vat_treatment: 'taxable',
irpf_rate: '<string>',
irpf_amount: '121.00',
file_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/income/{income_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"customer_name": "<string>",
"issue_date": "2023-12-25",
"vat_lines": [
{
"rate": "<string>",
"base": "121.00",
"vat": "121.00"
}
],
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subtotal": "121.00",
"vat_amount": "121.00",
"total": "121.00",
"version": 123,
"created_at": "2023-11-07T05:31:56Z",
"customer_tax_id": "<string>",
"customer_country": "ES",
"document_number": "<string>",
"operation_date": "2023-12-25",
"description": "<string>",
"vat_treatment": "taxable",
"irpf_rate": "<string>",
"irpf_amount": "121.00",
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency": "<string>",
"exchange_rate": "<string>",
"source": "upload",
"review_reasons": [
"<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": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}Authorizations
Your partner secret key, mk_live_… for real companies or mk_test_…
for test companies. Keep it on your servers. See
Authentication.
Path Parameters
The company's ID. Every company-scoped call works in exactly this company.
Body
200One line per VAT rate. A line with a decimal rate is recargo de equivalencia.
1 - 10 elementsShow child attributes
Show child attributes
x >= 132Unique in the company.
100200taxable, exempt, reverse_charge, not_subject 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"
Response
The replaced income, with a new version.
200One line per VAT rate. A line with a decimal rate is recargo de equivalencia.
1 - 10 elementsShow child attributes
Show child attributes
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"
subtotal plus vat_amount; IRPF withheld is not subtracted.
^-?[0-9]+\.[0-9]{2}$"121.00"
32Unique in the company.
100200taxable, exempt, reverse_charge, not_subject 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"
upload, whatsapp, gmail, import