v7.0

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

  1. Create FGO Account
    • Test: https://testuat.fgo.ro/inregistrare
    • Production: https://www.fgo.ro/inregistrare
  2. Create API User
    • Go to FGO Settings → Users
    • Generate API user to obtain a Private Key
    • Production requires PRO or PREMIUM subscription
  3. 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

Request Format

All POST requests must send a raw JSON body with the header Content-Type: application/json.

⚠️ Important: application/x-www-form-urlencoded and multipart/form-data are NOT supported. In PHP, passing an array directly to CURLOPT_POSTFIELDS sends form-encoded data and can crash the request — always use json_encode() with the Content-Type: application/json header.

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.

GET /nomenclator/{type}

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

POST /factura/emitere

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
Text string(2000) Optional Additional info (e.g. delegate name shown on the invoice)
Explicatii string(2000) Optional Additional explanations shown on the invoice
TvaLaIncasare bool Optional VAT on collection (true/false)
VerificareDuplicat bool Optional Duplicate check; only if true and IdExtern or Serie+Numar are sent
ValideazaCodUnicRo bool Optional Validate RO fiscal code for PJ clients. Defaults to true for RO PJ since 01.07.2024 (e-Factura)
IdExtern string(36) Optional Order ID (from the online store) for which the invoice is generated
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)
Client[NrRegCom] string(128) Optional Client trade register number
Client[IdExtern] int Optional External client identifier from a third-party app (must be > 0)
Client[Strain] bool Optional Foreign client; allows any VAT rate in Continut[i][CotaTVA]
Client[ContBancar] string(100) Optional Client bank account
Client[PlatitorTVA] bool Optional VAT payer (true/false); used for PJ clients
Continut[i][Denumire] string(1000) Required Product/service name
Continut[i][CodArticol] string(128) Optional Article code used to search/identify items
Continut[i][CodGestiune] string(128) Optional Warehouse code for the article (for accounting)
Continut[i][Descriere] string(4000) Optional Line description; use [[descriere]] to keep the FGO product description
Continut[i][CodCentruCost] string Optional Cost center code for the product (from FGO settings)
Continut[i][NrCrt] int Optional Line index of the article (cash register receipts).
Continut[i][Tip] string Optional Line type: Articol or Discount.
Continut[i][NrCrtArticol] int Optional Reference to the NrCrt of the discounted article. For invoice-level discounts, only Tip: Discount is provided, without NrCrtArticol.
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

POST /factura/print

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

POST /factura/stergere

Permanently delete an invoice.

Required parameters: CodUnic, Hash, Numar, Serie, PlatformaUrl

Example Response

{ "Success": true, "Message": "Invoice deleted successfully" }

Cancel Invoice

POST /factura/anulare

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

POST /factura/getstatus

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

POST /factura/incasare

⚠️ Decommissioned for FGO Pro. Available only for PREMIUM & ENTERPRISE.

Record a payment/collection for an invoice.

Parameter Type Status Description
CodUnic string Required Company fiscal code (CUI)
Hash string Required SHA-1 hash (see Hash Calculation section)
NumarFactura string(50) Required Invoice number
SerieFactura string(50) Required Invoice series
SerieChitanta string(50) Optional Receipt series (if multiple series exist)
ContIncasare string(50) Optional Collection account from FGO Settings -> Collection
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)
TipFactura string Optional Invoice type, if the same series is used for different document types
PlatformaUrl string Required Root URL of your application

Delete Payment

POST /factura/stergereincasare

⚠️ Decommissioned for FGO Pro. Available only for PREMIUM & ENTERPRISE.

Delete a recorded payment/collection from an invoice.

Parameter Type Status Description
CodUnic string Required Company fiscal code (CUI)
Hash string Required SHA-1 hash (see Hash Calculation section)
NumarFactura string(50) Required Invoice number the collection belongs to
SerieFactura string(50) Required Invoice series the collection belongs to
SerieIncasare string(50) Required Series of the collection to delete
NumarIncasare string(50) Required Number of the collection to delete
PlatformaUrl string Required Root URL of your application

Example Response

{ "Success": true, "Message": "" }

Reverse Invoice

POST /factura/stornare

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)

POST /factura/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

POST /factura/listfacturiasociate

⚠️ ENTERPRISE plan only

List all invoices associated with a given invoice.

Required parameters: CodUnic, Hash, Numar, Serie, PlatformaUrl

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

POST /articol/list

⚠️ 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

POST /articol/get

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

POST /articol/getlist

⚠️ DEPRECATED - Use ARTICOLEMODIFICATE instead

Retrieve multiple articles by code (max 30).

Parameter Type Status Description
CodUnic string Required Company fiscal code (CUI)
Hash string Required SHA-1 hash (see Hash Calculation section)
Coduri array Required Article codes to retrieve, max 30
PlatformaUrl string Required Root URL of your application

Modified Articles

POST /articol/articolemodificate

⚠️ 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.

POST /articol/gestiune

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

POST

Emitere

/factura/emitere
POST

Încasare

/factura/incasare
POST

Printare

/factura/print
POST

Anulare

/factura/anulare
POST

Ștergere

/factura/stergere
POST

Stornare

/factura/stornare

Code 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); // IMPORTANT: send raw JSON, never application/x-www-form-urlencoded. // Set the JSON header and pass json_encode($data) - NOT the array directly, // otherwise cURL sends form-encoded data and the request may fail. 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.

v7.0 (Current)
  • Major API restructuring
  • Enhanced error reporting
  • Performance optimizations
v6.5 2024-01-15
  • Added articolemodificate endpoint
  • Rate limit adjustments
v6.0 2023-07-01
  • Deprecated getlist endpoint
  • New rate limits
v5.0 2022-06-01
  • Enhanced invoice creation
v4.0 2021-03-01
  • Added listfacturiasociate endpoint
v3.0 2020-12-15
  • Deprecated incasare for Pro plan
  • Added stornare (reversal) feature
v2.4 19.12.2018
  • Adăugare metodă StergereIncasare
  • Adăugare metodă listare articole /articol/list
v2.3 14.12.2018
  • Emitere: afișare Serie, NrFactura și link download când factura există deja
  • Articole: adăugare metodă list
v2.2 11.12.2018
  • Emitere: adăugare câmp opțional Client[Strain] (true/false)
  • Bug fix: actualizare stocuri
v2.1 29.11.2018
  • Emitere: adăugare câmp opțional VerificareDuplicat (true/false)
v2.0 26.10.2018
  • Adăugare metodă Stornare
  • Adăugare câmp opțional DataScadenta
  • Extindere nomenclator TipFactura (Avize)
  • Extindere nomenclator Țară cu abrevieri
v1.9 07.02.2018
  • Emitere: adăugare câmp opțional TvaLaIncasare
v1.8 20.11.2017
  • Emitere: adăugare câmp opțional Client[IdExtern]
v1.7 26.07.2017
  • Emitere: adăugare câmp opțional Client[Tip] (PF/PJ)
v1.6 16.06.2017
  • Emitere: adăugare câmpuri opționale Serie și Numar
v1.5 26.04.2017
  • Emitere: adăugare Continut[i][Descriere] și Continut[i][CodArticol]
  • Mărire dimensiuni maxime câmpuri
v1.4 07.04.2017
  • Adăugare metodă încasare factură
v1.3 28.03.2017
  • Redenumire parametru Destinatar în Text
  • Adăugare Continut[i][PretTotal] pentru calcul invers
  • Adăugare parametri DataEmitere și TipFactura
v1.2 23.03.2017
  • Adăugare parametri client: Email, Telefon, Tara, Adresa