curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "3f6c2a1e-8b7d-4c5e-9f10-2a3b4c5d6e7f",
"issue_date": "2026-10-15",
"due_date": "2026-11-14",
"irpf_rate": "15",
"lines": [
{
"description": "Diseño de identidad visual",
"quantity": "1",
"unit_price": "1200.00",
"vat_rate": "21",
"product_kind": "services"
}
]
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/invoices"
payload = {
"customer_id": "3f6c2a1e-8b7d-4c5e-9f10-2a3b4c5d6e7f",
"issue_date": "2026-10-15",
"due_date": "2026-11-14",
"irpf_rate": "15",
"lines": [
{
"description": "Diseño de identidad visual",
"quantity": "1",
"unit_price": "1200.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({
customer_id: '3f6c2a1e-8b7d-4c5e-9f10-2a3b4c5d6e7f',
issue_date: '2026-10-15',
due_date: '2026-11-14',
irpf_rate: '15',
lines: [
{
description: 'Diseño de identidad visual',
quantity: '1',
unit_price: '1200.00',
vat_rate: '21',
product_kind: 'services'
}
]
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/invoices', 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"
}Create an invoice draft
Saves an unnumbered draft and calculates its totals.
curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "3f6c2a1e-8b7d-4c5e-9f10-2a3b4c5d6e7f",
"issue_date": "2026-10-15",
"due_date": "2026-11-14",
"irpf_rate": "15",
"lines": [
{
"description": "Diseño de identidad visual",
"quantity": "1",
"unit_price": "1200.00",
"vat_rate": "21",
"product_kind": "services"
}
]
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/invoices"
payload = {
"customer_id": "3f6c2a1e-8b7d-4c5e-9f10-2a3b4c5d6e7f",
"issue_date": "2026-10-15",
"due_date": "2026-11-14",
"irpf_rate": "15",
"lines": [
{
"description": "Diseño de identidad visual",
"quantity": "1",
"unit_price": "1200.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({
customer_id: '3f6c2a1e-8b7d-4c5e-9f10-2a3b4c5d6e7f',
issue_date: '2026-10-15',
due_date: '2026-11-14',
irpf_rate: '15',
lines: [
{
description: 'Diseño de identidad visual',
quantity: '1',
unit_price: '1200.00',
vat_rate: '21',
product_kind: 'services'
}
]
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/invoices', 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"
}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
A proforma is never issued. corrective is only for replacing a
corrective draft; create one with
Draft a corrective invoice.
standard, proforma, corrective Response
The draft, with status draft, its totals and its version.
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