TGSS: empty results, 404 instead of 502
17/06/2026
Until today, when Sistema RED answered a query saying that there is nothing, the API returned it as 502, the same as an authority failure. For example:
SISTEMA RED: Error: 3543* NO EXISTEN DATOS PARA ESTA CONSULTASISTEMA RED: No hay registros para el movimiento seleccionado!SISTEMA RED: No se encontró el informe con la fecha solicitada.SISTEMA RED: No existe información para el período solicitado.SISTEMA RED: Error. El Empleado no está en situación de Alta. Consulte Situación de Empleado en la Empresa
For an integration that is indistinguishable from an outage, so the reasonable response was to retry — and retrying a query with no results always returns the same.
From now on:
| Code | When |
|---|---|
404 | TGSS answered and there is no data for that query. Final answer: do not retry. |
502 | TGSS rejects the operation for another reason, or answers unexpectedly. |
The response body does not change: same success, message and errors.tgss with the authority's text. Only the HTTP status changes.
It affects TGSS queries, reports and duplicates, among others: Employee status, CCC status, IDC, Affiliate work history, TA document duplicates, FIE files, Maternity/paternity duplicate, Check IT, Collective agreements query and A1 form.
What to check in your integration: if you treat any 5xx as "retry", 404 now leaves that path and you stop repeating queries that will not change.