> ## Documentation Index
> Fetch the complete documentation index at: https://docs.melso.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Melso MCP: https://mcp.melso.ai/mcp (OAuth; one company per connection). Documentation-search MCP: https://docs.melso.ai/mcp; it does not act on customer accounts. Melso API: https://api.melso.ai/v1, with a company API key or a partner key (early access); invoicing is live and the other operations are marked beta.
>
> Use the live tool list and respect company membership. Ask the person to approve the exact invoice or tax return version in the signed-in app. Melso's professionals prepare and file included returns after approval; an AI assistant does not file. A prepared file or an approval is not evidence of filing: only the AEAT's reference and receipt are. Keep credentials out of chat and logs.

# Send the books

> Send expenses, income, invoice files and VAT books for your companies. How Melso books them, avoids duplicates and picks the accounting account.

> [!WARNING]
>
> **Beta.** Melso does not serve these endpoints yet, and their fields can still
> change.

Melso keeps each company's books from what you send it. Every record updates
the company's tax estimates at once, and Melso's professionals review them
before any return.

## Choose how to send them

| You have | Send it with | Melso |
| - | - | - |
| The invoice file: a PDF or a photo | [Upload a document](https://docs.melso.ai/api/reference/documents/upload-document.md) | Reads it, books it as an expense or income, and keeps the file. |
| The figures, already extracted | [Create an expense](https://docs.melso.ai/api/reference/expenses/create-expense.md) or [create an income](https://docs.melso.ai/api/reference/income/create-income.md) | Books them as sent. |
| A whole quarter or year | [Import a VAT book](https://docs.melso.ai/api/reference/vat-book-imports/create-book-import.md) | Books every row, skips the ones already booked, refuses the ones that do not add up. |

Invoices the company issues through [Melso invoicing](https://docs.melso.ai/api/reference/invoices/create-invoice.md)
are booked already. Do not send them again.

## Send a document

The surest way: Melso reads the file itself and keeps it as evidence for the
AEAT.

```bash theme={null}
curl https://api.melso.ai/v1/companies/$COMPANY_ID/documents \
  -H "Authorization: Bearer $MELSO_PARTNER_KEY" \
  -F file=@makro-2026-11-28.pdf \
  -F kind_hint=expense
```

The answer is `202`, `processing`. Read the document again, or wait for its
webhook, until it is `booked` with its `expense_id`, `needs_review` for Melso's
professionals, or `duplicate` of an expense already booked.

## Send the figures

```bash theme={null}
curl https://api.melso.ai/v1/companies/$COMPANY_ID/expenses \
  -H "Authorization: Bearer $MELSO_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "supplier_tax_id": "A00000000",
    "supplier_name": "Distribuciones Ejemplo S.A.",
    "number": "F-2026-00123",
    "date": "2026-11-28",
    "vat_lines": [
      {"base": "180.00", "rate": "10", "vat": "18.00", "account": "601"},
      {"base": "40.00", "rate": "21", "vat": "8.40", "account": "602"}
    ],
    "total": "246.40"
  }'
```

### Duplicates and checks

Melso never refuses a record for looking odd. It books it and says why in
`warnings`:

| Warning | When |
| - | - |
| `possible_duplicate` | Another expense has the same supplier NIF and number, or, without a number, the same supplier NIF, date and total. `expense_id` names it. |
| `vat_mismatch` | A line's `vat` is not `base` × `rate`, beyond rounding. |

Delete the record if it was a mistake. A VAT book import is stricter: it skips
duplicates and refuses rows that do not add up, and its answer lists both.

### The accounting account

`account` is the Spanish chart of accounts (PGC) account, such as `600`
(goods), `601` (raw materials), `602` (other supplies) or `629` (other
services). Send it on each line of `vat_lines` to split one invoice, such as
food and cleaning products from the same supplier. Without it, Melso picks the
account from the company's activity and the expense's category.

### Credit notes

Send a credit note as an expense with negative amounts, and name the expense
it corrects in `rectifies_expense_id`.

## Import a VAT book

For a quarter's or a year's history, send the received or issued VAT book in
one call. Each row is an invoice: number, date, counterparty NIF and name,
base, rate, VAT and total. The answer lists the rows created, skipped as
duplicates, and refused with their reason.

## Everything else

Bank statements, payroll and the company's own invoices have their own
endpoints in the [Melso API](https://docs.melso.ai/api/overview.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.