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)

FieldTypeRequiredDescription
nifstring✅ YesTaxpayer NIF (e.g. "5000537039")
privateKeystring✅ YesTaxpayer 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

FieldTypeDescription
successbooleantrue, request processed successfully
totalnumberTotal number of series found
seriesarrayList of numbering series
series[].codigostringUnique series code (e.g. FT3926S9043N)
series[].anostringSeries issue year
series[].tipoDocumentostringDocument type: FT, FR, NC, ND, RC, etc.
series[].estadostring"activa", series is available for issuance
series[].dataCriacaostringSeries creation date/time (ISO 8601)
series[].primeiroDocumentostringFirst document number of the series
series[].nifstringNIF of the owning taxpayer
series[].nomestringTaxpayer 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

HTTPcodeMessageCause
401UNAUTHORIZEDNot authorized.API Key was not sent
401UNAUTHORIZEDInvalid API Key.API Key does not exist or was revoked
403FORBIDDENInsufficient scope.The key does not have the series:listar scope

Validation Errors

HTTPcodeMessageCause
400INVALID_JSONInvalid JSON body.The request body is not valid JSON
400VALIDATION_ERRORInvalid payload. Required fields: nif, privateKey.Missing nif or privateKey
400VALIDATION_ERRORToo small: expected string to have >=1 charactersnif or privateKey empty

AGT Errors

HTTPcodeMessageCause
502AGT_ERRORsecretOrPrivateKey must be an asymmetric key when using RS256Invalid or corrupt private key
502AGT_ERRORCommunication error with AGTAGT 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

CodeNameCodeName
FTInvoiceNCCredit Note
FRInvoice/ReceiptNDDebit Note
FAAdvance InvoiceRCIssued Receipt
FGGlobal InvoiceRGGeneral Receipt
GFGeneric InvoiceARCollection Notice/Receipt