curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/correct \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"issue_date": "2023-12-25",
"lines": [
{
"description": "<string>",
"quantity": "<string>",
"unit_price": "<string>"
}
],
"notes": "<string>",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"due_date": "2023-12-25"
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/correct"
payload = {
"issue_date": "2023-12-25",
"lines": [
{
"description": "<string>",
"quantity": "<string>",
"unit_price": "<string>"
}
],
"notes": "<string>",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"due_date": "2023-12-25"
}
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({
issue_date: '2023-12-25',
lines: [{description: '<string>', quantity: '<string>', unit_price: '<string>'}],
notes: '<string>',
customer_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
due_date: '2023-12-25'
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/correct', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": "<string>",
"type": "standard",
"status": "draft",
"issue_date": "2023-12-25",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lines": [
{
"description": "<string>",
"quantity": "<string>",
"unit_price": "<string>",
"vat_rate": "<string>",
"product_kind": "goods",
"amount": "121.00"
}
],
"subtotal": "121.00",
"vat_amount": "121.00",
"irpf_amount": "121.00",
"total": "121.00",
"currency": "EUR",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"series": "<string>",
"number": 123,
"due_date": "2023-12-25",
"customer_name": "<string>",
"customer_tax_id": "<string>",
"irpf_rate": "<string>",
"tax_label": "IVA",
"notes": "<string>",
"fiscal_network": "verifactu",
"verifactu_status": "pending",
"pdf_ready": true,
"payment_link": "<string>",
"payment_link_status": "pending",
"email_delivery_status": "pending",
"email_delivery_error": "<string>",
"sent_at": "2023-11-07T05:31:56Z",
"paid_at": "2023-11-07T05:31:56Z",
"corrects_invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"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": "invoice not found",
"code": "not_found",
"request_id": "req_01JAB3K9X2"
}{
"error": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}Draft a corrective invoice
Saves a corrective (rectificativa) draft that references a registered invoice.
curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/correct \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"issue_date": "2023-12-25",
"lines": [
{
"description": "<string>",
"quantity": "<string>",
"unit_price": "<string>"
}
],
"notes": "<string>",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"due_date": "2023-12-25"
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/correct"
payload = {
"issue_date": "2023-12-25",
"lines": [
{
"description": "<string>",
"quantity": "<string>",
"unit_price": "<string>"
}
],
"notes": "<string>",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"due_date": "2023-12-25"
}
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({
issue_date: '2023-12-25',
lines: [{description: '<string>', quantity: '<string>', unit_price: '<string>'}],
notes: '<string>',
customer_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
due_date: '2023-12-25'
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/correct', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": "<string>",
"type": "standard",
"status": "draft",
"issue_date": "2023-12-25",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lines": [
{
"description": "<string>",
"quantity": "<string>",
"unit_price": "<string>",
"vat_rate": "<string>",
"product_kind": "goods",
"amount": "121.00"
}
],
"subtotal": "121.00",
"vat_amount": "121.00",
"irpf_amount": "121.00",
"total": "121.00",
"currency": "EUR",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"series": "<string>",
"number": 123,
"due_date": "2023-12-25",
"customer_name": "<string>",
"customer_tax_id": "<string>",
"irpf_rate": "<string>",
"tax_label": "IVA",
"notes": "<string>",
"fiscal_network": "verifactu",
"verifactu_status": "pending",
"pdf_ready": true,
"payment_link": "<string>",
"payment_link_status": "pending",
"email_delivery_status": "pending",
"email_delivery_error": "<string>",
"sent_at": "2023-11-07T05:31:56Z",
"paid_at": "2023-11-07T05:31:56Z",
"corrects_invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"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": "invoice not found",
"code": "not_found",
"request_id": "req_01JAB3K9X2"
}{
"error": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}notes must give the reason for the correction, and lines may
carry negative prices. The original stays as issued; the corrective is
issued like any draft, in the R- series.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 - 200 elementsShow child attributes
Show child attributes
The reason for the correction.
4000Must be the original invoice's customer. Defaults to it.
0, 7, 15 Response
The corrective draft, with type corrective and corrects_invoice_id.
A fingerprint of the invoice's fiscal content. Issuing requires the exact version the person reviewed.
standard, proforma, corrective draft until a person issues it. issued once numbered; sent once emailed; paid once marked paid.
draft, issued, sent, paid Show 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"
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"
"EUR"Set at issue. The issue year, such as 2026; R-2026 for a corrective.
Set at issue, the next in the series.
The customer's name when the invoice was drafted.
A decimal number as a string, such as "21" or "0.5".
^-?[0-9]{1,10}(\.[0-9]{1,6})?$IVA, IGIC Where the invoice is registered, from the company's tax territory.
verifactu, ticketbai The registration state with VERI*FACTU or TicketBAI.
pending, registered, error pending, creating, active, inactive, error, unknown pending, sending, sent, error, unknown