Factura Electrónica (FE)
POST /api/v1/service/invoice
Genera una Factura Electrónica de Venta según el Anexo Técnico DIAN v1.9.
Request
POST /api/v1/service/invoice
Identificación
| Campo | Tipo | Requerido | Descripción |
|---|
prefix | string | Sí | Prefijo resolución (ej. "SETP") |
number | integer | Sí | Número consecutivo |
issue_date | string | Sí | Fecha ISO "YYYY-MM-DD" |
issue_time | string | Sí | Hora "HH:MM:SS-05:00" |
invoice_type_code | string | No | "01"=Factura venta (default), "02"=Exportación |
customization_id | string | No | "10" (default) — Tabla 13.1.5.1 |
profile_execution_id | string | No | "2"=Habilitación, "1"=Producción (default) |
notes | string[] | No | Array de textos libres que se emiten como <Note> en el XML |
Seller (Vendedor / Emisor)
| Campo | Tipo | Requerido | Descripción |
|---|
seller.nit | string | Sí | NIT del emisor sin DV |
seller.dv | string | Sí | Dígito de verificación |
seller.name | string | Sí | Razón social o nombre completo |
seller.document_type | string | No | "31"=NIT (default), "13"=CC |
seller.tax_level_code | string | No | Responsabilidades fiscales (default "R-99-PN") |
seller.tax_scheme_id | string | No | "ZZ" (default) |
seller.tax_scheme_name | string | No | "No aplica" (default) |
seller.registration_name | string | No | Nombre comercial si difiere del legal |
seller.organization_type | string | No | "1"=Persona jurídica (default), "2"=Persona natural |
seller.first_name | string | No | Primer nombre (persona natural, doc_type=13) |
seller.middle_name | string | No | Segundo nombre (persona natural) |
seller.family_name | string | No | Primer apellido (persona natural) |
seller.fiscal_regime | string | No | Régimen fiscal: "48"=Simplificado, "49"=Común, "50"=Gran contribuyente |
seller.liability_code | string | No | Código de responsabilidad individual (ej. "O-13", "R-99-PN") |
seller.address.department_code | string | Sí | Código DIVIPOLA departamento |
seller.address.city_code | string | Sí | Código DIVIPOLA municipio |
seller.address.address_line | string | Sí | Dirección |
seller.address.country_code | string | No | "CO" (default) |
seller.address.postal_zone | string | No | Código postal (default "000000") |
Buyer (Adquirente)
| Campo | Tipo | Requerido | Descripción |
|---|
buyer.nit | string | Sí | NIT/CC/CE del comprador |
buyer.dv | string | Sí | Dígito de verificación |
buyer.name | string | Sí | Razón social o nombre |
buyer.document_type | string | No | "31"=NIT (default), "13"=CC, "22"=CE, "41"=Pasaporte |
buyer.email | string | No | Email para notificación |
buyer.tax_level_code | string | No | Responsabilidades fiscales |
buyer.tax_scheme_id | string | No | "ZZ" (default) |
buyer.tax_scheme_name | string | No | "No aplica" (default) |
buyer.registration_name | string | No | Nombre comercial |
buyer.organization_type | string | No | "1"=Persona jurídica (default), "2"=Persona natural |
buyer.first_name | string | No | Primer nombre (persona natural) |
buyer.middle_name | string | No | Segundo nombre (persona natural) |
buyer.family_name | string | No | Primer apellido (persona natural) |
buyer.fiscal_regime | string | No | Régimen fiscal |
buyer.liability_code | string | No | Código de responsabilidad individual |
buyer.address.department_code | string | Sí | Código DIVIPOLA departamento |
buyer.address.city_code | string | Sí | Código DIVIPOLA municipio |
buyer.address.address_line | string | Sí | Dirección |
buyer.address.country_code | string | No | "CO" (default) |
buyer.address.postal_zone | string | No | Código postal (default "000000") |
Lines (Líneas)
| Campo | Tipo | Requerido | Descripción |
|---|
lines[].id | string | Sí | Número de línea (correlativo) |
lines[].description | string | Sí | Descripción del producto/servicio |
lines[].quantity | number | Sí | Cantidad (> 0) |
lines[].unit_code | string | No | Código UNECE (default "94"=unidad) |
lines[].unit_price | number | Sí | Precio unitario (> 0) |
lines[].line_extension_amount | number | Sí | Subtotal del ítem (quantity × unit_price) |
lines[].sellers_item_id | string | No | Código interno del producto |
lines[].additional_item_id | string | No | Código adicional (EAN, referencia) |
lines[].tax_total.tax_amount | number | Sí | Total impuestos de esta línea |
lines[].tax_total.tax_subtotals[].tax_amount | number | Sí | Valor del impuesto |
lines[].tax_total.tax_subtotals[].taxable_amount | number | Sí | Base gravable |
lines[].tax_total.tax_subtotals[].tax_percent | number | Sí | Porcentaje (ej. 19.00) |
lines[].tax_total.tax_subtotals[].tax_scheme_id | string | No | "01"=IVA (default), "04"=INC, "03"=ICA |
lines[].tax_total.tax_subtotals[].tax_scheme_name | string | No | "IVA", "INC", "ICA" |
TaxTotals (Totales de Impuestos)
| Campo | Tipo | Requerido | Descripción |
|---|
tax_totals[].tax_amount | number | Sí | Total por tipo de impuesto |
tax_totals[].tax_subtotals[].tax_amount | number | Sí | Valor del impuesto |
tax_totals[].tax_subtotals[].taxable_amount | number | Sí | Base gravable |
tax_totals[].tax_subtotals[].tax_percent | number | Sí | Porcentaje |
tax_totals[].tax_subtotals[].tax_scheme_id | string | Sí | Código DIAN |
tax_totals[].tax_subtotals[].tax_scheme_name | string | Sí | Nombre del impuesto |
MonetaryTotal (Totales Monetarios)
| Campo | Tipo | Requerido | Descripción |
|---|
monetary_total.line_extension_amount | number | Sí | Subtotal bruto sin impuestos |
monetary_total.tax_exclusive_amount | number | Sí | Base imponible neta |
monetary_total.tax_inclusive_amount | number | Sí | Total con impuestos |
monetary_total.prepaid_amount | number | No | Anticipo (default 0.00) |
monetary_total.payable_amount | number | Sí | Total a pagar |
PaymentMeans (Medio de Pago)
| Campo | Tipo | Requerido | Descripción |
|---|
payment_means.payment_means_code | string | No | "10"=Efectivo (default), "1", "2", "20", "48", "49" |
payment_means.payment_due_date | string | No | Fecha vencimiento (solo crédito) ISO |
Control (Resolución)
| Campo | Tipo | Requerido | Descripción |
|---|
control.invoice_authorization | string | Sí | Número de resolución DIAN |
control.start_date | string | Sí | Fecha inicio vigencia ISO |
control.end_date | string | Sí | Fecha fin vigencia ISO |
control.prefix | string | Sí | Prefijo de la resolución |
control.from_number | integer | Sí | Primer número del rango |
control.to_number | integer | Sí | Último número del rango |
Software
| Campo | Tipo | Requerido | Descripción |
|---|
software_id | string | Sí | UUID del software DIAN registrado |
software_pin | string | Sí | PIN del software DIAN |
Environment
| Campo | Tipo | Requerido | Descripción |
|---|
environment | string | No | "2"=Habilitación, "1"=Producción |
Ejemplo
curl -X POST https://emision.smartapp.com.co/api/v1/service/invoice \
-H "Authorization: Bearer TU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prefix": "SETP",
"number": 100,
"issue_date": "2026-05-01",
"issue_time": "10:30:00-05:00",
"notes": ["Pago a 30 días"],
"seller": {
"nit": "901917345",
"dv": "0",
"name": "Smart Mensajería SAS",
"address": {
"department_code": "11",
"city_code": "11001",
"address_line": "Calle 123 #45-67",
"postal_zone": "110111"
}
},
"buyer": {
"nit": "900123456",
"dv": "1",
"name": "Cliente SAS",
"address": {
"department_code": "11",
"city_code": "11001",
"address_line": "Cra 45 #67-89"
}
},
"lines": [
{
"id": "1",
"description": "Servicio de mensajería",
"quantity": 1,
"unit_price": 100000,
"line_extension_amount": 100000,
"tax_total": {
"tax_amount": 19000,
"tax_subtotals": [
{"tax_amount": 19000, "taxable_amount": 100000, "tax_percent": 19,
"tax_scheme_id": "01", "tax_scheme_name": "IVA"}
]
}
}
],
"tax_totals": [
{
"tax_amount": 19000,
"tax_subtotals": [
{"tax_amount": 19000, "taxable_amount": 100000, "tax_percent": 19,
"tax_scheme_id": "01", "tax_scheme_name": "IVA"}
]
}
],
"monetary_total": {
"line_extension_amount": 100000,
"tax_exclusive_amount": 100000,
"tax_inclusive_amount": 119000,
"payable_amount": 119000
},
"payment_means": {"payment_means_code": "10"},
"control": {
"invoice_authorization": "18760000001",
"start_date": "2019-01-19",
"end_date": "2030-01-19",
"prefix": "SETP",
"from_number": 1,
"to_number": 1000000
},
"software_id": "ccf08616-3061-4c25-9d68-e76f23235a1b",
"software_pin": "13934"
}'
Python
import requests
resp = requests.post(
"https://emision.smartapp.com.co/api/v1/service/invoice",
headers={"Authorization": "Bearer sk_..."},
json={
"prefix": "SETP",
"number": 100,
"issue_date": "2026-05-01",
"issue_time": "10:30:00-05:00",
"seller": {
"nit": "901917345",
"dv": "0",
"name": "Smart Mensajería SAS",
"address": {"department_code": "11", "city_code": "11001", "address_line": "Calle 123 #45-67"},
},
"buyer": {
"nit": "900123456",
"dv": "1",
"name": "Cliente SAS",
"address": {"department_code": "11", "city_code": "11001", "address_line": "Cra 45 #67-89"},
},
"lines": [{
"id": "1", "description": "Servicio de mensajería",
"quantity": 1, "unit_price": 100000, "line_extension_amount": 100000,
"tax_total": {"tax_amount": 19000, "tax_subtotals": [
{"tax_amount": 19000, "taxable_amount": 100000, "tax_percent": 19,
"tax_scheme_id": "01", "tax_scheme_name": "IVA"}]},
}],
"tax_totals": [{"tax_amount": 19000, "tax_subtotals": [
{"tax_amount": 19000, "taxable_amount": 100000, "tax_percent": 19,
"tax_scheme_id": "01", "tax_scheme_name": "IVA"}]}],
"monetary_total": {
"line_extension_amount": 100000, "tax_exclusive_amount": 100000,
"tax_inclusive_amount": 119000, "payable_amount": 119000},
"payment_means": {"payment_means_code": "10"},
"control": {"invoice_authorization": "18760000001",
"start_date": "2019-01-19", "end_date": "2030-01-19",
"prefix": "SETP", "from_number": 1, "to_number": 1000000},
"software_id": "ccf08616-3061-4c25-9d68-e76f23235a1b",
"software_pin": "13934",
}
)
print(resp.json())
Node.js
const resp = await fetch("https://emision.smartapp.com.co/api/v1/service/invoice", {
method: "POST",
headers: { "Authorization": "Bearer sk_...", "Content-Type": "application/json" },
body: JSON.stringify({
prefix: "SETP",
number: 100,
issue_date: "2026-05-01",
issue_time: "10:30:00-05:00",
seller: {
nit: "901917345", dv: "0", name: "Smart Mensajería SAS",
address: { department_code: "11", city_code: "11001", address_line: "Calle 123 #45-67" },
},
buyer: {
nit: "900123456", dv: "1", name: "Cliente SAS",
address: { department_code: "11", city_code: "11001", address_line: "Cra 45 #67-89" },
},
lines: [{
id: "1", description: "Servicio de mensajería",
quantity: 1, unit_price: 100000, line_extension_amount: 100000,
tax_total: { tax_amount: 19000, tax_subtotals: [
{ tax_amount: 19000, taxable_amount: 100000, tax_percent: 19,
tax_scheme_id: "01", tax_scheme_name: "IVA" }] },
}],
tax_totals: [{ tax_amount: 19000, tax_subtotals: [
{ tax_amount: 19000, taxable_amount: 100000, tax_percent: 19,
tax_scheme_id: "01", tax_scheme_name: "IVA" }] }],
monetary_total: { line_extension_amount: 100000, tax_exclusive_amount: 100000,
tax_inclusive_amount: 119000, payable_amount: 119000 },
payment_means: { payment_means_code: "10" },
control: { invoice_authorization: "18760000001",
start_date: "2019-01-19", end_date: "2030-01-19",
prefix: "SETP", from_number: 1, to_number: 1000000 },
software_id: "ccf08616-3061-4c25-9d68-e76f23235a1b",
software_pin: "13934",
})
});
console.log(await resp.json());