[PA] Brinta API → XML Field Mapping
Summary
This page maps each field of the Brinta POST /invoices request to the element it produces in the electronic invoice XML submitted to Panama's tax authority (DGI), across every document type Brinta issues in Panama:
document_type | invoice_type | DGI code | Name |
|---|---|---|---|
invoice | debit | 01 | Factura de Operación Interna |
ticket | debit | 01 | Factura de Operación Interna (the DGI has no separate ticket type) |
export | debit | 03 | Factura de Exportación |
credit note / credit note exports | credit | 04 | Nota de Crédito Referente a una o Varias FE |
debit note / debit note exports | debit | 05 | Nota de Débito Referente a una o Varias FE |
The starting point is always Brinta's side: what field you send and which XML element it fills. Elements that Brinta fills on its own, with no API field behind them, are not listed. These include the document number and point of sale, the issuer data, the emission type, the CAFE delivery fields and the totals, which Brinta calculates from the items.
The DGI uses one XML schema (rFE) for every document type, so the same field maps to the same element on all of them. Two parts change with the document type:
- Export documents (
export,credit note exports,debit note exports): sent with destination2(abroad) and the export groupgFExp. The buyer must be outside Panama. - Credit and Debit Notes (
04,05): add the reference to the original document (gDFRef).
Generated XML Element is written as a path from the element named in each section's intro (for example gRucRec/dRuc is the dRuc element inside gRucRec). When one Brinta field fills two elements, it has one row per element. The DGI element ID (for example B06) is the one used in the DGI's Ficha Técnica.
Legend
| Tag | Meaning |
|---|---|
| Required | Required by Brinta's API, by the electronic document, or by both. The Notes column starts with Brinta API or Document to say which, and says what Brinta sends when the field is not in the request. |
| Conditional | Required only for specific document types or when another field or condition applies. See Notes. |
| Optional | Can be omitted. Only sent to the DGI when there is data. |
Document number and point of sale. You don't send them. The point of sale (dPtoFacDF, 3 digits) is the one configured for your company, and the 10-digit document number (dNroDF) is assigned at issuance. Both are returned in the response, together with the CUFE.
General Information
Elements are inside rFE/gDGen.
| Brinta API Field | Required? | Generated XML Element | Applies to | Notes |
|---|---|---|---|---|
document_type | Required | iDoc (B06) | All | Brinta API. invoice, ticket → 01; export → 03; credit note, credit note exports → 04; debit note, debit note exports → 05. Allowed values (DGI): 01 to 10; Brinta issues 01, 03, 04 and 05. |
document_type | Required | iDest (B14) | All | Document. Destination of the operation: invoice, ticket, credit note, debit note → 1 (Panamá); export, credit note exports, debit note exports → 2 (abroad). Allowed values: 1, 2. |
reason | Required | iNatOp (B12) | All | Document. Nature of the operation. Default when not sent: 01 (Venta) on invoice, ticket and debit note; 02 (Exportación) on export and debit note exports; 11 (Devolución) on credit notes. void, return and discount are always sent as 11. Allowed values (DGI): 01 Venta, 02 Exportación, 03 Re-exportación, 04 Venta de fuente extranjera, 05 Servicio de fuente extranjera, 10 Transferencia/Traspaso, 11 Devolución, 12 Consignación, 13 Remesa, 14 Entrega gratuita, 20 Compra, 21 Importación. Brinta accepts all of them in reason except 05; any other value falls back to the default. |
invoice_date | Required | dFechaEm (B10) | All | Document. Sent as YYYY-MM-DDThh:mm:ss-05:00. The DGI rejects a date more than 2 business days in the future and warns when it is more than 30 days old. |
additional_info | Optional | dInfEmFE (B29) | All | Free text for the buyer, up to 5000 characters; longer text is cut. Not sent when empty. |
Issuer
Elements are inside rFE/gDGen/gEmis.
The issuer is identified by supplier_company_id. All issuer data in the XML (RUC and check digit, legal name, branch code, address and location) is taken from the company set up for issuing in Panama; the request has no issuer fields of its own.
| Brinta API Field | Required? | Generated XML Element | Applies to | Notes |
|---|---|---|---|---|
supplier_company_id | Required | gRucEmi/dRuc (B3012) | All | Document. Identifies your company in Brinta; the issuer's RUC, its type and check digit are taken from it. If not sent, the supplier is your own company (Brinta's client). |
Buyer
Elements are inside rFE/gDGen/gDatRec. Send exactly one of buyer.company, buyer.company_id or buyer.company_external_id. When you send buyer.company, type and address are required, every address requires country, and every entry in tax_registrations[] requires type, number, level (e.g. country) and location (e.g. PA). level and location are not sent to the DGI.
| Brinta API Field | Required? | Generated XML Element | Applies to | Notes |
|---|---|---|---|---|
buyer.company.type | Required | iTipoRec (B401) | All | Brinta API. business, government or person, together with the address country, see the table below. A government entity must be sent as government. Allowed values (DGI): 01 Contribuyente, 02 Consumidor final, 03 Gobierno, 04 Extranjero. |
buyer.company.address.country | Required | iTipoRec (B401) | All | Brinta API. Any country other than PA → 04 (Extranjero). Export documents require a buyer outside Panama. |
buyer.company.type | Conditional | gRucRec/dTipoRuc (B4021) | All | Buyers in Panama only. person → 1 (Natural); business and government → 2 (Jurídico). |
buyer.company.tax_registrations[type="RUC"].number | Conditional | gRucRec/dRuc (B4022) | All | Document: required for buyers in Panama of type business or government. The RUC with its dashes, e.g. 155662436-2-2018. Send it followed by its 2-digit check digit (DV), either as the last two characters (155662436-2-2018-40) or after DV (155662436-2-2018 DV 40): Brinta splits the two. A RUC without dashes is rejected, except a legal-entity RUC issued since October 2014, which Brinta can rebuild. |
buyer.company.tax_registrations[type="RUC"].number (last 2 digits) | Conditional | gRucRec/dDV (B4023) | All | Document: required for business and government buyers in Panama. The 2-digit check digit, see the row above. |
buyer.company.legal_name | Conditional | dNombRec (B403) | All | Document: required for business and government buyers in Panama. If not sent, buyer.company.name is used. 2 to 150 characters. |
buyer.company.name | Optional | dNombRec (B403) | All | Used only when legal_name is not sent. |
buyer.company.address.address_line_1 | Conditional | dDirecRec (B404) | All | Document: required for business and government buyers in Panama. Street, building and number, up to 100 characters. |
buyer.company.address.municipality_code | Conditional | gUbiRec/dCodUbi (B4051) | All | Document: sent for business and government buyers in Panama. Location code provincia-distrito-corregimiento, e.g. 8-8-7 (Bella Vista), from the DGI location catalog. Default when not sent: 8-8-10 (Panamá, Panamá, Parque Lefevre). Not sent for other buyers. |
buyer.company.address.neighborhood | Conditional | gUbiRec/dCorreg (B4052) | All | Document: sent with the location code. Corregimiento name, up to 50 characters, as in the DGI catalog. |
buyer.company.address.city | Conditional | gUbiRec/dDistr (B4053) | All | Document: sent with the location code. Distrito name, up to 50 characters. |
buyer.company.address.state | Conditional | gUbiRec/dProv (B4054) | All | Document: sent with the location code. Provincia, up to 50 characters. |
buyer.company.tax_registrations[].number | Conditional | gIdExt/dIdExt (B4061) | All | Document: required for buyers outside Panama; a foreign buyer without tax_registrations[] is rejected. Passport or foreign tax ID, up to 50 characters. The first entry of tax_registrations[] is used. A Panamanian RUC is not accepted here. |
buyer.company.address.country | Conditional | gIdExt/dPaisExt (B4062) | All | Buyers outside Panama. Sent as the ISO 3166-1 alpha-2 code, e.g. US. |
buyer.company.address.country | Required | cPaisRec (B410) | All | Brinta API. ISO 3166-1 alpha-2 code. On invoice, ticket, credit note and debit note, PA is always sent. On export documents, the buyer's country, which cannot be PA. |
buyer.company.phone | Optional | dTfnRec (B408) | All | One number, in the format 999-9999 or 9999-9999. |
buyer.company.email | Optional | dCorElectRec (B409) | All | Up to 50 characters. |
buyer.company.address.address_line_2, postal_code, category_code and regime are accepted by the API but have no element in the DGI's XML.
Buyer type (iTipoRec)
| Buyer | buyer.company.type | DGI code | Buyer data sent |
|---|---|---|---|
In Panama (address.country = PA) | business | 01 Contribuyente | RUC and DV, name, address and location |
| In Panama | government | 03 Gobierno | RUC and DV, name, address and location. Items need the 4-digit CPBS code. |
| In Panama | person | 02 Consumidor final | RUC or cédula if sent, name, address |
| Outside Panama | any | 04 Extranjero | Passport or foreign tax ID, country |
Line Items
Elements are inside rFE/gItem, one per item, numbered from 1 in the order sent. The DGI checks dPrItem = dCantCodInt × (dPrUnit − dPrUnitDesc) and dValTotItem = dPrItem + dValITBMS + dValISC.
| Brinta API Field | Required? | Generated XML Element | Applies to | Notes |
|---|---|---|---|---|
items[].name | Required | dDescProd (C03) | All | Brinta API. Description of the good or service, 2 to 500 characters. |
items[].description | Optional | dDescProd (C03) | All | Appended to the name as {name} - {description}. The result is cut at 500 characters. |
items[].quantity | Required | dCantCodInt (C06) | All | Document. Up to 6 decimals. Default when not sent: 1. |
items[].categories[list="code"].code (buyer business or person) | Optional | dCodCPBSabr (C09) | All | Panamanian goods and services code (CPBS), 2-digit segment, e.g. {"list": "code", "code": "81"}. A 4-digit code is rejected here. Without a CPBS code the DGI only sends a warning. |
items[].categories[list="code"].code (buyer government) | Conditional | dCodCPBScmp (C10) | All | Document: required for government buyers. CPBS code, 4-digit family, e.g. {"list": "code", "code": "8111"}. |
items[].unit_amount | Required | gPrecios/dPrUnit (C201) | All | Document. Unit price before discount and taxes, up to 6 decimals. If not sent, Brinta sends items[].amount / items[].quantity. |
items[].amount | Required | gPrecios/dPrItem (C203) | All | Brinta API. Item amount before discounts, excluding taxes. Sent as amount − discount, 2 decimals. |
items[].discount | Optional | gPrecios/dPrUnitDesc (C202) | All | Absolute discount of the item. Sent per unit (discount / quantity, up to 6 decimals), which must be lower than the unit price. Default when not sent: 0. |
items[].final_amount | Required | gPrecios/dValTotItem (C206) | All | Document. Item total including taxes. |
items[].taxes[name="ITBMS"].rate | Required | gITBMSItem/dTasaITBMS (C401) | All | Document: every item needs an ITBMS tax, with rate 0 for exempt items. 0 → 00 (exento), 0.07 → 01 (7%), 0.10 → 02 (10%), 0.15 → 03 (15%). Allowed values (DGI): 00, 01, 02, 03; any other rate is rejected. If the item has no ITBMS tax, the group is not sent and the DGI rejects the document. |
items[].taxes[name="ITBMS"].amount | Required | gITBMSItem/dValITBMS (C402) | All | Document. ITBMS amount of the item: dPrItem × rate. |
items[].taxes[name="ISC"].rate | Optional | gISCItem/dTasaISC (C501) | All | Selective consumption tax (ISC). Only for items subject to it; send the rate as a decimal, e.g. 0.05. |
items[].taxes[name="ISC"].amount | Conditional | gISCItem/dValISC (C502) | All | Required when an ISC tax is sent: dPrItem × rate. |
items[].item_external_id and items[].additional_info are accepted by the API but are not sent to the DGI. ITBMS and ISC taxes marked with withholding_type are not item taxes: see Retention.
Payment
Elements are inside rFE/gTot.
| Brinta API Field | Required? | Generated XML Element | Applies to | Notes |
|---|---|---|---|---|
payment_model.type | Required | iPzPag (D12) | All | Document. Payment term: cash → 1 (Contado), credit → 2 (Crédito). Allowed values (DGI): 1 Contado, 2 Crédito, 3 Mixto; Brinta sends 1 or 2. payment_model is accepted by the API but not yet listed in the API reference. If not sent, see invoice_due_date. |
invoice_due_date | Conditional | iPzPag (D12) | All | Used only when payment_model is not sent: a due date later than invoice_date → 2 (Crédito). The same date, or no due date → 1 (Contado). |
payment_methods[].code | Required | gFormaPago/iFormaPago (D301) | All | Document. Payment method code (DGI): 01 Crédito, 02 Efectivo, 03 Tarjeta Crédito, 04 Tarjeta Débito, 05 Tarjeta Fidelización, 06 Vale, 07 Tarjeta de Regalo, 08 Transferencia o depósito a cuenta bancaria, 09 Cheque, 10 Punto de Pago, 99 Otro. The first payment_methods[] entry with a code is used. If no code is sent, it comes from payment_methods[].type. One payment method is sent, for the invoice total. |
payment_methods[].type | Optional | gFormaPago/iFormaPago (D301) | All | Used only when no code is sent: cash → 02, credit card → 03, debit card → 04, bank transfer and digital wallet → 08, any other type → 99. Default when neither code nor type is sent: 99. |
payment_methods[].type | Conditional | gFormaPago/dFormaPagoDesc (D302) | All | Document: required with 99, and sent only then. Brinta sends Otros medios de pago when the type is empty or other, else the type itself (e.g. compensation). The DGI requires 10 to 100 characters. |
payment_methods[].installments | Conditional | gPagPlazo/dSecItem (D501) | All | Document: on credit sales (iPzPag = 2), one installment is sent per entry of payment_methods[]. Installment number; default 1. |
payment_methods[].due_date | Conditional | gPagPlazo/dFecItPlazo (D502) | All | Document: required on credit sales. Installment due date. If not sent, invoice_due_date is used. A credit sale with neither is rejected. |
invoice_due_date | Conditional | gPagPlazo/dFecItPlazo (D502) | All | Used when payment_methods[].due_date is not sent, or when no payment_methods[] is sent (a single installment). |
payment_methods[].amount | Conditional | gPagPlazo/dValItPlazo (D503) | All | Document: on credit sales. Installment amount. Default: the invoice total. The installments must add up to the invoice total. |
Retention
Elements are inside rFE/gTot/gRetenc. Sent when at least one item tax has withholding_type = withholding.
| Brinta API Field | Required? | Generated XML Element | Applies to | Notes |
|---|---|---|---|---|
items[].taxes[].withholding_type | Optional | cCodRetenc (D401) | All | Retention code. Buyer in Panama → 4 (Pago o acreditación por compra de bienes/servicios, 50%); buyer outside Panama → 3 (Pago o acreditación a no domiciliado o empresa constituida en el exterior, 100%). Allowed values (DGI): 1, 2, 3, 4, 7, 8; Brinta sends 3 or 4. |
items[].taxes[].amount (withholding_type = withholding) | Optional | cValRetenc (D402) | All | Retention amount. Brinta sends 0. |
Exports
Elements are inside rFE/gDGen/gFExp. Applies to export, credit note exports and debit note exports, and only to them.
| Brinta API Field | Required? | Generated XML Element | Applies to | Notes |
|---|---|---|---|---|
categories[list="incoterm"].code | Conditional | cCondEntr (B501) | Exports | Brinta API and Document: required on export documents, no default. Invoice-level categories[], e.g. {"list": "incoterm", "code": "FOB"}. Allowed values: EXW, FCA, CPT, CIP, DPU, DAP, DDP, FAS, FOB, CFR, CIF. |
currency | Conditional | cMoneda (B502) | Exports | Brinta API requires currency on every document. Sent here only when it is not USD: ISO 4217 code, e.g. EUR. |
exchange_rate | Conditional | dCambio (B504) | Exports | Document: required when the currency is not USD. |
When the currency is not USD, Brinta also sends the total in that currency (dVTotEst, B505).
Credit and Debit Notes
Elements are inside rFE/gDGen/gDFRef. Everything in the sections above applies. Brinta API: send original_invoice_id or original_invoice_external_id for the document being corrected. The DGI requires that the original was issued by the same company to the same buyer, and that a Note does not exceed the original's amount.
| Brinta API Field | Required? | Generated XML Element | Applies to | Notes |
|---|---|---|---|---|
document_type | Required | iDoc (B06), see General Information | Notes | Brinta API. Credit notes → 04, debit notes → 05. |
original_invoice_id | Required | gDFRefNum/gDFRefFE/dCUFERef (B606) | Notes | Brinta API and Document. The CUFE of the original document (66 characters), taken from it. Or send original_invoice_external_id. |
original_invoice_id | Required | dFechaDFRef (B603) | Notes | Document. Issue date of the original document, taken from it. |
original_invoice_id | Required | gRucEmDFRef/dRuc (B6012) | Notes | Document. RUC of the original document's issuer (your company), taken from it, with its type in gRucEmDFRef/dTipoRuc. |
original_invoice_id | Required | dNombEmRef (B602) | Notes | Document. Legal name of the original document's issuer, taken from it. |
reason | Required | iNatOp (B12), see General Information | Notes | On credit notes, void, return and discount are all sent as 11 (Devolución). The DGI's XML has no separate reason code for Notes. |
Generic Notes, which don't reference an electronic invoice (DGI types 06 and 07), are not issued.
Updated about 5 hours ago
