Skip to main content
POST
Create an invoice draft
Issue it with Issue an invoice, or send the owner the approval link. Send an Idempotency-Key to retry safely.

Authorizations

Authorization
string
header
required

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

Idempotency-Key
string

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.

Maximum string length: 255

Path Parameters

company_id
string<uuid>
required

The company's ID. Every company-scoped call works in exactly this company.

Body

application/json
customer_id
string<uuid>
required

One of the company's customers. A company or professional customer needs its tax ID.

issue_date
string<date>
required
lines
object[]
required
Required array length: 1 - 200 elements
type
enum<string>
default:standard

A proforma is never issued. corrective is only for replacing a corrective draft; create one with Draft a corrective invoice.

Available options:
standard,
proforma,
corrective
due_date
string<date>

On or after issue_date.

irpf_rate
enum<string>
default:0

IRPF withheld, for a self-employed person's professional activity invoicing a company or professional customer. A company always uses 0.

Available options:
0,
7,
15
notes
string

Notes on the invoice. A line at VAT 0 needs its legal basis here.

Maximum string length: 4000
activity_id
string

The company's activity the invoice belongs to, for a company with more than one; empty for the main one. Omitted on a replacement, the draft keeps its own.

Response

The draft, with status draft, its totals and its version.

id
string<uuid>
required
version
string
required

A fingerprint of the invoice's fiscal content. Issuing and voiding take the exact version you read.

type
enum<string>
required
Available options:
standard,
proforma,
corrective
status
enum<string>
required

draft until it is issued; issued once numbered; sent once emailed to the customer; paid once marked paid; void once voided.

Available options:
draft,
issued,
sent,
paid,
void
series
string | null
required

Set at issue. The issue year, such as 2026, unless the company set its own series; R- before it for a corrective invoice.

number
integer | null
required

Set at issue, the next in the series.

issue_date
string<date>
required
due_date
string<date> | null
required
customer_id
string<uuid>
required
customer_name
string
required

The customer's name when the invoice was drafted.

customer_tax_id
string
required

The customer's tax ID when the invoice was drafted.

lines
object[]
required
subtotal
string
required

An amount in euros as a decimal string with two decimals, such as "121.00".

Pattern: ^-?[0-9]+\.[0-9]{2}$
Example:

"121.00"

vat_amount
string
required

An amount in euros as a decimal string with two decimals, such as "121.00".

Pattern: ^-?[0-9]+\.[0-9]{2}$
Example:

"121.00"

irpf_rate
string
required

A decimal number as a string, such as "21" or "0.5".

Pattern: ^-?[0-9]{1,10}(\.[0-9]{1,6})?$
irpf_amount
string
required

An amount in euros as a decimal string with two decimals, such as "121.00".

Pattern: ^-?[0-9]+\.[0-9]{2}$
Example:

"121.00"

total
string
required

What the invoice charges, IRPF withheld already taken off.

Pattern: ^-?[0-9]+\.[0-9]{2}$
Example:

"121.00"

currency
string
required
Allowed value: "EUR"
notes
string
required
verifactu_status
enum<string>
required

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
fiscal_network
enum<string>
required

verifactu for an invoice issued through VERI*FACTU, or a draft that would go there. Empty for an invoice issued without it.

Available options:
verifactu,
tax_label
enum<string>
required

IGIC for a company in the Canary Islands.

Available options:
IVA,
IGIC
pdf_ready
boolean
required

The legal PDF is stored. Download it with Download the invoice PDF.

The invoice's payment link, when the owner has connected a Stripe account.

inactive once Melso switched the link off, as when the invoice is paid or voided.

Available options:
pending,
creating,
active,
inactive,
error,
unknown
email_delivery_status
enum<string>
required

The email of the issued invoice to the customer. error when it could not go out, such as a customer without an email. unknown when the answer was lost and the email may have reached the customer.

Available options:
pending,
sending,
sent,
error,
unknown
email_delivery_error
string | null
required
sent_at
string<date-time> | null
required
paid_at
string<date-time> | null
required

When it was first marked paid.

corrects_invoice_id
string<uuid> | null
required

On a corrective invoice, the invoice it corrects.

activity_id
string<uuid> | null
required
outstanding
string
required

What an issued or sent invoice still owes after the bank movements reconciled with it. 0.00 for any other status.

Pattern: ^-?[0-9]+\.[0-9]{2}$
Example:

"121.00"

collections
object[]
required

The bank movements reconciled with the invoice. Empty except on Get an invoice and Mark an invoice as paid.

created_at
string<date-time>
required
updated_at
string<date-time>
required