Download the AEAT import file
curl --request GET \
--url https://api.melso.ai/v1/companies/{company_id}/tax-returns/{tax_return_id}/aeat-file \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/tax-returns/{tax_return_id}/aeat-file"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.melso.ai/v1/companies/{company_id}/tax-returns/{tax_return_id}/aeat-file', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<string>{
"error": "invalid token",
"code": "unauthorized",
"request_id": "req_01JAB3K9X2"
}{
"error": "The tax service is not active for this company",
"code": "tax_service_required",
"request_id": "req_01JAB3K9X2"
}{
"error": "invoice not found",
"code": "not_found",
"request_id": "req_01JAB3K9X2"
}{
"error": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}Tax returns
Download the AEAT import file
Returns the fixed-width file the AEAT’s online form imports, for a quarterly 303 or 130 and for a 111 or 115, encoded in ISO-8859-1.
GET
/
companies
/
{company_id}
/
tax-returns
/
{tax_return_id}
/
aeat-file
Download the AEAT import file
curl --request GET \
--url https://api.melso.ai/v1/companies/{company_id}/tax-returns/{tax_return_id}/aeat-file \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/tax-returns/{tax_return_id}/aeat-file"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.melso.ai/v1/companies/{company_id}/tax-returns/{tax_return_id}/aeat-file', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<string>{
"error": "invalid token",
"code": "unauthorized",
"request_id": "req_01JAB3K9X2"
}{
"error": "The tax service is not active for this company",
"code": "tax_service_required",
"request_id": "req_01JAB3K9X2"
}{
"error": "invoice not found",
"code": "not_found",
"request_id": "req_01JAB3K9X2"
}{
"error": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}Live capability. Melso runs this in production today. Partner keys reach it once your partner account is enabled. See Availability.
Authorizations
Your partner secret key, mk_live_… for real companies or mk_test_…
for test companies. Keep it on your servers. See
Authentication.
Path Parameters
The company's ID. Every company-scoped call works in exactly this company.
Response
The import file, named like 303_2026_3T.txt.
The response is of type string.