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": "2026-11-03",
"notes": "Rectifica la factura 2026/41 por un descuento del 10 % acordado y no aplicado.",
"lines": [
{
"description": "Descuento sobre el diseño de identidad visual",
"quantity": "1",
"unit_price": "-120.00",
"vat_rate": "21",
"product_kind": "services"
}
]
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/correct"
payload = {
"issue_date": "2026-11-03",
"notes": "Rectifica la factura 2026/41 por un descuento del 10 % acordado y no aplicado.",
"lines": [
{
"description": "Descuento sobre el diseño de identidad visual",
"quantity": "1",
"unit_price": "-120.00",
"vat_rate": "21",
"product_kind": "services"
}
]
}
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: '2026-11-03',
notes: 'Rectifica la factura 2026/41 por un descuento del 10 % acordado y no aplicado.',
lines: [
{
description: 'Descuento sobre el diseño de identidad visual',
quantity: '1',
unit_price: '-120.00',
vat_rate: '21',
product_kind: 'services'
}
]
})
};
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",
"series": "<string>",
"number": 123,
"issue_date": "2023-12-25",
"due_date": "2023-12-25",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_name": "<string>",
"customer_tax_id": "<string>",
"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_rate": "<string>",
"irpf_amount": "121.00",
"total": "121.00",
"currency": "EUR",
"notes": "<string>",
"verifactu_status": "pending",
"fiscal_network": "verifactu",
"tax_label": "IVA",
"pdf_ready": true,
"payment_link": "<string>",
"payment_link_status": "pending",
"payment_link_error": "<string>",
"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",
"activity_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"outstanding": "121.00",
"collections": [
{
"date": "2023-12-25",
"amount": "<string>",
"movement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Draft a corrective invoice
Saves a corrective (rectificativa) draft of an issued 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": "2026-11-03",
"notes": "Rectifica la factura 2026/41 por un descuento del 10 % acordado y no aplicado.",
"lines": [
{
"description": "Descuento sobre el diseño de identidad visual",
"quantity": "1",
"unit_price": "-120.00",
"vat_rate": "21",
"product_kind": "services"
}
]
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/correct"
payload = {
"issue_date": "2026-11-03",
"notes": "Rectifica la factura 2026/41 por un descuento del 10 % acordado y no aplicado.",
"lines": [
{
"description": "Descuento sobre el diseño de identidad visual",
"quantity": "1",
"unit_price": "-120.00",
"vat_rate": "21",
"product_kind": "services"
}
]
}
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: '2026-11-03',
notes: 'Rectifica la factura 2026/41 por un descuento del 10 % acordado y no aplicado.',
lines: [
{
description: 'Descuento sobre el diseño de identidad visual',
quantity: '1',
unit_price: '-120.00',
vat_rate: '21',
product_kind: 'services'
}
]
})
};
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",
"series": "<string>",
"number": 123,
"issue_date": "2023-12-25",
"due_date": "2023-12-25",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_name": "<string>",
"customer_tax_id": "<string>",
"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_rate": "<string>",
"irpf_amount": "121.00",
"total": "121.00",
"currency": "EUR",
"notes": "<string>",
"verifactu_status": "pending",
"fiscal_network": "verifactu",
"tax_label": "IVA",
"pdf_ready": true,
"payment_link": "<string>",
"payment_link_status": "pending",
"payment_link_error": "<string>",
"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",
"activity_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"outstanding": "121.00",
"collections": [
{
"date": "2023-12-25",
"amount": "<string>",
"movement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}notes gives the reason and lines may be negative. Issue it like any draft: it is numbered in the R- series. Send an Idempotency-Key to retry safely.Authorizations
A company API key, mk_live_…, that the company's owner creates in the
Melso app under Settings, Connect your AI, API keys. It works in that
one company with the owner's authority. Test keys (mk_test_…) are not
issued. Keep the key on your servers. See
Authentication.
Headers
A unique key of yours, such as a UUID, that makes a retried create
safe. For 24 hours a retry with the same key and body gets the first
answer again, with Idempotent-Replayed: true. The same key with
another body answers 422 idempotency_key_reused; while the first
request runs, 409 idempotency_key_in_use. A 5xx answer is not
kept, so its retry runs again. See Conventions.
255Path Parameters
Body
Response
The corrective draft, with type corrective and corrects_invoice_id.
The AEAT's answer to the invoice's VERIFACTU record: pending until
it answers (and on a draft), registered once it accepted it,
error if it refused it, the invoice keeping its number. none for
an invoice issued without VERIFACTU, as the Melso app issues before
the owner authorizes a certificate.
pending, registered, error, none