[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_typeinvoice_typeDGI codeName
invoicedebit01Factura de Operación Interna
ticketdebit01Factura de Operación Interna (the DGI has no separate ticket type)
exportdebit03Factura de Exportación
credit note / credit note exportscredit04Nota de Crédito Referente a una o Varias FE
debit note / debit note exportsdebit05Nota 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 destination 2 (abroad) and the export group gFExp. 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

TagMeaning
RequiredRequired 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.
ConditionalRequired only for specific document types or when another field or condition applies. See Notes.
OptionalCan 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 FieldRequired?Generated XML ElementApplies toNotes
document_typeRequirediDoc (B06)AllBrinta 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_typeRequirediDest (B14)AllDocument. 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.
reasonRequirediNatOp (B12)AllDocument. 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_dateRequireddFechaEm (B10)AllDocument. 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_infoOptionaldInfEmFE (B29)AllFree 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 FieldRequired?Generated XML ElementApplies toNotes
supplier_company_idRequiredgRucEmi/dRuc (B3012)AllDocument. 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 FieldRequired?Generated XML ElementApplies toNotes
buyer.company.typeRequirediTipoRec (B401)AllBrinta 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.countryRequirediTipoRec (B401)AllBrinta API. Any country other than PA → 04 (Extranjero). Export documents require a buyer outside Panama.
buyer.company.typeConditionalgRucRec/dTipoRuc (B4021)AllBuyers in Panama only. person → 1 (Natural); business and government → 2 (Jurídico).
buyer.company.tax_registrations[type="RUC"].numberConditionalgRucRec/dRuc (B4022)AllDocument: 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)ConditionalgRucRec/dDV (B4023)AllDocument: required for business and government buyers in Panama. The 2-digit check digit, see the row above.
buyer.company.legal_nameConditionaldNombRec (B403)AllDocument: required for business and government buyers in Panama. If not sent, buyer.company.name is used. 2 to 150 characters.
buyer.company.nameOptionaldNombRec (B403)AllUsed only when legal_name is not sent.
buyer.company.address.address_line_1ConditionaldDirecRec (B404)AllDocument: required for business and government buyers in Panama. Street, building and number, up to 100 characters.
buyer.company.address.municipality_codeConditionalgUbiRec/dCodUbi (B4051)AllDocument: 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.neighborhoodConditionalgUbiRec/dCorreg (B4052)AllDocument: sent with the location code. Corregimiento name, up to 50 characters, as in the DGI catalog.
buyer.company.address.cityConditionalgUbiRec/dDistr (B4053)AllDocument: sent with the location code. Distrito name, up to 50 characters.
buyer.company.address.stateConditionalgUbiRec/dProv (B4054)AllDocument: sent with the location code. Provincia, up to 50 characters.
buyer.company.tax_registrations[].numberConditionalgIdExt/dIdExt (B4061)AllDocument: 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.countryConditionalgIdExt/dPaisExt (B4062)AllBuyers outside Panama. Sent as the ISO 3166-1 alpha-2 code, e.g. US.
buyer.company.address.countryRequiredcPaisRec (B410)AllBrinta 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.phoneOptionaldTfnRec (B408)AllOne number, in the format 999-9999 or 9999-9999.
buyer.company.emailOptionaldCorElectRec (B409)AllUp 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)

