FGO API Documentation
Welcome to the FGO Invoicing API v7.0.
Base URLs
| Environment | URL |
|---|---|
| Test | https://api-testuat.fgo.ro/v1 |
| Production | https://api.fgo.ro/v1 |
Note: Test and production environments are separate and do not sync.
Getting Started
-
Create FGO Account
- Test: https://testuat.fgo.ro/inregistrare
- Production: https://www.fgo.ro/inregistrare
-
Create API User
- Go to FGO Settings → Users
- Generate API user to obtain a Private Key
- Production requires PRO or PREMIUM subscription
-
Define Registry
- In FGO Settings, verify Registry is defined
- Go to "Serii Documente" tab
Authentication
All API requests require three authentication parameters:
| Parameter | Type | Description |
|---|---|---|
CodUnic |
string | Your company fiscal code (CUI) |
Hash |
string | SHA-1 hash (see Hash Calculation section) |
PlatformaUrl |
string | Root URL of your application |
Rate Limits
The API enforces the following rate limits per API user:
| Endpoint Category | Rate Limit | Timeout |
|---|---|---|
| Invoice/Payment | 1 request/second | 15 seconds |
| Articles | 1 request/5 seconds (or 1/30s) | Standard |
Nomenclatures
Nomenclatures are reference lists of valid values for API fields.
Retrieve a nomenclature list by type.
Available Nomenclatures
| Type | Description |
|---|---|
tara |
Countries |
judet |
Counties |
tva |
VAT rates |
banca |
Banks |
tipincasare |
Payment types |
tipfactura |
Invoice types |
tipclient |
Client types |
localitati?judet=CODE |
Localities by county |
Example Request
GET /nomenclator/tipfactura HTTP/1.1
Host: api-testuat.fgo.ro
Content-Type: application/json
{
"CodUnic": "2864518",
"Hash": "8C3A7726804C121C6933F7D68494B439463996E2",
"PlatformaUrl": "https://yourapp.com"
}
Example Response
{
"Success": true,
"List": [
{
"Nume": "Normal",
"Valoare": "Factura"
},
{
"Nume": "Simplified",
"Valoare": "FacturaSimplificata"
}
]
}
Invoices
Manage invoices through dedicated endpoints.
Create Invoice
Create and emit a new invoice.
Rate limit: 1 request/second, 15 second timeout
Parameters
| Parameter | Type | Status | Description |
|---|---|---|---|
CodUnic |
string | Required | Company fiscal code (CUI) |
Hash |
string | Required | SHA-1 hash (see Hash Calculation) |
Serie |
string(50) | Required | Invoice series from FGO Settings |
Numar |
string(50) | Optional | Invoice number. Auto-generated if not provided. |
Valuta |
string(3) | Required | Currency code (e.g., RON, EUR) |
TipFactura |
string(50) | Required | Invoice type from nomenclature |
DataEmitere |
datetime | Optional | Issue date (yyyy-mm-dd) |
DataScadenta |
datetime | Optional | Due date from FGO settings |
Client[Denumire] |
string(255) | Required | Client name |
Client[CodUnic] |
string(128) | Optional | Client fiscal code (CUI/CNP) |
Client[Email] |
string(100) | Optional | Client email |
Client[Telefon] |
string(100) | Optional | Client phone |
Client[Tara] |
string(128) | Required | Country from nomenclature |
Client[Judet] |
string(100) | Optional | County (required if Country = RO) |
Client[Localitate] |
string(100) | Optional | Locality per nomenclature |
Client[Adresa] |
string(500) | Optional | Address format: Str., Nr., Bl., Sc., Et., Ap. |
Client[Tip] |
string(2) | Required | PF (individual) or PJ (legal entity) |
Continut[i][Denumire] |
string(1000) | Required | Product/service name |
Continut[i][NrProduse] |
decimal | Required | Quantity (format XXXX.XXX, ≠ 0) |
Continut[i][UM] |
string(5) | Required | Unit of measure (e.g., BUC, ORE, KG) |
Continut[i][CotaTVA] |
decimal | Required | VAT rate (e.g., 21 for 21%) |
Continut[i][PretUnitar] |
decimal | Optional | Unit price (for standard calculation) |
Continut[i][PretTotal] |
decimal | Optional | Total price including VAT (for reverse calc) |
PlatformaUrl |
string | Required | Root URL of your application |
Example Request
POST /factura/emitere HTTP/1.1
Host: api-testuat.fgo.ro
Content-Type: application/json
{
"CodUnic": "2864518",
"Hash": "8C3A7726804C121C6933F7D68494B439463996E2",
"Serie": "BV",
"Numar": "123",
"Valuta": "RON",
"TipFactura": "Factura",
"DataEmitere": "2024-03-25",
"Client": {
"Denumire": "Ionescu Popescu",
"Tara": "RO",
"Judet": "Bucuresti",
"Tip": "PF"
},
"Continut": [
{
"Denumire": "Servicii Consultanta",
"NrProduse": 2,
"UM": "ORE",
"CotaTVA": 21,
"PretUnitar": 100.00
}
],
"PlatformaUrl": "https://yourapp.com"
}
Example Response (Success)
{
"Success": true,
"Message": "",
"Factura": {
"Numar": "001",
"Serie": "BV",
"Link": "https://fgo.ro/facturi/001_BV.pdf",
"LinkPlata": "https://fgo.ro/plata/001_BV"
},
"InfoStoc": [
{
"CodConta": "A1",
"Nume": "Produs 1",
"Stoc": 10.0
}
]
}
Example Response (Error)
{
"Success": false,
"Message": "Client name is required"
}
Print Invoice
Generate a PDF of an existing invoice.
| Parameter | Type | Status |
|---|---|---|
CodUnic |
string | Required |
Hash |
string | Required |
Numar |
string(50) | Required |
Serie |
string(50) | Required |
PlatformaUrl |
string | Required |
Example Response
{
"Success": true,
"Message": "",
"Factura": {
"Numar": "001",
"Serie": "BV",
"Link": "https://fgo.ro/facturi/001_BV.pdf"
}
}
Delete Invoice
Permanently delete an invoice.
Required parameters: CodUnic, Hash, Numar, Serie, PlatformaUrl
Example Response
{
"Success": true,
"Message": "Invoice deleted successfully"
}
Cancel Invoice
Cancel an invoice (keeps it in history).
Required parameters: CodUnic, Hash, Numar, Serie, PlatformaUrl
Example Response
{
"Success": true,
"Message": "Invoice cancelled successfully"
}
Get Invoice Status
Retrieve the current status of an invoice.
Required parameters: CodUnic, Hash, Numar, Serie, PlatformaUrl
Example Response
{
"Success": true,
"Factura": {
"Numar": "1",
"Serie": "X",
"Valoare": "167.69",
"ValoareAchitata": "167.69"
}
}
Add Payment
⚠️ Decommissioned for FGO Pro. Available only for PREMIUM & ENTERPRISE.
Record a payment/collection for an invoice.
| Parameter | Type | Status | Description |
|---|---|---|---|
NumarFactura |
string(50) | Required | Invoice number |
SerieFactura |
string(50) | Required | Invoice series |
TipIncasare |
string(50) | Required | Payment type (from nomenclature) |
SumaIncasata |
decimal | Required | Amount (format XXXX.XX) |
DataIncasare |
datetime | Required | Payment date (yyyy-mm-dd hh:mm:ss) |
Reverse Invoice
Create a reversal/credit note for an invoice.
| Parameter | Status |
|---|---|
CodUnic, Hash, Numar, Serie |
Required |
SerieStorno, NumarStorno, DataEmitere |
Optional |
PlatformaUrl |
Required |
Add Tracking Number (AWB)
Attach a courier tracking number to an invoice.
| Parameter | Type | Status |
|---|---|---|
CodUnic, Hash, Numar, Serie |
string | Required |
AWB |
string(128) | Required |
PlatformaUrl |
string | Required |
Associated Invoices List
⚠️ ENTERPRISE plan only
List all invoices associated with a given invoice.
Example Response
{
"Success": true,
"Facturi": [
{
"Numar": "1",
"Serie": "X",
"Valoare": "167.69",
"ValoareAchitata": "167.69",
"DataEmitere": "2024-03-25"
}
]
}
Articles
Manage your product and service catalog.
List Articles
⚠️ ENTERPRISE only. Returns articles with stock flag.
Rate limit: 1 request/5 seconds (or 1/30sec from 01.07.2023)
| Parameter | Type | Status | Description |
|---|---|---|---|
CodUnic |
string | Required | Company fiscal code |
Hash |
string | Required | SHA-1 hash |
NrPagina |
int | Required | Page number (1-indexed) |
NrArticole |
int | Required | Items per page (default 50, max 200) |
PlatformaUrl |
string | Required | Platform URL |
Example Response
{
"Result": {
"Total": 1335,
"NrPagina": 1,
"NrArticole": 1,
"List": [
{
"Nume": "Product 1",
"PretUnitar": 100.00,
"UM": "BUC",
"CodConta": "00000101",
"CotaTva": 0.19,
"Stoc": 50
}
]
},
"Success": true
}
Get Article
Retrieve details of a specific article by code.
| Parameter | Type | Status |
|---|---|---|
CodUnic |
string | Required |
Hash |
string | Required |
CodArticol |
string | Required |
PlatformaUrl |
string | Required |
Get List
⚠️ DEPRECATED - Use ARTICOLEMODIFICATE instead
Retrieve multiple articles by code (max 30).
Modified Articles
⚠️ ENTERPRISE only
Rate limit: 1 request/30 minutes
Retrieve articles modified within a time window (up to 200).
| Parameter | Type | Status | Description |
|---|---|---|---|
CodUnic |
string | Required | Company fiscal code |
Hash |
string | Required | SHA-1 hash |
NumarOre |
int | Required | Hours lookback (default 24, max 170) |
NumarOrePanaLa |
int | Optional | End of window (enables pagination) |
PlatformaUrl |
string | Required | Platform URL |
Example Response
{
"Result": [
{
"Nume": "Product Updated",
"CodConta": "00000101",
"Stoc": 75,
"CodBare": "1234567890",
"UltimaUtilizare": "2024-03-25 20:45:00"
}
],
"Success": true
}
Warehouse
Retrieve warehouse/storage location information.
List all warehouses configured in your account.
Rate limit: 1 request/5 seconds
| Parameter | Type | Status |
|---|---|---|
CodUnic |
string | Required |
Hash |
string | Required |
PlatformaUrl |
string | Required |
Example Response
{
"Result": {
"List": [
{
"CodGestiune": "WH001",
"Nume": "Main Warehouse"
},
{
"CodGestiune": "WH002",
"Nume": "Secondary Storage"
}
]
},
"Success": true
}
API Playground
Test API endpoints directly.
Forms send JSON to FGO API.
Environment
Live Nomenclatures
Click to view nomenclatures:
Test Forms
Emitere
/factura/emitereÎncasare
/factura/incasarePrintare
/factura/printAnulare
/factura/anulareȘtergere
/factura/stergereStornare
/factura/stornareCode Examples
Implementation examples.
PHP
<?php
$apiUrl = "https://api.fgo.ro/v1/factura/emitere";
$data = [
"CodUnic" => "2864518",
"Hash" => strtoupper(sha1("2864518" . "CHEIE_PRIVATA" . "Ionescu Popescu")),
"Serie" => "BV",
"Valuta" => "RON",
"TipFactura" => "Factura",
"PlatformaUrl"=> "https://yourapp.com",
"Client" => [
"Denumire" => "Ionescu Popescu",
"Tip" => "PF",
"Tara" => "RO",
"Judet" => "Bucuresti"
],
"Continut" => [
[
"Denumire" => "Servicii Consultanta",
"NrProduse" => 2,
"UM" => "ORE",
"CotaTVA" => 21,
"PretUnitar" => 100.00
]
]
];
$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$response = curl_exec($ch);
$result = json_decode($response, true);
if ($result['Success']) {
echo "Factura emisa: " . $result['Factura']['Serie'] . $result['Factura']['Numar'];
} else {
echo "Eroare: " . $result['Message'];
}
curl_close($ch);
JavaScript (Node.js)
const crypto = require('crypto');
const API_URL = 'https://api.fgo.ro/v1/factura/emitere';
const codUnic = '2864518';
const cheiePrivata = 'CHEIE_PRIVATA';
const clientDenumire = 'Ionescu Popescu';
const hash = crypto.createHash('sha1')
.update(codUnic + cheiePrivata + clientDenumire)
.digest('hex').toUpperCase();
const body = {
CodUnic: codUnic,
Hash: hash,
Serie: 'BV',
Valuta: 'RON',
TipFactura: 'Factura',
PlatformaUrl: 'https://yourapp.com',
Client: {
Denumire: clientDenumire,
Tip: 'PF',
Tara: 'RO',
Judet: 'Bucuresti'
},
Continut: [{
Denumire: 'Servicii Consultanta',
NrProduse: 2,
UM: 'ORE',
CotaTVA: 21,
PretUnitar: 100.00
}]
};
const res = await fetch(API_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body)
});
const result = await res.json();
console.log(result);
Hash Calculation
All API requests require a SHA-1 hash. The hash varies by endpoint.
For Invoice Creation (Emitere)
Use the client name in the hash:
Hash = SHA1(CodUnic + PrivateKey + ClientName)
Example
| Parameter | Value |
|---|---|
CodUnic |
2864518 |
PrivateKey |
1234567890 |
ClientName |
Ionescu Popescu |
Hash |
8C3A7726804C121C6933F7D68494B439463996E2 |
For Other Invoice Operations
For Anulare, Stornare, Print, Incasare, StergereIncasare:
Hash = SHA1(CodUnic + PrivateKey + InvoiceNumber)
Example
| Parameter | Value |
|---|---|
CodUnic |
2864518 |
PrivateKey |
1234567890 |
InvoiceNumber |
123 |
Hash |
SHA1("28645181234567890123") |
For Articles
No additional data required:
Hash = SHA1(CodUnic + PrivateKey)
Note: All hashes are uppercase SHA-1. Use a SHA-1 library in your language.
Changelog
Version history and updates to the FGO API.
- Major API restructuring
- Enhanced error reporting
- Performance optimizations
- Added articolemodificate endpoint
- Rate limit adjustments
- Deprecated getlist endpoint
- New rate limits
- Enhanced invoice creation
- Added listfacturiasociate endpoint
- Deprecated incasare for Pro plan
- Added stornare (reversal) feature
- Adăugare metodă StergereIncasare
- Adăugare metodă listare articole /articol/list
- Emitere: afișare Serie, NrFactura și link download când factura există deja
- Articole: adăugare metodă list
- Emitere: adăugare câmp opțional Client[Strain] (true/false)
- Bug fix: actualizare stocuri
- Emitere: adăugare câmp opțional VerificareDuplicat (true/false)
- Adăugare metodă Stornare
- Adăugare câmp opțional DataScadenta
- Extindere nomenclator TipFactura (Avize)
- Extindere nomenclator Țară cu abrevieri
- Emitere: adăugare câmp opțional TvaLaIncasare
- Emitere: adăugare câmp opțional Client[IdExtern]
- Emitere: adăugare câmp opțional Client[Tip] (PF/PJ)
- Emitere: adăugare câmpuri opționale Serie și Numar
- Emitere: adăugare Continut[i][Descriere] și Continut[i][CodArticol]
- Mărire dimensiuni maxime câmpuri
- Adăugare metodă încasare factură
- Redenumire parametru Destinatar în Text
- Adăugare Continut[i][PretTotal] pentru calcul invers
- Adăugare parametri DataEmitere și TipFactura
- Adăugare parametri client: Email, Telefon, Tara, Adresa