Saltar al contenido principal

Sales Invoice

Step 1: Authentication

If not done previously, the process of obtaining an access_token must be carried out in order to authenticate in the services mentioned in the following steps, following what is described in the authentication section.

Step 2: Validate NIT

This step is only followed when the Identity Document Type included in the invoice is NIT (identity document type code: 5). In these cases, the service to validate the NIT should be used.

GET/api/v1/sucursales/{branchCode}/validate-nit/{nit}Verify if a NIT is valid or not before Impuestos.

Parameters:

  • branchCode: Branch Code.
  • nit: Represents the NIT number to which the invoice will be issued.

Successful response (Code 200)

{
"status": "string",
"data": {
"codigo": 0,
"descripcion": "string"
}
}

Where:

  • codigo: Code of the NIT status.
  • descripcion: Description of the NIT status.

Based on the response from the service, the value of the codigoExcepcion field is defined:

  • Exception Code (0): Valid NIT.
  • Exception Code (1): Invalid NIT.

Note: In case the NIT is Invalid, you must confirm with the end user the issuance of the invoice with an invalid NIT (sending the codigoExcepcion with value 1).

Step 3: Invoicing

To be able to issue an invoice refer to the following link of the documentation:

POST/api/v1/sucursales/{branchCode}/facturas/compra-ventaPerforms the issuance of a Sales Invoice.

URL Parameter:

  • branchCode: The branch code.

Request Body (Example):

{
"numeroFactura": 9999999998,
"nombreRazonSocial": "string",
"codigoPuntoVenta": 9999,
"fechaEmision": "2021-01-25T18:03:00.000Z",
"cafc": "101A6A36DA839",
"codigoExcepcion": true,
"descuentoAdicional": 0,
"montoGiftCard": 0,
"codigoTipoDocumentoIdentidad": 5,
"numeroDocumento": "string",
"complemento": "strin",
"codigoCliente": "string",
"codigoMetodoPago": 26,
"numeroTarjeta": 10000000000000000,
"montoTotal": 1,
"codigoMoneda": 154,
"montoTotalMoneda": 1,
"usuario": "string",
"emailCliente": "string",
"telefonoCliente": "string",
"extras": {
"uniqueCode": "string",
"facturaTicket": "string"
},
"codigoLeyenda": 0,
"montoTotalSujetoIva": 1,
"tipoCambio": 1,
"detalles": [
{
"codigoProducto": "string",
"codigoActividadSin": "string",
"codigoProductoSin": 99999999,
"descripcion": "string",
"unidadMedida": 69,
"precioUnitario": 1,
"subTotal": 1,
"cantidad": 1,
"numeroSerie": "string",
"montoDescuento": 0,
"numeroImei": "string"
}
]
}

Field Specifications

FieldTypeExampleFormatMin SizeMax SizeCompulsory
numeroFacturaNumber119999999No (optional if Emizor manages it)
nombreRazonSocialString3150Yes
codigoPuntoVentaNumber015Yes
fechaEmisionString2021-01-25T18:03:00.000ZISO86012424Yes
cafcString101A6A36DA839113No
codigoExcepcionNumber1--No
descuentoAdicionalNumber17.219Yes
montoGiftCardNumber017.21.09999999.99Yes
codigoTipoDocumentoIdentidadNumber115Yes
numeroDocumentoString123456118Yes
complementoStringA115No
codigoClienteString3150Yes
codigoMetodoPagoNumber115Yes
numeroTarjetaNumber123400005678816No
montoTotalNumber1000.3617.21.09999999.99Yes
codigoMonedaNumber15415Yes
montoTotalMonedaNumber1000.3617.21.09999999.99Yes
usuarioStringRoberto Lopez380Yes
emailClienteStringjuanperez@example.comx@x.x550Yes
telefonoClienteNumber-15No
extrasJSON{ "terminos": "", "notas": "", "nombreContacto": "", "facturaTicket": "546456sd4ds54d6sa" }{}--Yes, The facturaTicket must always be sent as the unique code.
codigoLeyendaNumber115Yes
montoTotalSujetoIvaNumber1000.3617.21.09999999.99Yes
tipoCambioNumber6.9617.21.09999999.99Yes
detallesArray[{},{},...]1 (products)500 (products)Yes
codigoProductoString230Yes
codigoActividadSinString110Yes
codigoProductoSinNumber10001999999Yes
cantidadNumber17.215Yes
precioUnitarioNumber17.215Yes
descripcionString3500Yes
unidadMedidaNumber5731104No
subTotalNumber100.4517.21.09999999.99Yes
montoDescuentoNumber10.1917.2NULL99999.99Yes
numeroSerieString11500No
numeroImeiString11500No

