Skip to main content
POST
/
factura
/
xml
/
generar
curl -X POST https://api.example.com/factura/xml/generar \
  -H "Content-Type: application/json" \
  -H "token: your-api-token" \
  -H "Emisor: your-emisor-id" \
  -d '{
    "iTipEmi": 1,
    "dDesTipEmi": "Normal",
    "dCodSeg": "572819034",
    "iTiDE": 1,
    "dDesTiDE": "Factura electrónica",
    "dNumTim": 77441122,
    "dEst": "003",
    "dPunExp": "004",
    "dNumDoc": "0000789",
    "dFeEmiDE": "2025-09-27T16:45:10",
    "iTipTra": 2,
    "dDesTipTra": "Prestación de servicios",
    "iTImp": 1,
    "dDesTImp": "IVA",
    "cMoneOpe": "PYG",
    "dDesMoneOpe": "Guarani",
    "dRucEm": 4839205,
    "dDVEmi": 4,
    "iTipCont": 2,
    "dNomEmi": "SERVITEC S.R.L.",
    "dDirEmi": "AV. CENTRAL KM 5",
    "dNumCas": 150,
    "dTelEmi": "0982123456",
    "dEmailE": "[email protected]",
    "iNatRec": 2,
    "iTiOpe": 1,
    "iTipIDRec": "1",
    "dNumIDRec": "45678901",
    "dNomRec": "COMERCIAL EL PUENTE S.A.",
    "dTotGralOpe": "250000.0",
    "dTotIVA": 22727,
    "Detalles": [
      {
        "dCodInt": "A-991",
        "dDesProSer": "SERVICIO DE CONSULTORÍA TÉCNICA",
        "cUniMed": "77",
        "dCantProSer": "1.0",
        "dPUniProSer": "250000.0",
        "dTotOpeItem": "250000.0",
        "iAfecIVA": "1",
        "dTasaIVA": "10",
        "dLiqIVAItem": "22727"
      }
    ]
  }'
{
  "cdc": "01800695631001003000124566202509271645108857294613",
  "numeroFactura": "003-004-0000789",
  "tipoDocumento": 1,
  "fechaEmision": "2025-09-27T16:45:10",
  "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rDE xmlns=\"http://ekuatia.set.gov.py/sifen/xsd\">\n  <DE Id=\"...\">....</DE>\n  <Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\">...</Signature>\n  <gCamGen>\n    <gCamQR>\n      <dQRCode>...</dQRCode>\n    </gCamQR>\n  </gCamGen>\n</rDE>"
}
This endpoint receives an invoice in JSON format and returns the complete signed XML document along with invoice metadata. The XML is digitally signed and includes a QR code for validation.

Authentication

token
string
required
Authentication token for API access
Emisor
string
Multi-tenant identifier for the issuing entity. Optional - if not provided or blank, the default emisor will be used.

Request Body

The request body should contain a complete invoice in JSON format following the Paraguayan electronic invoice structure.
iTipEmi
integer
required
Emission type (e.g., 1 = Normal)
iTiDE
integer
required
Document type (e.g., 1 = Electronic invoice)
dNumTim
integer
required
Timbrado number
dEst
string
required
Establishment code (3 digits)
dPunExp
string
required
Point of sale code (3 digits)
dNumDoc
string
required
Document number
dFeEmiDE
string
required
Emission date and time (ISO 8601 format: YYYY-MM-DDTHH:mm:ss)
dRucEm
integer
required
Issuer RUC (tax identification number)
dDVEmi
integer
required
Issuer verification digit
dNomEmi
string
required
Issuer legal name
dNumIDRec
string
required
Receiver identification number
dNomRec
string
required
Receiver name
dTotGralOpe
string
required
Total operation amount
Detalles
array
required
Array of invoice line items. Each item should include product/service description, quantity, unit price, and tax information.
The request body accepts the complete SIFEN invoice JSON structure. See the Invoice Structure documentation for a complete example.

Response

cdc
string
CDC (Código de Control) - Unique control code for the electronic document
numeroFactura
string
Invoice number extracted from the XML
tipoDocumento
integer
Document type code
fechaEmision
string
Emission date extracted from the XML
xml
string
Complete signed XML document with digital signature and QR code
curl -X POST https://api.example.com/factura/xml/generar \
  -H "Content-Type: application/json" \
  -H "token: your-api-token" \
  -H "Emisor: your-emisor-id" \
  -d '{
    "iTipEmi": 1,
    "dDesTipEmi": "Normal",
    "dCodSeg": "572819034",
    "iTiDE": 1,
    "dDesTiDE": "Factura electrónica",
    "dNumTim": 77441122,
    "dEst": "003",
    "dPunExp": "004",
    "dNumDoc": "0000789",
    "dFeEmiDE": "2025-09-27T16:45:10",
    "iTipTra": 2,
    "dDesTipTra": "Prestación de servicios",
    "iTImp": 1,
    "dDesTImp": "IVA",
    "cMoneOpe": "PYG",
    "dDesMoneOpe": "Guarani",
    "dRucEm": 4839205,
    "dDVEmi": 4,
    "iTipCont": 2,
    "dNomEmi": "SERVITEC S.R.L.",
    "dDirEmi": "AV. CENTRAL KM 5",
    "dNumCas": 150,
    "dTelEmi": "0982123456",
    "dEmailE": "[email protected]",
    "iNatRec": 2,
    "iTiOpe": 1,
    "iTipIDRec": "1",
    "dNumIDRec": "45678901",
    "dNomRec": "COMERCIAL EL PUENTE S.A.",
    "dTotGralOpe": "250000.0",
    "dTotIVA": 22727,
    "Detalles": [
      {
        "dCodInt": "A-991",
        "dDesProSer": "SERVICIO DE CONSULTORÍA TÉCNICA",
        "cUniMed": "77",
        "dCantProSer": "1.0",
        "dPUniProSer": "250000.0",
        "dTotOpeItem": "250000.0",
        "iAfecIVA": "1",
        "dTasaIVA": "10",
        "dLiqIVAItem": "22727"
      }
    ]
  }'
{
  "cdc": "01800695631001003000124566202509271645108857294613",
  "numeroFactura": "003-004-0000789",
  "tipoDocumento": 1,
  "fechaEmision": "2025-09-27T16:45:10",
  "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rDE xmlns=\"http://ekuatia.set.gov.py/sifen/xsd\">\n  <DE Id=\"...\">....</DE>\n  <Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\">...</Signature>\n  <gCamGen>\n    <gCamQR>\n      <dQRCode>...</dQRCode>\n    </gCamQR>\n  </gCamGen>\n</rDE>"
}

Processing Flow

The endpoint performs the following operations:
  1. Validation: Validates the emisor context and JSON structure
  2. XML Generation: Converts the JSON invoice to SIFEN-compliant XML format
  3. Digital Signature: Applies digital signature to the XML document
  4. QR Code: Adds QR code node for mobile verification
  5. Metadata Extraction: Extracts CDC, invoice number, document type, and emission date
The generated XML is fully compliant with SIFEN (Sistema de Facturación Electrónica Nacional) requirements and includes all necessary elements for submission to the SET (Subsecretaría de Estado de Tributación).

Error Responses

The endpoint returns a 500 Internal Server Error status code when:
  • The JSON structure is invalid or incomplete
  • Required fields are missing
  • The XML generation process fails
  • The digital signature process fails
  • The emisor configuration is invalid
Error messages are returned in plain text format describing the specific error encountered.

Build docs developers (and LLMs) love