Skip to main content
Each use case below starts from something a person asks and lists the calls an assistant makes, in order. Every example is a tools/call request body. The identifiers are placeholders: use the ones your own company returns. The connection lists only the tools and actions the company’s plan, your role and the setup state allow. If a call here is not listed for you, read Permissions and approvals.

Confirm the company

Do this first on every new connection. company takes no arguments and changes nothing.
Check name and kind with the person. kind is freelancer for an autónomo and company for an empresa. If the answer has onboarding, the autónomo’s setup is pending: go to Complete the fiscal profile.

Record a receipt or a supplier invoice

Use expenses. The file goes to Melso in three calls.
1

Ask for an upload link

Send the file’s name, type and exact size. Accepted types are PDF, JPEG, PNG, WebP and GIF, up to 15 MB.
The answer has upload_id, upload_url, the headers to send, expires_at and web_upload_url.
2

PUT the file to upload_url

Send the file’s exact bytes with the returned headers. This request goes to the upload link, not to the MCP endpoint.
3

Read the uploaded file

The file is read in the background. The answer has a job_id.
4

See what it became

The job is queued, done or failed. A finished job names the expense or the income it recorded, with its review codes.
Two failures ask you for something:
  • direction_unknown: ask whether the company issued or received the document, then queue it again with direction.
  • country_unknown: ask the supplier’s or customer’s country, then retry with counterparty_country and the direction the error names.
Queue the document again with what the person answered:
A client that cannot upload files shares web_upload_url instead. The person drops the files in the web app.

Record an expense from its details

When there is no file, record the expense by hand. total must equal subtotal plus vat_amount. Leave category out when you are not sure.
deductible defaults to unsure. It is a classification, not approval of a deduction.

Draft an invoice for a customer

Use customers and invoices.
1

Find the customer

2

Save the customer if they are new

3

Save an unnumbered draft

irpf_rate is for an autónomo who is a professional. A company’s invoice leaves it out. To change the draft before it is approved, call prepare again with the draft’s id.
4

Get the approval page

Show the person the preview and the approval_url. The owner issues the invoice there, in the signed-in web app.
5

Check the outcome later

request_approval returns a link, not an outcome. Do not say the invoice was issued until get shows it.

Correct an issued invoice

An issued invoice cannot be edited. correct prepares a corrective draft with the differences. A negative unit_price credits the original and a positive one increases it. The reason goes in notes, and it is required.
The original stays as it was. Then call request_approval with the corrective draft’s id, as in the previous use case.

Record a payment received

Use payments once the person confirms the invoice was paid in full.
It records money already received. It does not charge a card or move money, and there is no partial payment.

What is due this quarter

Use taxes.
Each entry has the form, its deadline, the last day to pay by direct debit and its status. It also says whether Melso calculates the form or only reminds. A calculated form carries a filing_id that links its return. For the amounts, list the calculated returns:
A return with is_preview true is an estimate. It has an amount only: no boxes, no approval page and no import file.

Explain a return and hand over its approval

1

Read the return

Use the boxes and the review codes to explain each figure.
2

Get the approval page

Share approval_url. The owner authorizes the exact version there. For an estimate the answer has approval_required false and no link: say it is an estimate.
Authorization opens a case for Melso’s professionals to review and file. Do not tell the person the return is filed until its status is filed. Do not ask them to file an included return themselves.

Get the AEAT import file

Available for the 303, 130, 111 and 115.
The answer has filename, content_type and content_base64. Write the decoded bytes unchanged. The file is preparation: it is not an authorization and not proof of filing.

Fix a record

Read the record first. update needs the expected_version you read, and a stale version is refused.
Income works the same way. vat_lines replaces every current line.
Updating an expense clears its review codes and resets any earlier review.

Delete a duplicate

Ask the person to confirm first.
The file stays in the company’s documents. The call is refused when a tax return that covers the record’s date was already approved or filed. Do not retry it: the person makes that correction in the web app.

Complete the fiscal profile

Use fiscal_profile. It is listed for the company’s owner or an admin, and it is the tool to use while an autónomo’s setup is pending.
1

See what is missing

2

Save whether they are already registered

3

Save what the person told you

Send every field from one message in one call.
The answer is the whole profile. errors names each refused field, deduced names what the server filled in so you can confirm it, and missing lists what is still required. Valid fields are saved even when another is refused.
An empresa has no guided setup, and the Melso team sets it up. An autónomo can also finish in the web app’s guided setup. See Setup and fiscal profile.

Report a problem or ask for work

Use support_tickets_create.
For work that no tool covers, such as a registration, use service_request and put every detail in the description.
Filing the same title again within 24 hours returns the ticket already filed. Never put passwords, certificates or other secrets in a ticket.