Saltar al contenido principal

Examples

In this section, practical examples of JSON payloads for the most common requests and responses when interacting with the EMIZOR API are consolidated. These examples will serve as a quick reference during your development.

1. Authentication (Obtain Token)

To consume most of the services, you need to obtain a Bearer token by sending your credentials.

Request:

{
"grant_type": "client_credentials",
"client_id": "<YOUR_CLIENT_ID_PROVIDED_BY_EMIZOR>",
"client_secret": "<YOUR_CLIENT_SECRET_PROVIDED_BY_EMIZOR>"
}

Successful Response (200 OK):

{
"token_type": "Bearer",
"expires_in": 31536000,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0..."
}

2. Validate NIT

Before issuing an invoice with a specific NIT, it is recommended to validate it.

Successful Response (200 OK):

{
"status": "success",
"data": {
"codigo": 0,
"descripcion": "ACTIVO"
}
}

Note: If the code is 0, the NIT is valid. If it is 1, it is invalid (and requires user confirmation to force issuance).


3. Create a Point of Sale

If you need to create a point of sale via API for a specific branch.

Request:

{
"nombre": "Counter Sales 1",
"descripcion": "Main branch register",
"tipo": 0
}

Successful Response (200 OK):

{
"status": "success",
"data": {
"codigo": 1,
"nombre": "Counter Sales 1",
"descripcion": "Main branch register",
"tipo": {
"codigo": 0,
"descripcion": "Fixed Point of Sale"
},
"codigoSucursal": 0
}
}

4. Sales Invoice Issuance (Compra-Venta)

The following is a complete payload example to issue a standard Sales Invoice. Be sure to include the branchCode in the URL when making the request.

Request:

{
"numeroFactura": 9999999998,
"nombreRazonSocial": "Juan Perez",
"codigoPuntoVenta": 9999,
"fechaEmision": "2021-01-25T18:03:00.000Z",
"cafc": "101A6A36DA839",
"codigoExcepcion": 0,
"descuentoAdicional": 0,
"montoGiftCard": 0,
"codigoTipoDocumentoIdentidad": 5,
"numeroDocumento": "12345678",
"complemento": "",
"codigoCliente": "CLI-001",
"codigoMetodoPago": 26,
"numeroTarjeta": 10000000000000000,
"montoTotal": 100.50,
"codigoMoneda": 154,
"montoTotalMoneda": 100.50,
"usuario": "roberto.lopez",
"emailCliente": "juan.perez@example.com",
"telefonoCliente": "70000000",
"extras": {
"uniqueCode": "UNIQ-12345",
"facturaTicket": "TICKET-98765"
},
"codigoLeyenda": 1,
"montoTotalSujetoIva": 100.50,
"tipoCambio": 1,
"detalles": [
{
"codigoProducto": "PROD-A01",
"codigoActividadSin": "106110",
"codigoProductoSin": 99999999,
"descripcion": "Example Product A",
"unidadMedida": 57,
"precioUnitario": 50.25,
"subTotal": 100.50,
"cantidad": 2,
"numeroSerie": "",
"montoDescuento": 0,
"numeroImei": ""
}
]
}

Note: Values like codigoMoneda (154 = Boliviano), codigoTipoDocumentoIdentidad (5 = NIT), and unidadMedida (57 = Unit) must be obtained beforehand through parametric synchronization services.

Examples of issuing invoices, in different scenarios

EXAMPLE #1

  • Using CI
  • Detail discount and global (montoDescuento, descuentoAdicional) respectively
  • unit code used 57 (products)
{
"numeroFactura": 1,
"codigoTipoDocumentoIdentidad": 1,
"complemento": null,
"usuario": "Jorge",
"montoTotal": 140,
"montoTotalSujetoIva": 140,
"emailCliente": "Jorge.ramos@example.com",
"telefonoCliente": null,
"codigoCliente": "cod-234234",
"numeroDocumento": "7643242",
"nombreRazonSocial": "Manuel Garcia",
"detalles": [
{
"subTotal": 150,
"montoDescuento": 18,
"unidadMedida": 57,
"codigoProducto": "HAM-0923",
"codigoActividadSin": "610000",
"codigoProductoSin": 99100,
"cantidad": 8,
"precioUnitario": 21,
"descripcion": "Double cheeseburger"
}
],
"extras":{
"terminos":"Billing terms",
"notas":"Additional invoice notes",
"nombreContacto":"Mario Borges",
"facturaTicket":"f1025-F5G645FT01"
},
"descuentoAdicional": 10
}