Buyerbuyer.company.typeDGI codeBuyer data sent
In Panama (address.country = PA)business01 ContribuyenteRUC and DV, name, address and location
In Panamagovernment03 GobiernoRUC and DV, name, address and location. Items need the 4-digit CPBS code.
In Panamaperson02 Consumidor finalRUC or cédula if sent, name, address
Outside Panamaany04 ExtranjeroPassport 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 FieldRequired?Generated XML ElementApplies toNotes
items[].nameRequireddDescProd (C03)AllBrinta API. Description of the good or service, 2 to 500 characters.
items[].descriptionOptionaldDescProd (C03)AllAppended to the name as {name} - {description}. The result is cut at 500 characters.
items[].quantityRequireddCantCodInt (C06)AllDocument. Up to 6 decimals. Default when not sent: 1.
items[].categories[list="code"].code (buyer business or person)OptionaldCodCPBSabr (C09)AllPanamanian 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)ConditionaldCodCPBScmp (C10)AllDocument: required for government buyers. CPBS code, 4-digit family, e.g. {"list": "code", "code": "8111"}.
items[].unit_amountRequiredgPrecios/dPrUnit (C201)AllDocument. Unit price before discount and taxes, up to 6 decimals. If not sent, Brinta sends items[].amount / items[].quantity.
items[].amountRequiredgPrecios/dPrItem (C203)AllBrinta API. Item amount before discounts, excluding taxes. Sent as amount − discount, 2 decimals.
items[].discountOptionalgPrecios/dPrUnitDesc (C202)AllAbsolute 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_amountRequiredgPrecios/dValTotItem (C206)AllDocument. Item total including taxes.
items[].taxes[name="ITBMS"].rateRequiredgITBMSItem/dTasaITBMS (C401)AllDocument: 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"].amountRequiredgITBMSItem/dValITBMS (C402)AllDocument. ITBMS amount of the item: dPrItem × rate.
items[].taxes[name="ISC"].rateOptionalgISCItem/dTasaISC (C501)AllSelective consumption tax (ISC). Only for items subject to it; send the rate as a decimal, e.g. 0.05.
items[].taxes[name="ISC"].amountConditionalgISCItem/dValISC (C502)AllRequired 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 FieldRequired?Generated XML ElementApplies toNotes
payment_model.typeRequirediPzPag (D12)AllDocument. 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_dateConditionaliPzPag (D12)AllUsed 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[].codeRequiredgFormaPago/iFormaPago (D301)AllDocument. 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[].typeOptionalgFormaPago/iFormaPago (D301)AllUsed 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[].typeConditionalgFormaPago/dFormaPagoDesc (D302)AllDocument: 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[].installmentsConditionalgPagPlazo/dSecItem (D501)AllDocument: on credit sales (iPzPag = 2), one installment is sent per entry of payment_methods[]. Installment number; default 1.
payment_methods[].due_dateConditionalgPagPlazo/dFecItPlazo (D502)AllDocument: required on credit sales. Installment due date. If not sent, invoice_due_date is used. A credit sale with neither is rejected.
invoice_due_dateConditionalgPagPlazo/dFecItPlazo (D502)AllUsed when payment_methods[].due_date is not sent, or when no payment_methods[] is sent (a single installment).
payment_methods[].amountConditionalgPagPlazo/dValItPlazo (D503)AllDocument: 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 FieldRequired?Generated XML ElementApplies toNotes
items[].taxes[].withholding_typeOptionalcCodRetenc (D401)AllRetention 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)OptionalcValRetenc (D402)AllRetention 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 FieldRequired?Generated XML ElementApplies toNotes
categories[list="incoterm"].codeConditionalcCondEntr (B501)ExportsBrinta 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.
currencyConditionalcMoneda (B502)ExportsBrinta API requires currency on every document. Sent here only when it is not USD: ISO 4217 code, e.g. EUR.
exchange_rateConditionaldCambio (B504)ExportsDocument: 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 FieldRequired?Generated XML ElementApplies toNotes
document_typeRequirediDoc (B06), see General InformationNotesBrinta API. Credit notes → 04, debit notes → 05.
original_invoice_idRequiredgDFRefNum/gDFRefFE/dCUFERef (B606)NotesBrinta API and Document. The CUFE of the original document (66 characters), taken from it. Or send original_invoice_external_id.
original_invoice_idRequireddFechaDFRef (B603)NotesDocument. Issue date of the original document, taken from it.
original_invoice_idRequiredgRucEmDFRef/dRuc (B6012)NotesDocument. RUC of the original document's issuer (your company), taken from it, with its type in gRucEmDFRef/dTipoRuc.
original_invoice_idRequireddNombEmRef (B602)NotesDocument. Legal name of the original document's issuer, taken from it.
reasonRequirediNatOp (B12), see General InformationNotesOn 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.


Did this page help you?