> ## 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.

# Approvals

> Let the company approve the exact version of each tax return inside your product, and send Melso the evidence so its professionals file it.

> [!WARNING]
>
> **Beta.** Melso does not serve this endpoint yet, and its fields can still
> change. Delegated approval is enabled per firm, once its partner agreement
> covers it.

Melso files no return without the company's approval of its exact version. With
delegated approval, that approval happens in your product: your customer never
leaves it and never sees a Melso page.

Neither you nor Melso approves on the company's behalf. You authenticate the
person, show them the return, record their consent, and send Melso the
evidence.

## The flow

**1. A return is ready**

You get [`tax_return.approval_pending`](https://docs.melso.ai/api/partner/webhooks). Read the return
with [Get a tax return](https://docs.melso.ai/api/reference/tax-returns/get-tax-return.md). Its
`version` is a hash of exactly what will be filed: the model, the period and
every figure.

**2. The person approves in your product**

Show the return to an authenticated person of the company: the self-employed
person, or an administrator of the company. Record who, when, from where, and
the `version` they saw.

**3. Send the evidence**

[Approve a tax return](https://docs.melso.ai/api/reference/tax-returns/approve-tax-return.md):

```bash theme={null}
curl https://api.melso.ai/v1/companies/$COMPANY_ID/tax-returns/$TAX_RETURN_ID/approval \
  -H "Authorization: Bearer $MELSO_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "version": "9f2c1a7e0b4d",
    "approved_by": {
      "name": "Lucía Martín Pérez",
      "email": "lucia@example.com",
      "tax_id": "00000000T",
      "role": "administrator"
    },
    "approved_at": "2026-12-18T10:04:31Z",
    "ip": "203.0.113.24",
    "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_1 like Mac OS X)",
    "reference": "audit_7731"
  }'
```

Melso stores it as the company's consent and answers with the return,
`approved`.

**4. Melso files it**

Melso's professionals file the return with the AEAT. You get
`tax_return.filed`, with the AEAT's reference. Show a return as filed only
then.

## Refusals

| Status | `code` | Meaning |
| - | - | - |
| `403` | `delegated_approval_not_enabled` | Your firm does not have delegated approval yet. |
| `409` | `version_changed` | The return changed after the person saw it. Show the new version and ask again. |
| `409` | `conflict` | The return is not waiting for approval, or is approved already. |
| `422` | `approver_not_recognized` | `approved_by` is not the self-employed person or an administrator Melso has for the company. |

## What you keep

Keep your own record of each approval, with the person's authentication, for as
long as the return can be inspected: four years from the end of its filing
period. `reference` links Melso's record to yours.

## Without delegated approval

[Create an approval link](https://docs.melso.ai/api/reference/tax-returns/create-tax-return-approval-link.md)
instead, and open it for a member of the company. They approve on a Melso page.


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