Submit a document for asynchronous issuance
const url = 'https://acme.gravitastec.com/api/v1/companies/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/documents';const options = { method: 'POST', headers: { 'Idempotency-Key': 'example', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"ecfType":31,"encf":"example","sequenceExpiresOn":"2026-04-15","issueDate":"2026-04-15","incomeType":"01","paymentType":1,"paymentDueDate":"2026-04-15","paymentTerms":"example","paymentForms":[{"form":1,"amount":1}],"paymentAccount":{"type":"example","number":"example","bank":"example"},"periodFrom":"2026-04-15","periodTo":"2026-04-15","taxIncludedInPrice":false,"deferredSending":false,"allInclusiveService":false,"emitter":{"branch":"example","phones":["example"],"email":"hello@example.com","website":"example","economicActivity":"example","salespersonCode":"example","internalInvoiceNumber":"example","internalOrderNumber":"example","salesZone":"example","salesRoute":"example","additionalInfo":"example"},"buyer":{"rnc":"example","foreignId":"example","name":"example","contact":"example","email":"hello@example.com","address":"example","municipality":"example","province":"example","country":"example","deliveryDate":"2026-04-15","deliveryContact":"example","deliveryAddress":"example","additionalPhone":"example","purchaseOrderDate":"2026-04-15","purchaseOrderNumber":"example","internalCode":"example","paymentResponsible":"example","additionalInfo":"example"},"additionalInfo":{"shippingDate":"2026-04-15","shippingNumber":"example","containerNumber":"example","referenceNumber":"example","portOfShipment":"example","deliveryTerms":"example","totalFob":1,"insurance":1,"freight":1,"otherCharges":1,"totalCif":1,"customsRegime":"example","portOfDeparture":"example","portOfArrival":"example","grossWeight":1,"netWeight":1,"grossWeightUnit":1,"netWeightUnit":1,"packageCount":1,"packageUnit":1,"packageVolume":1,"volumeUnit":1},"transport":{"mode":"01","originCountry":"example","destinationAddress":"example","destinationCountry":"example","carrierId":"example","carrierName":"example","tripNumber":"example","driver":"example","transportDocument":"example","vehicleRecord":"example","plate":"example","route":"example","zone":"example","deliveryNote":"example"},"lines":[{"itemName":"example","description":"example","isService":false,"billingIndicator":0,"quantity":1,"unitCode":1,"unitPrice":1,"discounts":[{"type":"%","percentage":1,"amount":1}],"surcharges":[{"type":"%","percentage":1,"amount":1}],"additionalTaxCodes":[1],"retention":{"agent":"R","itbisRetained":1,"isrRetained":1},"itemCodes":[{"type":"example","code":"example"}],"iscData":{"referenceQuantity":1,"referenceUnit":1,"subquantities":[{"quantity":1,"unit":1}],"alcoholGrade":1,"referenceUnitPrice":1},"manufactureDate":"2026-04-15","expirationDate":"2026-04-15","mining":{"netWeightKg":1,"netMiningWeight":1,"affiliationType":1,"settlement":1}}],"subtotals":[{"number":1,"description":"example","order":1,"lines":[1]}],"globalAdjustments":[{"type":"D","description":"example","valueType":"%","value":1,"amount":1,"billingIndicator":0,"norma1007":false}],"pages":[{"fromLine":1,"toLine":1}],"currency":"example","exchangeRate":1,"reference":{"modifiedNcf":"example","modifiedNcfDate":"2026-04-15","modificationCode":1,"reason":"example","otherTaxpayerRnc":"example"},"previousBalance":1,"advancePayment":1,"totals":{"total":1,"itbisTotal":1,"taxableTotal":1,"exemptTotal":1,"additionalTaxTotal":1}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://acme.gravitastec.com/api/v1/companies/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/documents \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: example' \ --data '{ "ecfType": 31, "encf": "example", "sequenceExpiresOn": "2026-04-15", "issueDate": "2026-04-15", "incomeType": "01", "paymentType": 1, "paymentDueDate": "2026-04-15", "paymentTerms": "example", "paymentForms": [ { "form": 1, "amount": 1 } ], "paymentAccount": { "type": "example", "number": "example", "bank": "example" }, "periodFrom": "2026-04-15", "periodTo": "2026-04-15", "taxIncludedInPrice": false, "deferredSending": false, "allInclusiveService": false, "emitter": { "branch": "example", "phones": [ "example" ], "email": "hello@example.com", "website": "example", "economicActivity": "example", "salespersonCode": "example", "internalInvoiceNumber": "example", "internalOrderNumber": "example", "salesZone": "example", "salesRoute": "example", "additionalInfo": "example" }, "buyer": { "rnc": "example", "foreignId": "example", "name": "example", "contact": "example", "email": "hello@example.com", "address": "example", "municipality": "example", "province": "example", "country": "example", "deliveryDate": "2026-04-15", "deliveryContact": "example", "deliveryAddress": "example", "additionalPhone": "example", "purchaseOrderDate": "2026-04-15", "purchaseOrderNumber": "example", "internalCode": "example", "paymentResponsible": "example", "additionalInfo": "example" }, "additionalInfo": { "shippingDate": "2026-04-15", "shippingNumber": "example", "containerNumber": "example", "referenceNumber": "example", "portOfShipment": "example", "deliveryTerms": "example", "totalFob": 1, "insurance": 1, "freight": 1, "otherCharges": 1, "totalCif": 1, "customsRegime": "example", "portOfDeparture": "example", "portOfArrival": "example", "grossWeight": 1, "netWeight": 1, "grossWeightUnit": 1, "netWeightUnit": 1, "packageCount": 1, "packageUnit": 1, "packageVolume": 1, "volumeUnit": 1 }, "transport": { "mode": "01", "originCountry": "example", "destinationAddress": "example", "destinationCountry": "example", "carrierId": "example", "carrierName": "example", "tripNumber": "example", "driver": "example", "transportDocument": "example", "vehicleRecord": "example", "plate": "example", "route": "example", "zone": "example", "deliveryNote": "example" }, "lines": [ { "itemName": "example", "description": "example", "isService": false, "billingIndicator": 0, "quantity": 1, "unitCode": 1, "unitPrice": 1, "discounts": [ { "type": "%", "percentage": 1, "amount": 1 } ], "surcharges": [ { "type": "%", "percentage": 1, "amount": 1 } ], "additionalTaxCodes": [ 1 ], "retention": { "agent": "R", "itbisRetained": 1, "isrRetained": 1 }, "itemCodes": [ { "type": "example", "code": "example" } ], "iscData": { "referenceQuantity": 1, "referenceUnit": 1, "subquantities": [ { "quantity": 1, "unit": 1 } ], "alcoholGrade": 1, "referenceUnitPrice": 1 }, "manufactureDate": "2026-04-15", "expirationDate": "2026-04-15", "mining": { "netWeightKg": 1, "netMiningWeight": 1, "affiliationType": 1, "settlement": 1 } } ], "subtotals": [ { "number": 1, "description": "example", "order": 1, "lines": [ 1 ] } ], "globalAdjustments": [ { "type": "D", "description": "example", "valueType": "%", "value": 1, "amount": 1, "billingIndicator": 0, "norma1007": false } ], "pages": [ { "fromLine": 1, "toLine": 1 } ], "currency": "example", "exchangeRate": 1, "reference": { "modifiedNcf": "example", "modifiedNcfDate": "2026-04-15", "modificationCode": 1, "reason": "example", "otherTaxpayerRnc": "example" }, "previousBalance": 1, "advancePayment": 1, "totals": { "total": 1, "itbisTotal": 1, "taxableTotal": 1, "exemptTotal": 1, "additionalTaxTotal": 1 } }'Authorizations
Sección titulada «Authorizations»Parameters
Sección titulada «Parameters»Path Parameters
Sección titulada «Path Parameters»Header Parameters
Sección titulada «Header Parameters»Request Bodyrequired
Sección titulada «Request Bodyrequired»Canonical document model, the same for the API, the portal and the Excel upload. Each field maps to a
DGII e-CF element (shown in brackets). Gravitas assigns FechaHoraFirma and the security code, and
takes the emitter RNC, name and address from the company: do not send them. Gravitas also assigns
the e-NCF and FechaVencimientoSecuencia unless the ERP numbers the document with encf. Unknown properties are rejected with 422. Which fields apply to each e-CF type
follows the DGII obligation table (the portal form and the Excel template show it per type).
Amounts are calculated; send totals only to have them verified (±0.01).
object
[TipoeCF]
[eNCF] Optional, ERP API only: the e-NCF chosen by the ERP. It must be of the document type, fall in an active, unexpired range registered for the company and environment, and be unused (422 encf_invalid, encf_type_mismatch, encf_not_in_range, encf_already_used). Omit it and Gravitas assigns the next number.
[FechaVencimientoSecuencia] yyyy-MM-dd. Optional and only with encf: when sent it must be the expiry of the range that holds the e-NCF (422 sequence_expiry_mismatch).
[FechaEmision] yyyy-MM-dd
[TipoIngresos] 01 operaciones … 06 otros
[TipoPago] 1 contado, 2 crédito, 3 gratuito
[FechaLimitePago] required when paymentType is 2
[TerminoPago] e.g. “30 días”
[TablaFormasPago]
object
[FormaPago] 1 efectivo, 2 cheque/transferencia, 3 tarjeta, 4 crédito, 5 bonos, 6 permuta, 7 nota de crédito, 8 otras
[MontoPago]
[FechaDesde] billed period start
[FechaHasta] billed period end
[IndicadorMontoGravado] unit prices include ITBIS
[IndicadorEnvioDiferido] DGII-authorized deferred sending
[IndicadorServicioTodoIncluido]
Optional emitter data for this document; RNC, name and address always come from the company.
object
[Sucursal]
[TablaTelefonoEmisor]
[CorreoEmisor]
[WebSite]
[ActividadEconomica]
[CodigoVendedor]
[NumeroFacturaInterna] your ERP invoice number
[NumeroPedidoInterno]
[ZonaVenta]
[RutaVenta]
[InformacionAdicionalEmisor]
[Comprador] Send rnc (9-digit RNC or 11-digit cédula) or foreignId, never both.
object
[RNCComprador]
[IdentificadorExtranjero] passport or foreign tax id
[RazonSocialComprador]
[ContactoComprador]
[CorreoComprador] also used to send the printed representation
[DireccionComprador]
[MunicipioComprador] DGII location code
[ProvinciaComprador] DGII location code
[PaisComprador] type 46
[FechaEntrega]
[ContactoEntrega]
[DireccionEntrega]
[TelefonoAdicional]
[FechaOrdenCompra]
[NumeroOrdenCompra]
[CodigoInternoComprador]
[ResponsablePago]
[InformacionAdicionalComprador]
[InformacionesAdicionales] shipping and customs data (mainly type 46)
object
[FechaEmbarque]
[NumeroEmbarque]
[NumeroContenedor]
[NumeroReferencia]
[NombrePuertoEmbarque]
[CondicionesEntrega] Incoterm
[TotalFob]
[Seguro]
[Flete]
[OtrosGastos]
[TotalCif]
[RegimenAduanero]
[NombrePuertoSalida]
[NombrePuertoDesembarque]
[PesoBruto]
[PesoNeto]
[UnidadPesoBruto] Table IV
[UnidadPesoNeto] Table IV
[CantidadBulto]
[UnidadBulto] Table IV
[VolumenBulto]
[UnidadVolumen] Table IV
[Transporte]
object
[ViaTransporte] 01 terrestre, 02 marítimo, 03 aéreo (type 46)
[PaisOrigen]
[DireccionDestino]
[PaisDestino]
[RNCIdentificacionCompaniaTransportista]
[NombreCompaniaTransportista]
[NumeroViaje]
[Conductor]
[DocumentoTransporte]
[Ficha]
[Placa]
[RutaTransporte]
[ZonaTransporte]
[NumeroAlbaran]
[DetallesItems] numbered 1…n in order
[Item] one line of the detail
object
[NombreItem]
[DescripcionItem]
[IndicadorBienoServicio] false good (1), true service (2)
[IndicadorFacturacion] 0 no facturable, 1 ITBIS 18%, 2 ITBIS 16%, 3 ITBIS 0%, 4 exento
[CantidadItem] up to 2 decimals
[UnidadMedida] Table IV (e.g. 43 unidad)
[PrecioUnitarioItem] in the document currency, up to 4 decimals
[TablaSubDescuento] line discounts
object
[TipoSubDescuento]/[TipoSubRecargo] percentage or amount
For type %
For type $, in the document currency
[TablaSubRecargo] line surcharges
object
[TipoSubDescuento]/[TipoSubRecargo] percentage or amount
For type %
For type $, in the document currency
[TablaImpuestoAdicional] Table I codes (ISC, CDT, propina…)
[TablaCodigosItem]
object
[TipoCodigo] e.g. EAN, interno
[CodigoItem]
ISC data for additional tax codes 006–039
object
[CantidadReferencia]
[UnidadReferencia] Table IV
[TablaSubcantidad]
object
[Subcantidad]
[CodigoSubcantidad] Table IV
[GradosAlcohol]
[PrecioUnitarioReferencia]
[FechaElaboracion]
[FechaVencimientoItem]
[Subtotales] informative subtotals
object
[NumeroSubTotal]
[DescripcionSubtotal]
[Orden]
Line numbers included; amounts are calculated
[DescuentosORecargos]
object
[TipoAjuste] D descuento, R recargo
[DescripcionDescuentooRecargo]
[TipoValor]
[ValorDescuentooRecargo] percentage when valueType is %
[MontoDescuentooRecargo] in the document currency
[IndicadorFacturacionDescuentooRecargo] which billing indicator it applies to
[IndicadorNorma1007]
[Paginacion] line ranges per printed page; page subtotals are calculated
object
[NoLineaDesde]
[NoLineaHasta]
[TipoMoneda] Table II code (USD, EUR…); default DOP. Prices are in this currency
[TipoCambio] required when currency is not DOP
[InformacionReferencia] required on 33 and 34; optional on other types (e.g. code 4 replacing a contingency document)
object
[NCFModificado] e-NCF (E + 12) or NCF (B/A + 10) modified; a 33 cannot modify a 33, nor a 34 a 34
[FechaNCFModificado]
[CodigoModificacion] 1 anula, 2 corrige texto, 3 corrige montos, 4 reemplazo de contingencia, 5 referencia factura de consumo
[RazonModificacion]
[RNCOtroContribuyente]
[SaldoAnterior]
[MontoAvancePago]
Unsigned DGII e-CF XML (no FechaHoraFirma, no Signature). eNCF and FechaVencimientoSecuencia are optional: send them when the ERP numbers the document (the eNCF must be in an active range of the company and unused); leave them out and Gravitas assigns the next number.
Responses
Sección titulada «Responses»Repeated idempotency key with the same payload; original result
object
Example generated
{ "documentId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "status": "example", "statusUrl": "example"}Accepted for processing
object
Example generated
{ "documentId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "status": "example", "statusUrl": "example"}Headers
Sección titulada «Headers»Production_not_enabled, quota denied (trial limit)
Not found or outside the credential scope
object
object
Stable snake_case rule code when the rule has one (e.g. modified_same_type, foreign_id_in_rnc, emitter_rnc_mismatch, encf_invalid, encf_type_mismatch, encf_not_in_range, encf_already_used, sequence_expiry_mismatch).
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "errors": [ { "path": "example", "message": "example", "code": "example" } ]}Idempotency_conflict (same key
Payload too large
All validation errors with field paths; the document is not numbered
object
object
Stable snake_case rule code when the rule has one (e.g. modified_same_type, foreign_id_in_rnc, emitter_rnc_mismatch, encf_invalid, encf_type_mismatch, encf_not_in_range, encf_already_used, sequence_expiry_mismatch).
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "errors": [ { "path": "example", "message": "example", "code": "example" } ]}Rate limit exceeded