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

# Digital certificate

> Upload a customer's digital certificate from your product, or let the owner upload it. Which certificates Melso accepts and how to follow their expiry.

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

Melso files each return with a digital certificate of the business: a `.p12`
or `.pfx` file and its password. Until a valid one is on file, `missing` holds
`certificate` and Melso cannot file.

## Which certificate

| Business | Melso accepts |
| - | - |
| Self-employed | Their own personal certificate. Its NIF must be the company's `tax_id`. |
| S.L., S.L.U., S.L.P. | A representative certificate of the company, a certificate issued to the company's CIF, or the personal certificate of one of its administrators. |

Melso checks the holder on upload. A certificate of anyone else answers `400`
`certificate_company_mismatch`.

## Option A: upload it from your product

Your customer gives you the file and its password in your own interface. Send
both with [Upload a certificate](https://docs.melso.ai/api/reference/digital-certificate/upload-certificate.md):

```bash theme={null}
curl https://api.melso.ai/v1/companies/$COMPANY_ID/certificate \
  -H "Authorization: Bearer $MELSO_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"file\": \"$(base64 -i certificate.p12)\",
    \"password\": \"$CERTIFICATE_PASSWORD\"
  }"
```

```json theme={null}
{
  "status": "valid",
  "holder_name": "MARTIN PEREZ LUCIA",
  "holder_tax_id": "00000000T",
  "represents_tax_id": "B00000000",
  "expires_at": "2028-03-14",
  "uploaded_at": "2026-12-01T09:40:00Z"
}
```

* The file is at most 1 MB. Melso uses the password only to read the
  certificate, and stores both encrypted. Neither is ever returned.
* Do not keep the file or the password on your side after the call.
* With several valid certificates on file, Melso files with the one that
  expires last.

| Status | `code` | Meaning |
| - | - | - |
| `400` | `certificate_wrong_password` | The password does not open the file. |
| `400` | `certificate_unreadable` | Not a `.p12` or `.pfx` file, or damaged. |
| `400` | `certificate_expired` | The certificate has expired. |
| `400` | `certificate_key_unsupported` | The key type is not supported. |
| `400` | `certificate_key_mismatch` | The private key does not match the certificate. |
| `400` | `certificate_company_mismatch` | The holder is not the business or one of its administrators. |
| `409` | `tax_id_missing` | The company has no NIF yet. Send `tax_id` first. |

## Option B: the owner uploads it on a Melso page

When you prefer never to handle the file, [create a certificate link](https://docs.melso.ai/api/reference/digital-certificate/create-certificate-link.md)
and open its `url` for the owner in a new tab. The page cannot be embedded in a
frame. The link works once and for 7 days, and a new link cancels the earlier
one.

## Follow its status

[Get the certificate status](https://docs.melso.ai/api/reference/digital-certificate/get-certificate.md)
answers `missing`, `valid`, `expiring` (under 30 days left) or `expired`. Each
company carries the same value in `certificate`.

Subscribe to [`certificate.expiring` and `certificate.expired`](https://docs.melso.ai/api/partner/webhooks)
to ask the owner for a new one in time.

## Filing with your firm's certificate

If your firm is a *colaborador social* of the AEAT, or holds the business's
power of attorney (*apoderamiento*), Melso can file with your firm's own
certificate instead. Write to [hello@melso.ai](mailto:hello@melso.ai) to set
it up.


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