List Series
POST /v2/series Gets all numbering series registered at AGT for a given taxpayer. Each series defines a range of fiscal documents that can be issued.
Why use this endpoint? Before issuing documents, you need to know which series are available. The series code (e.g. FT3926S9043N) is then used at the issue document endpoint to compose the document number (FT FT3926S9043N/1).
Request
Authentication
Include your API Key in one of these headers:
Authorization: Bearer feak_... or
x-api-key: feak_... Required scope: series:listar or *
Body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
nif | string | ✅ Yes | Taxpayer NIF (e.g. "5000537039") |
privateKey | string | ✅ Yes | Taxpayer RSA private key in PEM format |
Response
Success (200 OK)
{
"success": true,
"total": 2283,
"series": [
{
"codigo": "FT3926S9043N",
"ano": "2026",
"tipoDocumento": "FT",
"estado": "activa",
"dataCriacao": "2026-07-25T11:44:25.500512",
"primeiroDocumento": "1",
"nif": "5000537039",
"nome": "SONHE TESTE"
}
]
} Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | true, request processed successfully |
total | number | Total number of series found |
series | array | List of numbering series |
series[].codigo | string | Unique series code (e.g. FT3926S9043N) |
series[].ano | string | Series issue year |
series[].tipoDocumento | string | Document type: FT, FR, NC, ND, RC, etc. |
series[].estado | string | "activa", series is available for issuance |
series[].dataCriacao | string | Series creation date/time (ISO 8601) |
series[].primeiroDocumento | string | First document number of the series |
series[].nif | string | NIF of the owning taxpayer |
series[].nome | string | Taxpayer name |
Taxpayer Without Series
If the NIF has no registered series, the response is an empty array:
{
"success": true,
"total": 0,
"series": []
} Errors
Authentication Errors
| HTTP | code | Message | Cause |
|---|---|---|---|
| 401 | UNAUTHORIZED | Not authorized. | API Key was not sent |
| 401 | UNAUTHORIZED | Invalid API Key. | API Key does not exist or was revoked |
| 403 | FORBIDDEN | Insufficient scope. | The key does not have the series:listar scope |
Validation Errors
| HTTP | code | Message | Cause |
|---|---|---|---|
| 400 | INVALID_JSON | Invalid JSON body. | The request body is not valid JSON |
| 400 | VALIDATION_ERROR | Invalid payload. Required fields: nif, privateKey. | Missing nif or privateKey |
| 400 | VALIDATION_ERROR | Too small: expected string to have >=1 characters | nif or privateKey empty |
AGT Errors
| HTTP | code | Message | Cause |
|---|---|---|---|
| 502 | AGT_ERROR | secretOrPrivateKey must be an asymmetric key when using RS256 | Invalid or corrupt private key |
| 502 | AGT_ERROR | Communication error with AGT | AGT service unavailable |
Code Examples
TypeScript / Node.js
const API_KEY = "feak_bfc76ba48c0c286c9ce4bb2fcd7e178a399e329c59e529776bb5e01b0bfe8712";
const GATEWAY_URL = "https://connect.factflexi.com";
async function listarSeries(nif: string, privateKey: string) {
const response = await fetch(`${GATEWAY_URL}/v2/series`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": API_KEY,
},
body: JSON.stringify({ nif, privateKey }),
});
const data = await response.json();
if (!data.success) {
throw new Error(`${data.code}: ${data.error}`);
}
console.log(`Found ${data.total} series for NIF ${nif}`);
for (const s of data.series) {
console.log(` ${s.codigo}, ${s.tipoDocumento} ${s.ano}, ${s.estado}`);
}
return data.series;
}
// Usage
const series = await listarSeries("5000537039", `-----BEGIN PRIVATE KEY-----\n...`); Python
import requests
API_KEY = "feak_bfc76ba48c0c286c9ce4bb2fcd7e178a399e329c59e529776bb5e01b0bfe8712"
GATEWAY_URL = "https://connect.factflexi.com"
def listar_series(nif: str, private_key: str):
response = requests.post(
f"{GATEWAY_URL}/v2/series",
json={"nif": nif, "privateKey": private_key},
headers={
"Content-Type": "application/json",
"x-api-key": API_KEY,
},
)
data = response.json()
if not data.get("success"):
raise Exception(f"{data.get('code')}: {data.get('error')}")
print(f"Found {data['total']} series for NIF {nif}")
for s in data["series"]:
print(f" {s['codigo']}, {s['tipoDocumento']} {s['ano']}, {s['estado']}")
return data["series"]
# Usage
series = listar_series("5000537039", "-----BEGIN PRIVATE KEY-----\n...") PHP
<?php
define('API_KEY', 'feak_bfc76ba48c0c286c9ce4bb2fcd7e178a399e329c59e529776bb5e01b0bfe8712');
define('GATEWAY_URL', 'https://connect.factflexi.com');
function listarSeries(string $nif, string $privateKey): array {
$ch = curl_init(GATEWAY_URL . '/v2/series');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'x-api-key: ' . API_KEY,
],
CURLOPT_POSTFIELDS => json_encode([
'nif' => $nif,
'privateKey' => $privateKey,
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$data = json_decode($response, true);
if (!$data['success']) {
throw new Exception("{$data['code']}: {$data['error']}");
}
echo "Found {$data['total']} series for NIF {$nif}\n";
foreach ($data['series'] as $s) {
echo " {$s['codigo']}, {$s['tipoDocumento']} {$s['ano']}, {$s['estado']}\n";
}
return $data['series'];
}
// Usage
$series = listarSeries('5000537039', "-----BEGIN PRIVATE KEY-----\n..."); Document Types
| Code | Name | Code | Name |
|---|---|---|---|
FT | Invoice | NC | Credit Note |
FR | Invoice/Receipt | ND | Debit Note |
FA | Advance Invoice | RC | Issued Receipt |
FG | Global Invoice | RG | General Receipt |
GF | Generic Invoice | AR | Collection Notice/Receipt |