curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/tax-returns/{tax_return_id}/attested-approvals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_version": 4,
"approver": {
"name": "Lucía Martín Pérez",
"email": "lucia@example.com",
"role": "owner",
"external_user_id": "usr_8f2k1"
},
"evidence": {
"approved_at": "2026-10-14T09:12:44Z",
"ip_address": "203.0.113.24",
"user_agent": "Mozilla/5.0",
"shown_document_sha256": "9f2c4e0b7d1a3c5e8f6a2b4d0c1e3f5a7b9d2c4e6f8a0b1c3d5e7f9a2b4c6d8e"
}
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/tax-returns/{tax_return_id}/attested-approvals"
payload = {
"expected_version": 4,
"approver": {
"name": "Lucía Martín Pérez",
"email": "lucia@example.com",
"role": "owner",
"external_user_id": "usr_8f2k1"
},
"evidence": {
"approved_at": "2026-10-14T09:12:44Z",
"ip_address": "203.0.113.24",
"user_agent": "Mozilla/5.0",
"shown_document_sha256": "9f2c4e0b7d1a3c5e8f6a2b4d0c1e3f5a7b9d2c4e6f8a0b1c3d5e7f9a2b4c6d8e"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
expected_version: 4,
approver: {
name: 'Lucía Martín Pérez',
email: 'lucia@example.com',
role: 'owner',
external_user_id: 'usr_8f2k1'
},
evidence: {
approved_at: '2026-10-14T09:12:44Z',
ip_address: '203.0.113.24',
user_agent: 'Mozilla/5.0',
shown_document_sha256: '9f2c4e0b7d1a3c5e8f6a2b4d0c1e3f5a7b9d2c4e6f8a0b1c3d5e7f9a2b4c6d8e'
}
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/tax-returns/{tax_return_id}/attested-approvals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"model": "<string>",
"period": "2026-Q3",
"status": "draft",
"is_estimate": true,
"amount": "121.00",
"version": 123,
"approved_version": 123,
"approved_at": "2023-11-07T05:31:56Z",
"deadline": "2023-12-25",
"direct_debit_deadline": "2023-12-25",
"boxes": [
{
"box": "<string>",
"key": "<string>",
"amount": "121.00"
}
],
"records": [
{
"tax_id": "<string>",
"name": "<string>",
"country": "<string>",
"key": "<string>",
"amount": "121.00",
"withheld": "121.00",
"quarters": [
"121.00"
],
"missing": [
"tax_id"
]
}
],
"review": [
"missing_tax_id"
],
"unconfirmed_expenses": 123,
"filed_at": "2023-11-07T05:31:56Z",
"filing": {
"filed_at": "2023-11-07T05:31:56Z",
"reference": "<string>",
"csv": "<string>",
"receipt": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"content_type": "<string>",
"size_bytes": 123,
"url": "<string>"
},
"filed_by": "melso"
},
"recalculated": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "lines[0].vat_rate must be 21, 10, 4 or 0",
"code": "invalid_invoice",
"request_id": "req_01JAB3K9X2"
}{
"error": "invalid token",
"code": "unauthorized",
"request_id": "req_01JAB3K9X2"
}{
"error": "Review and approve in the authenticated web application",
"code": "person_required",
"request_id": "req_01JAB3K9X2"
}{
"error": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}Attest an approval from your interface
For partners that show the return inside their own product.
curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/tax-returns/{tax_return_id}/attested-approvals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_version": 4,
"approver": {
"name": "Lucía Martín Pérez",
"email": "lucia@example.com",
"role": "owner",
"external_user_id": "usr_8f2k1"
},
"evidence": {
"approved_at": "2026-10-14T09:12:44Z",
"ip_address": "203.0.113.24",
"user_agent": "Mozilla/5.0",
"shown_document_sha256": "9f2c4e0b7d1a3c5e8f6a2b4d0c1e3f5a7b9d2c4e6f8a0b1c3d5e7f9a2b4c6d8e"
}
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/tax-returns/{tax_return_id}/attested-approvals"
payload = {
"expected_version": 4,
"approver": {
"name": "Lucía Martín Pérez",
"email": "lucia@example.com",
"role": "owner",
"external_user_id": "usr_8f2k1"
},
"evidence": {
"approved_at": "2026-10-14T09:12:44Z",
"ip_address": "203.0.113.24",
"user_agent": "Mozilla/5.0",
"shown_document_sha256": "9f2c4e0b7d1a3c5e8f6a2b4d0c1e3f5a7b9d2c4e6f8a0b1c3d5e7f9a2b4c6d8e"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
expected_version: 4,
approver: {
name: 'Lucía Martín Pérez',
email: 'lucia@example.com',
role: 'owner',
external_user_id: 'usr_8f2k1'
},
evidence: {
approved_at: '2026-10-14T09:12:44Z',
ip_address: '203.0.113.24',
user_agent: 'Mozilla/5.0',
shown_document_sha256: '9f2c4e0b7d1a3c5e8f6a2b4d0c1e3f5a7b9d2c4e6f8a0b1c3d5e7f9a2b4c6d8e'
}
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/tax-returns/{tax_return_id}/attested-approvals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"model": "<string>",
"period": "2026-Q3",
"status": "draft",
"is_estimate": true,
"amount": "121.00",
"version": 123,
"approved_version": 123,
"approved_at": "2023-11-07T05:31:56Z",
"deadline": "2023-12-25",
"direct_debit_deadline": "2023-12-25",
"boxes": [
{
"box": "<string>",
"key": "<string>",
"amount": "121.00"
}
],
"records": [
{
"tax_id": "<string>",
"name": "<string>",
"country": "<string>",
"key": "<string>",
"amount": "121.00",
"withheld": "121.00",
"quarters": [
"121.00"
],
"missing": [
"tax_id"
]
}
],
"review": [
"missing_tax_id"
],
"unconfirmed_expenses": 123,
"filed_at": "2023-11-07T05:31:56Z",
"filing": {
"filed_at": "2023-11-07T05:31:56Z",
"reference": "<string>",
"csv": "<string>",
"receipt": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"content_type": "<string>",
"size_bytes": 123,
"url": "<string>"
},
"filed_by": "melso"
},
"recalculated": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "lines[0].vat_rate must be 21, 10, 4 or 0",
"code": "invalid_invoice",
"request_id": "req_01JAB3K9X2"
}{
"error": "invalid token",
"code": "unauthorized",
"request_id": "req_01JAB3K9X2"
}{
"error": "Review and approve in the authenticated web application",
"code": "person_required",
"request_id": "req_01JAB3K9X2"
}{
"error": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}expected_version in your interface and approved it, and you send the
evidence. Melso records the attestation with the evidence and treats it
as that person’s approval. Requires a signed partner agreement that
defines who may approve and how evidence is kept.Authorizations
Your partner secret key, mk_live_… for real companies or mk_test_…
for test companies. Keep it on your servers. See
Authentication.
Headers
A unique key, such as a UUID, that makes a retried create safe. Reusing a key with a different body is refused.
255Path Parameters
The company's ID. Every company-scoped call works in exactly this company.
Body
Response
The return, approved, with the attestation recorded.
The return's UUID, or estimate:<model>:<period> for an estimate.
The form. Melso calculates 303, 130, 111, 115, 190, 180, 347, 349 and 390 today; a reminder form marked filed has its own model.
A year (2026), a quarter (2026-Q3), a month (2026-09) or an instalment (2026-1P).
^[0-9]{4}(-Q[1-4]|-(0[1-9]|1[0-2])|-[1-3]P)?$"2026-Q3"
draft: calculated, still recalculated from the records. approved: the owner authorized this exact version. filed: filed, with the administration's reference and receipt when Melso filed it.
draft, approved, filed An estimate has an amount only. It has no boxes, no version and no approval.
The result. Negative to offset or refund (303); 0.00 for an informative return.
^-?[0-9]+\.[0-9]{2}$"121.00"
Raised on every recalculation that changes the draft. Approval needs the exact version.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
What to check before approving.
missing_tax_id, cadastral_reference, eu_key_assumed, rates_assumed, volume_split Expenses in the return that are not yet confirmed as deductible.
Preview. The administration's evidence, when Melso filed the return.
Show child attributes
Show child attributes
For a filed return whose records changed afterwards, what it would be today. A difference may need a complementary or corrective return.