Check Status by requestId
GET /v2/documentos/{requestId} Checks the validation result of a document without resending the NIF or private key. The gateway uses the credentials cached at issuance time.
Additive route: This is a simplified way to check document status.
POST /v2/documentos/statuskeeps working normally and should be used as a fallback whenever the cache has expired.
How it works
When you successfully issued a document via POST /v2/documentos/emitir, the gateway automatically stored the company credentials (NIF + private key) in an encrypted cache, associated with the returned requestIdAGT.
When you call this route, the gateway:
- Verifies that the
requestIdbelongs to your API Key - Retrieves the NIF from the
requestId → NIFmapping - Retrieves the encrypted private key of the company
- Queries AGT and returns the status
You therefore do not need to store the private key in your own system to check status — as long as the cache is still valid.
Request
Authentication
x-api-key: feak_... or
Authorization: Bearer feak_... Required scope: facturas:consultar or facturas:emitir or *
Path Parameters
| Field | Type | Required | Description |
|---|---|---|---|
requestId | string | ✅ Yes | The requestIdAGT returned by the emitir endpoint |
Example
GET /v2/documentos/202600002471491 Response
Success (200 OK)
The response format is identical to POST /v2/documentos/status:
{
"success": true,
"requestId": "202600002471491",
"resultCode": "0",
"resultado": "All documents valid",
"documentos": [
{
"numero": "FT FT3926S9043N/1",
"status": "valido"
}
]
} Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | true, query performed successfully |
requestId | string | The ID of the queried request |
resultCode | string | Global result code (see table below) |
resultado | string | Human-readable description of resultCode (respects Accept-Language) |
documentos | array | List of documents and their statuses |
Note: The
resultadofield is translated according to theAccept-Languageheader (ptoren). Other fields (resultCode,status,codigo) are technical codes and are not translated.
resultCode Meaning
| Code | Meaning | What to do |
|---|---|---|
0 | All documents valid ✅ | Document was accepted by AGT |
1 | Valid and invalid documents ⚠️ | Check documentos[].status field |
2 | No document valid ❌ | Correct errors and reissue |
7 | Premature query ⏳ | Wait and repeat the request |
8 | Processing in progress ⏳ | Wait and repeat the request |
9 | Processing cancelled ❌ | Contact AGT support |
Errors
| HTTP | code | Message | Cause |
|---|---|---|---|
| 401 | UNAUTHORIZED | Not authorized. | API Key was not sent |
| 403 | FORBIDDEN | Insufficient scope. | The key does not have query scope |
| 404 | REQUEST_NOT_FOUND | Request not found. | The requestId does not belong to this API Key |
| 428 | CREDENTIALS_REQUIRED | Credentials missing or expired. | Cache expired (72h) — use POST /v2/documentos/status |
| 502 | AGT_ERROR | Error communicating with AGT. | Failed to contact AGT |
About the 428 error
Credentials are cached for 72 hours after issuance. If you check the status after that period, you will receive 428 CREDENTIALS_REQUIRED. In that case, resend the NIF and private key in POST /v2/documentos/status, which keeps working with no time limit (as long as the record exists at AGT).
Code Examples
TypeScript / Node.js
const API_KEY = "feak_...";
const GATEWAY_URL = "https://connect.factflexi.com";
async function checkStatus(requestId: string) {
const response = await fetch(
`${GATEWAY_URL}/v2/documentos/${requestId}`,
{ headers: { "x-api-key": API_KEY } }
);
const data = await response.json();
if (!data.success) {
if (data.code === "CREDENTIALS_REQUIRED") {
// Cache expired — use POST /status with NIF + privateKey
console.log("Cache expired, use POST /v2/documentos/status");
}
throw new Error(`${data.code}: ${data.error}`);
}
console.log(`Result: ${data.resultado} (code: ${data.resultCode})`);
return data;
}
// Usage
const status = await checkStatus("202600002471491"); Python
import requests
API_KEY = "feak_..."
GATEWAY_URL = "https://connect.factflexi.com"
def check_status(request_id: str) -> dict:
response = requests.get(
f"{GATEWAY_URL}/v2/documentos/{request_id}",
headers={"x-api-key": API_KEY},
)
data = response.json()
if not data.get("success"):
raise Exception(f"{data.get('code')}: {data.get('error')}")
print(f"Result: {data['resultado']} (code: {data['resultCode']})")
return data
status = check_status("202600002471491") cURL
curl -s https://connect.factflexi.com/v2/documentos/202600002471491
-H "x-api-key: feak_..." When to use this route vs POST /status
| Situation | Recommended route |
|---|---|
| You just issued a document (less than 72h ago) | GET /v2/documentos/{requestId} — simpler |
| More than 72h have passed | POST /v2/documentos/status with NIF + private key |
| You want full control over the credentials sent | POST /v2/documentos/status |
| You don’t want to store the private key in your system | GET /v2/documentos/{requestId} |