EXAMPLE #2

  • Client does not provide data
  • Detail discount and global (montoDescuento, descuentoAdicional) respectively
  • unit code used 57 (products)
{
"numeroFactura": 1,
"codigoTipoDocumentoIdentidad": 5,
"complemento": null,
"usuario": "Jorge",
"montoTotal": 140,
"montoTotalSujetoIva": 140,
"emailCliente": "Jorge.ramos@example.com",
"telefonoCliente": null,
"codigoCliente": "cod-234234",
"numeroDocumento": "99002",
"nombreRazonSocial": "TAX CONTROL",
"detalles": [
{
"subTotal": 150,
"montoDescuento": 18,
"unidadMedida": 57,
"codigoProducto": "HAM-0923",
"codigoActividadSin": "610000",
"codigoProductoSin": 99100,
"cantidad": 8,
"precioUnitario": 21,
"descripcion": "Double cheeseburger"
}
],
"extras":{
"terminos":"Billing terms",
"notas":"Additional invoice notes",
"nombreContacto":"Mario Borges",
"facturaTicket":"f1025-F5G645FT02"
},
"descuentoAdicional": 10
}

EXAMPLE #3

  • Using NIT (codigoTipoDocumentoIdentidad = 5)
  • Detail discount and global (montoDescuento, descuentoAdicional) respectively
  • unit code used 57 (products)
{
"numeroFactura": 1,
"codigoTipoDocumentoIdentidad": 5,
"complemento": null,
"usuario": "Jorge",
"montoTotal": 140,
"montoTotalSujetoIva": 140,
"emailCliente": "Jorge.ramos@example.com",
"telefonoCliente": null,
"codigoCliente": "cod-234234",
"numeroDocumento": "1239823101",
"codigoExcepcion": "0",
"nombreRazonSocial": "EMPRESA S.R.L.",
"detalles": [
{
"subTotal": 150,
"montoDescuento": 18,
"unidadMedida": 57,
"codigoProducto": "HAM-0923",
"codigoActividadSin": "610000",
"codigoProductoSin": 99100,
"cantidad": 8,
"precioUnitario": 21,
"descripcion": "Double cheeseburger",
"facturaTicket":"f1025-F5G645FT03"
}
],
"extras":{
"terminos":"Billing terms",
"notas":"Additional invoice notes",
"nombreContacto":"Mario Borges"
},
"descuentoAdicional": 10
}

EXAMPLE #4

  • Using CI and COMPLEMENT
  • Detail discount and global (montoDescuento, descuentoAdicional) respectively
  • unit code used 57 (products)
{
"numeroFactura": 1,
"codigoTipoDocumentoIdentidad": 1,
"complemento": "A1",
"usuario": "Jorge",
"montoTotal": 140,
"montoTotalSujetoIva": 140,
"emailCliente": "Jorge.ramos@example.com",
"telefonoCliente": null,
"codigoCliente": "cod-234234",
"numeroDocumento": "2345345",
"nombreRazonSocial": "Juan Perez",
"detalles": [
{
"subTotal": 150,
"montoDescuento": 18,
"unidadMedida": 57,
"codigoProducto": "HAM-0923",
"codigoActividadSin": "610000",
"codigoProductoSin": 99100,
"cantidad": 8,
"precioUnitario": 21,
"descripcion": "Double cheeseburger"
}
],
"extras":{
"terminos":"Billing terms",
"notas":"Additional invoice notes",
"nombreContacto":"Mario Borges",
"facturaTicket":"f1025-F5G645FT04"
},
"descuentoAdicional": 10
}

EXAMPLE #5

  • Using CI and COMPLEMENT
  • Without discounts
  • unit code used 58 (services)
{
"numeroFactura": 1,
"codigoTipoDocumentoIdentidad": 1,
"complemento": "A1",
"usuario": "Jorge",
"montoTotal": 20,
"montoTotalSujetoIva": 20,
"emailCliente": "Jorge.ramos@example.com",
"telefonoCliente": null,
"codigoCliente": "cod-234234",
"numeroDocumento": "2345345",
"nombreRazonSocial": "Juan Perez",
"detalles": [
{
"subTotal": 20,
"montoDescuento": null,
"unidadMedida": 58,
"codigoProducto": "SER-213432",
"codigoActividadSin": "610000",
"codigoProductoSin": 99100,
"cantidad": 1,
"precioUnitario": 20,
"descripcion": "Delivery service"
}
],
"extras":{
"terminos":"Billing terms",
"notas":"Additional invoice notes",
"nombreContacto":"Mario Borges",
"facturaTicket":"f1025-F5G645FT05"
},
"descuentoAdicional": null
}