Skip to main content
POST
Import a VAT book
Beta. Melso does not serve this operation yet, and its fields can still change. See what is live.
Permission: books:write. Send an Idempotency-Key to retry safely. Send a row for each VAT rate of each invoice, as the libro registro de facturas recibidas or expedidas has them: rows with the same invoice number and counterparty NIF are one invoice. At most 50,000 rows: split a larger book by quarter. Each invoice is created, skipped or refused. skipped are the invoices Melso already has, by counterparty NIF and invoice number, with the record that has them. refused names each row and why, such as invalid_date, missing_number, vat_mismatch or conflicting_invoice (the same invoice with another date or NIF); fix them in your program and import those rows again. The rest are created, and the tax returns count them.

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

received: the libro de facturas recibidas, saved as expenses. issued: the libro de facturas expedidas, saved as income.

Available options:
received,
issued
rows
object[]
required
Required array length: 1 - 50000 elements

Response

The import, with each invoice created, skipped or refused.

id
string<uuid>
required
book
enum<string>
required
Available options:
received,
issued
rows
integer
required

The rows received.

created
object[]
required

The invoices recorded.

skipped
object[]
required

The invoices Melso already had, by counterparty NIF and invoice number.

refused
object[]
required

The rows that cannot be recorded, and why. Nothing of their invoice was saved.

created_at
string<date-time>
required
period
object

The dates of the first and the last invoice.