curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/issue \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_version": "<string>"
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/issue"
payload = { "expected_version": "<string>" }
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: '<string>'})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/issue', 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": "The tax service is not active for this company",
"code": "tax_service_required",
"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"
}{
"error": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}{
"error": "The invoice number is reserved. Retry this same invoice to reconcile it; do not prepare a replacement.",
"code": "invoicing_provider_pending",
"request_id": "req_01JAB3K9X2"
}Issue an invoice
Issues the draft at exactly expected_version: assigns the series and the next number, registers the invoice with VERI*FACTU (AEAT) or TicketBAI (Álava, Bizkaia, Gipuzkoa), stores the legal PDF and emails it to the customer.
curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/issue \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_version": "<string>"
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/issue"
payload = { "expected_version": "<string>" }
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: '<string>'})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/invoices/{invoice_id}/issue', 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": "The tax service is not active for this company",
"code": "tax_service_required",
"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"
}{
"error": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}{
"error": "The invoice number is reserved. Retry this same invoice to reconcile it; do not prepare a replacement.",
"code": "invoicing_provider_pending",
"request_id": "req_01JAB3K9X2"
}expected_version reuses the same
number. An issued invoice never changes; correct it instead.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
The version of the draft the person reviewed.
64Response
The issued invoice.
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