Description of each field:

FieldDescription
numeroFacturaRepresents the invoice number. Note: If you want the system to automatically manage the numbering of your invoices, do not send this field.
nombreRazonSocialRepresents the name or business name of the client.
codigoPuntoVentaRepresents the code of the point of sale in which the invoice is issued.
fechaEmisionRepresents the date of issuance of the invoice.
cafcRepresents the CAFC if applicable (Offline computerized invoices).
codigoExcepcionSend 1 if the issuance of the invoice was confirmed for an invalid NIT. Otherwise send 0.
descuentoAdicionalRepresents the additional discount applied to the total amount.
montoGiftCardRepresents the amount paid with a Gift Card.
codigoTipoDocumentoIdentidadRepresents the code of the client's identity document type. Ex: 1: CI; 2: Foreign CI; 3: Passport; 4: Others; 5: NIT.
numeroDocumentoRepresents the client's document number.
complementoRepresents the complement of the client's CI.
codigoClienteRepresents the client code in the local system.
codigoMetodoPagoRepresents the code of the payment method. (See parameters table payment methods).
numeroTarjetaRepresents the first 4 digits and the last 4 digits of the credit or debit card Ex: 5412000000008451.
montoTotalRepresents the total amount of the invoice.
codigoMonedaRepresents the code of the currency used. (See currency parameter table).
montoTotalMonedaRepresents the total amount of the invoice in the currency used. Note: If the currency is Bolivianos (154) it is the same value as montoTotal.
usuarioRepresents the user who issues the invoice.
emailClienteRepresents the client's email address for sending the invoice.
telefonoClienteRepresents the client's phone number.
extrasRepresents a json object with extra information for the invoice.
extras => facturaTicketThis parameter is mandatory as it serves to register the invoice uniquely in the EMIZOR system.
codigoLeyendaRepresents the code of the legend that will be shown on the invoice. (See legends parameter table).
montoTotalSujetoIvaRepresents the total amount of the invoice that is subject to the payment of VAT. Note: If there is a Gift Card, the total amount subject to VAT is the total amount minus the Gift Card amount.
tipoCambioRepresents the exchange rate used if the currency is different from Bolivianos.
detallesRepresents a json object array with the detail of the invoice items.
codigoProductoRepresents your own product code.
codigoActividadSinRepresents the economic activity code associated with the product.
codigoProductoSinRepresents the SIN product code associated with the product.
descripcionRepresents the product description.
unidadMedidaRepresents the code of the unit of measure of the product. (See unit parameter table).
precioUnitarioRepresents the unit price of the product.
subTotalRepresents the subtotal of the item. Calculated as: (precioUnitario * cantidad) - montoDescuento.
cantidadRepresents the quantity sold.
numeroSerieRepresents the serial number of the product (if applicable).
montoDescuentoRepresents the discount amount applied to the item.
numeroImeiRepresents the IMEI number of the product (if applicable).

Possible errors (Code 400):

{
"status": "error",
"error": {
"numeroFactura": [
"The 'invoice number' attribute is required",
"invoice number must be an integer."
]
// ... other validation errors ...
}
}

Responses

CodeResponse
200Successful. Returns information like cuf, ack_ticket, urlSin, xml_url, shortLink, etc.
201Returns validation error information: {"status": false, "data": {"Field_name": ["validation_1", "validation_2"]}}
401{"message": "Unauthenticated"}
404The process could not be performed due to parameter inconsistency: {"status": false, "data": {"Point of Sale not found", "etc"}}

Important fields in response 200:

  • CUF: Unique Invoice Code managed by Impuestos Nacionales.
  • urlSin: Represents the URL of the invoice in the SIN.
  • emission_type_code: 1 for ONLINE, 2 for OFFLINE.
  • numeroFactura: Invoice number.
  • shortLink: Link of the invoice PDF.
  • xml_url: Link of the invoice XML.

Step 4: Check Invoice Status

The service is described in section 3.2 of this document.

Step 5: Get Invoice Details

The service is described in section 3.3 of this document.