Skip to Content
AEAT

AEAT

Connect your applications to Tax Agency services.

Requests to AEAT have no fictitious mode: they are always real, also in the test environment and even with X-Saltra-Mode: test. See Environments and test mode.

HTTP header parameters

  • Authorization (string): API authorisation. Example: Bearer {token}
  • X-Cert-Secret (string) : Secret key associated with the client certificate.

Base URL

https://api.saltra.es/api/v4/aeat

Errors

Errors returned by the Social Security API, or validation errors.

Response parameters

  • success (boolean) : Returns “true” when everything is correct, and “false” when there are errors.
  • message (string) : The response message.
  • errors (array) : Errors captured by the API, either from AEAT or validation errors.
    • aeat: Errors related to AEAT.
    • regimen: Validation errors.
  • maintenance (boolean) : Set when AEAT is under maintenance.
  • retryable optional (boolean) : true on 503 responses where we could not communicate with the authority; retry after Retry-After. It is absent on 424 and on the unknown-outcome 503 of a write.

Response

Respuesta
{ "success": false, "message": "Página no operativa, inténtelo de nuevo más tarde. StatusCode: 500", "status": 500, "data": [], "errors": { "aeat": [ "Página no operativa, inténtelo de nuevo más tarde. StatusCode: 500" ], "regimen": ["El campo regimen es obligatorio."] }, "maintenance": true }

Status codes

When the failure is on the authority’s side (TGSS/RED System, SEPE, DEHU, AEAT, Navarre Tax Office) or in the connected system, the HTTP code tells you whether retrying is worthwhile. The body always follows the usual error format (success, message, status, data, errors): read it on every status code; the reason is in message.

CodeWhat happenedMarkersRetry?
424The authority answered and rejected the request, or rejected the digital certificate we presented. Where applicable, message starts with SISTEMA RED: , SEPE: or DEHU: .X-Saltra-Error: organism-rejected header when message carries one of those prefixes. No Retry-After.No. Fix the data (or change the certificate) before sending it again.
503 + Retry-AfterWe could not communicate with the authority: connection failure, timeout on a query, invalid response or service down.retryable: true and retry_after in the body; Retry-After (60 seconds by default) and X-Saltra-Error: organism-unavailable headers.Yes, after the seconds given by Retry-After.
503 without Retry-AfterUnknown outcome of a write (registration, deregistration, contract change, communication to SEPE…): the authority did not answer in time or did not confirm, and the request may have been registered.No retryable and no Retry-After; timeout: true when time ran out.Not blindly: check first whether it was registered (you could duplicate it).
503 + maintenance: trueThe authority is under maintenance or not operational.maintenance: true, retry_after and the Retry-After header.Yes, after the seconds given by Retry-After.

Saltra’s validation errors are still 422 (do not retry until the data is fixed).

Example of a retryable 503:

HTTP/1.1 503 Service Unavailable Content-Type: application/json Retry-After: 60 X-Saltra-Error: organism-unavailable
Respuesta 503 (reintentable)
{ "success": false, "message": "Error de conexión de SALTRA con el (SISTEMA RED).", "status": 503, "data": [], "errors": { "tgss": ["Error de conexión de SALTRA con el (SISTEMA RED)."] }, "maintenance": false, "retryable": true, "retry_after": 60 }

The API never returns 502 or 504 on purpose. If your client gets a 502, 504 or 52x, it is generated by the network infrastructure, not by the API, and does not carry Saltra’s body: treat it as a connection failure and, if it was a write, check whether it was registered before retrying. Until 26/10/2026 authority rejections came back as 502 and timeouts as 504 (see the changelog).

Rate limits

Authenticated requests are limited to 80 per minute for reads (GET) and 120 per minute for writes (POST). The limit is counted per certificate (if X-Cert-Secret is sent) or, failing that, per authenticated user, and per route. Unauthenticated requests are limited to 60 per minute per IP. The heavy-integration endpoints —GET /employee-situations and GET /ta-info-for-nss from Social Security, and GET /contrata/data from SEPE— share a lower combined quota of 30 requests per minute per certificate (or user): using one reduces the quota of the other two.

Saltra reports your quota status in the headers of every response, so you can pace your calls before running out.

HeaderTypeWhen it is sentWhat it means
X-Ratelimit-LimitintegerAlwaysRequests allowed per minute.
X-Ratelimit-RemainingintegerAlwaysRequests left in the current window.
X-Ratelimit-ResetUNIX timestampAlwaysMoment the window renews and X-Ratelimit-Remaining returns to its maximum.
Retry-AftersecondsOn 429 and on 503 when the authority is under maintenance (maintenance: true) or we could not communicate with it (retryable: true). Never on a 424 or on the unknown-outcome 503 of a write.Seconds to wait before retrying.

Example of a successful response:

HTTP/1.1 200 OK X-Ratelimit-Limit: 80 X-Ratelimit-Remaining: 45 X-Ratelimit-Reset: 1786012860

X-Ratelimit-Reset is an absolute instant, not a countdown: it stays the same across every response in the same window and only moves forward when the quota renews. Combined with X-Ratelimit-Remaining, it is what lets you space out requests as you approach the limit instead of stopping dead.

Once the limit is exceeded, the API responds 429 Too Many Requests and adds Retry-After:

HTTP/1.1 429 Too Many Requests X-Ratelimit-Limit: 80 X-Ratelimit-Remaining: 0 X-Ratelimit-Reset: 1786012860 Retry-After: 37

The body follows the usual error format:

{ "success": false, "status": 429, "message": "Too Many Requests" }

Wait the number of seconds given by Retry-After before retrying. Retrying early does not unblock you sooner: it consumes more quota and lengthens the wait.

Certificate of being up to date with tax obligations

Parameters

  • type (string) : Certificate type. Possible values:
    • C1: Being up to date with tax obligations in order to contract with the public sector.
    • T1: Being up to date with tax obligations in order to obtain transport authorisations.
    • B1: Being up to date with tax obligations in order to obtain public subsidies.
    • E1: Being up to date with tax obligations in order to obtain work/residence permits for foreign nationals.
    • G1: Being up to date with tax obligations. Generic (for a purpose other than the four above).
GET /report-corriente
{ "type": "C1" }

Response

Respuesta
{ "success": true, "message": "OK", "data": { "file": { "contentType": "application/pdf", "name": "document.pdf", "content": "base64" } } }

Obtain an AEAT certificate for Economic Activities Tax (IAE)

Parameters

  • period (integer) : Period.
GET /report-iae
{ "period": "2022" }

Response

Respuesta
{ "success": true, "message": "OK", "data": { "file": { "contentType": "application/pdf", "name": "document.pdf", "content": "base64" } } }

Obtain a certificate for contractors and subcontractors

Parameters

  • nif_entidad (string) : NIF of the entity.
  • entidad optional (string) : Surname and first name / registered name of the entity.
  • startDate optional (date) : Date, format YYYY-MM-DD.
GET /report-subcontractors
{ "nif_entidad": "B999999" }

Response

Respuesta
{ "success": true, "message": "OK", "data": { "file": { "contentType": "application/pdf", "name": "document.pdf", "content": "base64" } } }
Last updated on