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

# Collect the digital certificate

> Send the owner a Melso link to upload the company's digital certificate, and follow its status until it expires.

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

> [!NOTE]
>
> These calls work with a company key in its own company, or with a
> [partner key](https://docs.melso.ai/api/partner/acting-for-companies.md) in any company of the firm.
> `$MELSO_API_KEY` is either one.

Melso files with the company's own digital certificate: a `.p12` or `.pfx`
file and its password. There are two ways to get it to Melso:

* **Upload it from your product** with
  [Upload a certificate](https://docs.melso.ai/api/reference/digital-certificate/upload-certificate.md).
  See [Digital certificate](https://docs.melso.ai/api/partner/guides/certificate.md) for the holder
  rules and the refusals.
* **Let the owner upload it on a Melso page**, with a link. This guide covers
  that way: your product never sees the file or the password.

## 1. Create a link

```bash theme={null}
curl -X POST https://api.melso.ai/v1/companies/$COMPANY_ID/certificate-links \
  -H "Authorization: Bearer $MELSO_API_KEY"
```

```json theme={null}
{
  "url": "https://melso.ai/secrets/new#token",
  "expires_at": "2026-12-08T09:30:00Z"
}
```

* The link works once and for 7 days.
* It takes only a certificate of the company's NIF, or of its representative
  for a company.
* A new link cancels the earlier one.

## 2. Open it for the owner

Open `url` in a new tab. The page cannot be embedded in a frame.

## 3. Follow the status

```bash theme={null}
curl https://api.melso.ai/v1/companies/$COMPANY_ID/certificate \
  -H "Authorization: Bearer $MELSO_API_KEY"
```

| `status` | Meaning |
| - | - |
| `missing` | Not uploaded yet. |
| `valid` | Melso can file. |
| `expiring` | Under 30 days left. Send the owner a new link. |
| `expired` | Melso cannot file until the owner uploads a new one. |

The company's `certificate` field carries the same status, so a list of
companies tells you whom to remind.


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