curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/social-security/affiliations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"employee_id": "6a1f0c2e-4b3d-4e5f-8a9b-0c1d2e3f4a5b",
"action": "alta",
"effective_date": "2026-11-02"
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/social-security/affiliations"
payload = {
"employee_id": "6a1f0c2e-4b3d-4e5f-8a9b-0c1d2e3f4a5b",
"action": "alta",
"effective_date": "2026-11-02"
}
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({
employee_id: '6a1f0c2e-4b3d-4e5f-8a9b-0c1d2e3f4a5b',
action: 'alta',
effective_date: '2026-11-02'
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/social-security/affiliations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"employee_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action": "alta",
"effective_date": "2023-12-25",
"status": "pending",
"created_at": "2023-11-07T05:31:56Z",
"submitted_at": "2023-11-07T05:31:56Z",
"resolution": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"content_type": "<string>",
"size_bytes": 123,
"url": "<string>"
},
"rejection_reason": "<string>"
}{
"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": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}Request an alta, baja or variación
Asks Melso to communicate an employee’s registration (alta), deregistration (baja) or data change (variacion) to the TGSS through the Sistema RED, under the company’s TGSS mandate.
curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/social-security/affiliations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"employee_id": "6a1f0c2e-4b3d-4e5f-8a9b-0c1d2e3f4a5b",
"action": "alta",
"effective_date": "2026-11-02"
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/social-security/affiliations"
payload = {
"employee_id": "6a1f0c2e-4b3d-4e5f-8a9b-0c1d2e3f4a5b",
"action": "alta",
"effective_date": "2026-11-02"
}
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({
employee_id: '6a1f0c2e-4b3d-4e5f-8a9b-0c1d2e3f4a5b',
action: 'alta',
effective_date: '2026-11-02'
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/social-security/affiliations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"employee_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action": "alta",
"effective_date": "2023-12-25",
"status": "pending",
"created_at": "2023-11-07T05:31:56Z",
"submitted_at": "2023-11-07T05:31:56Z",
"resolution": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"content_type": "<string>",
"size_bytes": 123,
"url": "<string>"
},
"rejection_reason": "<string>"
}{
"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": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}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
The employee, with tax_id, social_security_number and employment filled.
alta, baja, variacion Required for a baja.
end_of_contract, dismissal, objective_dismissal, voluntary_resignation, probation_not_passed, retirement, other For a baja, the vacation paid and not taken, which extends the contribution period.
x >= 0For a variacion, the new employment data.
Show child attributes
Show child attributes
Response
The request, pending until it reaches the TGSS.
alta, baja, variacion pending, submitted, accepted, rejected The TGSS's resolution once accepted.
Show child attributes
Show child attributes