Void an invoice
curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/void \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_version": "4f0d8a6b2c1e9f7a5d3b0c8e6f4a2d1b9c7e5a3f1d0b8c6e4a2f0d9b7c5e3a1f",
"reason": "La misma venta se facturó dos veces."
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/void"
payload = {
"expected_version": "4f0d8a6b2c1e9f7a5d3b0c8e6f4a2d1b9c7e5a3f1d0b8c6e4a2f0d9b7c5e3a1f",
"reason": "La misma venta se facturó dos veces."
}
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({
expected_version: '4f0d8a6b2c1e9f7a5d3b0c8e6f4a2d1b9c7e5a3f1d0b8c6e4a2f0d9b7c5e3a1f',
reason: 'La misma venta se facturó dos veces.'
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/void', 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"
}
Invoices
Anular una factura VERI*FACTU — Void an invoice
Voids an issued invoice that should never have existed, such as a duplicate or a test.
POST
/
companies
/
{company_id}
/
invoices
/
{invoice_id}
/
void
Void an invoice
curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/void \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_version": "4f0d8a6b2c1e9f7a5d3b0c8e6f4a2d1b9c7e5a3f1d0b8c6e4a2f0d9b7c5e3a1f",
"reason": "La misma venta se facturó dos veces."
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/void"
payload = {
"expected_version": "4f0d8a6b2c1e9f7a5d3b0c8e6f4a2d1b9c7e5a3f1d0b8c6e4a2f0d9b7c5e3a1f",
"reason": "La misma venta se facturó dos veces."
}
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({
expected_version: '4f0d8a6b2c1e9f7a5d3b0c8e6f4a2d1b9c7e5a3f1d0b8c6e4a2f0d9b7c5e3a1f',
reason: 'La misma venta se facturó dos veces.'
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/void', 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"
}
Melso sends the VERI*FACTU cancellation and keeps your
reason.
A wrong amount needs a corrective invoice instead. Melso answers 409 for an invoice that is paid, collected, already corrected, in a filed quarter, not issued through Melso’s VERI*FACTU sender, or still waiting for the AEAT.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.
Path Parameters
Body
application/json
Response
The invoice, with status void.
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.
Available options:
pending, registered, error, none