// Documentos electrónicos
Crear nota débito
Cobra al cliente un valor que no quedó en la factura (intereses, fletes, gastos o un mayor valor) sin tocar la factura original.
/api/v1/debit-notesCuándo se usa
La nota débito es lo contrario de la nota crédito: aumenta lo que el cliente debe por una factura ya emitida. Se usa cuando, después de la venta, aparece un cobro que no quedó en la factura. Sigue el mismo ciclo de vida: 202, luego ACCEPTED o REJECTED.
| Código | Concepto (tabla DIAN) | Ejemplo |
|---|---|---|
1 |
Intereses | Intereses de mora por pago tardío. |
2 |
Gastos por cobrar | Fletes, seguros o empaques no facturados. |
3 |
Cambio del valor | Se facturó un precio menor al pactado. |
4 |
Otros | Cualquier otro mayor valor. Explícalo en reason_description. |
Reglas
- Factura aceptada por la DIAN. Solo se ajustan facturas en
ACCEPTED. - Mismo cliente. El
customerdebe ser el de la factura. - Factura no anulada. Si una nota crédito ya anuló la factura, no admite notas débito.
- No sobre facturas aceptadas en RADIAN. Si el comprador aceptó la factura (evento 033) o quedó aceptada tácitamente (034), la API responde
422. - Sin tope. A diferencia de la nota crédito, la nota débito no tiene límite de valor: suma al saldo de la factura.
- Lo demás lo hereda. Si la factura es de mandatos (11) o AIU (09), la nota conserva el mandante y los componentes; si fue a crédito, toma su plazo.
{
"success": false,
"code": "INVOICE_ACCEPTED_NO_ADJUSTMENTS",
"message": "No se puede emitir una nota débito: la factura fue aceptada expresamente por el comprador (evento 033). Después de la aceptación la factura no admite ajustes."
}Headers
| Header | Obligatorio | Valor |
|---|---|---|
nestfac-api-key |
Sí | Tu API key. Ver Autenticación. |
nestfac-idempotency-key |
Sí | Un valor único por nota. Ver Idempotencia. |
Content-Type |
Sí | application/json |
Ejemplo: envío no facturado
curl -X POST "https://api-sandbox.nestfac.co/api/v1/debit-notes" \
-H "nestfac-api-key: $NESTFAC_API_KEY" \
-H "nestfac-idempotency-key: ND-1042-1" \
-H "Content-Type: application/json" \
-d '{
"billing_account_id": "51f77d28-4862-46ac-8de6-aa7268fc4a9e",
"establishment_id": "d60a21af-1659-4039-80fa-978928b11f38",
"DebitNoteTypeCode": "30",
"currency_code": "COP",
"note": "",
"rounding_amount": 0,
"reference": {
"invoice_id": "627eecb4-365d-4ee6-a7eb-ebf742c27389",
"referenced_invoice_number": "SETP990000092",
"referenced_invoice_cufe": "870efaa2365777bab994f45982bb298812a44d28a6237ffc860689139a72fc9266b5eff9a27f3dca2e7de51a25bdb041",
"reference_issue_date": "2026-10-22"
},
"reason": {
"reason_code": "2",
"reason_description": "Envió de mercancía a Domicilio"
},
"customer": {
"document_identity_type_code": "13",
"document_identity_type_name": "CC",
"customer_type_name": "PERSON",
"document_identification_number": "222222222222",
"legal_name": "Consumidor final",
"address": {
"country_code": "CO"
},
"legal_organization_type_code": "2",
"tax_regime_code": "49",
"responsibilities": [
"R-99-PN"
],
"taxes": []
},
"payments": [
{
"payment_form_code": "1",
"payment_method_code": "10",
"amount": 26000
}
],
"items": [
{
"sku": "ND-002",
"name": "Gastos de envío",
"quantity": 1,
"unit_measure_code": "94",
"unit_price": 26000,
"discount_percent": 0,
"taxes": [],
"withholding_taxes": [],
"code_reference": "ND-003"
}
]
}'// Node.js 18+ (fetch nativo). Corre en TU servidor: la API key nunca va al navegador.
const body = {
"billing_account_id": "51f77d28-4862-46ac-8de6-aa7268fc4a9e",
"establishment_id": "d60a21af-1659-4039-80fa-978928b11f38",
"DebitNoteTypeCode": "30",
"currency_code": "COP",
"note": "",
"rounding_amount": 0,
"reference": {
"invoice_id": "627eecb4-365d-4ee6-a7eb-ebf742c27389",
"referenced_invoice_number": "SETP990000092",
"referenced_invoice_cufe": "870efaa2365777bab994f45982bb298812a44d28a6237ffc860689139a72fc9266b5eff9a27f3dca2e7de51a25bdb041",
"reference_issue_date": "2026-10-22"
},
"reason": {
"reason_code": "2",
"reason_description": "Envió de mercancía a Domicilio"
},
"customer": {
"document_identity_type_code": "13",
"document_identity_type_name": "CC",
"customer_type_name": "PERSON",
"document_identification_number": "222222222222",
"legal_name": "Consumidor final",
"address": {
"country_code": "CO"
},
"legal_organization_type_code": "2",
"tax_regime_code": "49",
"responsibilities": [
"R-99-PN"
],
"taxes": []
},
"payments": [
{
"payment_form_code": "1",
"payment_method_code": "10",
"amount": 26000
}
],
"items": [
{
"sku": "ND-002",
"name": "Gastos de envío",
"quantity": 1,
"unit_measure_code": "94",
"unit_price": 26000,
"discount_percent": 0,
"taxes": [],
"withholding_taxes": [],
"code_reference": "ND-003"
}
]
};
const res = await fetch("https://api-sandbox.nestfac.co/api/v1/debit-notes", {
method: "POST",
headers: {
"nestfac-api-key": process.env.NESTFAC_API_KEY,
"nestfac-idempotency-key": "ND-1042-1",
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
const json = await res.json();
if (!res.ok) throw new Error(`${json.code ?? res.status}: ${json.message ?? JSON.stringify(json.errors)}`);
console.log(json.data);import os
import requests
payload = {
"billing_account_id": "51f77d28-4862-46ac-8de6-aa7268fc4a9e",
"establishment_id": "d60a21af-1659-4039-80fa-978928b11f38",
"DebitNoteTypeCode": "30",
"currency_code": "COP",
"note": "",
"rounding_amount": 0,
"reference": {
"invoice_id": "627eecb4-365d-4ee6-a7eb-ebf742c27389",
"referenced_invoice_number": "SETP990000092",
"referenced_invoice_cufe": "870efaa2365777bab994f45982bb298812a44d28a6237ffc860689139a72fc9266b5eff9a27f3dca2e7de51a25bdb041",
"reference_issue_date": "2026-10-22",
},
"reason": {
"reason_code": "2",
"reason_description": "Envió de mercancía a Domicilio",
},
"customer": {
"document_identity_type_code": "13",
"document_identity_type_name": "CC",
"customer_type_name": "PERSON",
"document_identification_number": "222222222222",
"legal_name": "Consumidor final",
"address": {
"country_code": "CO",
},
"legal_organization_type_code": "2",
"tax_regime_code": "49",
"responsibilities": ["R-99-PN"],
"taxes": [],
},
"payments": [
{
"payment_form_code": "1",
"payment_method_code": "10",
"amount": 26000,
},
],
"items": [
{
"sku": "ND-002",
"name": "Gastos de envío",
"quantity": 1,
"unit_measure_code": "94",
"unit_price": 26000,
"discount_percent": 0,
"taxes": [],
"withholding_taxes": [],
"code_reference": "ND-003",
},
],
}
res = requests.post(
"https://api-sandbox.nestfac.co/api/v1/debit-notes",
headers={
"nestfac-api-key": os.environ["NESTFAC_API_KEY"],
"nestfac-idempotency-key": "ND-1042-1",
},
json=payload,
timeout=30,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{data.get('code', res.status_code)}: {data.get('message') or data.get('errors')}")
print(data["data"])<?php
$payload = [
'billing_account_id' => '51f77d28-4862-46ac-8de6-aa7268fc4a9e',
'establishment_id' => 'd60a21af-1659-4039-80fa-978928b11f38',
'DebitNoteTypeCode' => '30',
'currency_code' => 'COP',
'note' => '',
'rounding_amount' => 0,
'reference' => [
'invoice_id' => '627eecb4-365d-4ee6-a7eb-ebf742c27389',
'referenced_invoice_number' => 'SETP990000092',
'referenced_invoice_cufe' => '870efaa2365777bab994f45982bb298812a44d28a6237ffc860689139a72fc9266b5eff9a27f3dca2e7de51a25bdb041',
'reference_issue_date' => '2026-10-22',
],
'reason' => [
'reason_code' => '2',
'reason_description' => 'Envió de mercancía a Domicilio',
],
'customer' => [
'document_identity_type_code' => '13',
'document_identity_type_name' => 'CC',
'customer_type_name' => 'PERSON',
'document_identification_number' => '222222222222',
'legal_name' => 'Consumidor final',
'address' => [
'country_code' => 'CO',
],
'legal_organization_type_code' => '2',
'tax_regime_code' => '49',
'responsibilities' => ['R-99-PN'],
'taxes' => [],
],
'payments' => [
[
'payment_form_code' => '1',
'payment_method_code' => '10',
'amount' => 26000,
],
],
'items' => [
[
'sku' => 'ND-002',
'name' => 'Gastos de envío',
'quantity' => 1,
'unit_measure_code' => '94',
'unit_price' => 26000,
'discount_percent' => 0,
'taxes' => [],
'withholding_taxes' => [],
'code_reference' => 'ND-003',
],
],
];
$ch = curl_init('https://api-sandbox.nestfac.co/api/v1/debit-notes');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'nestfac-api-key: ' . getenv('NESTFAC_API_KEY'),
'nestfac-idempotency-key: ND-1042-1',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_UNICODE),
]);
$response = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException(($response['code'] ?? $status) . ': ' . ($response['message'] ?? json_encode($response['errors'] ?? null)));
}
print_r($response['data']);// .NET 7+
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api-sandbox.nestfac.co/api/v1/debit-notes");
request.Headers.Add("nestfac-api-key", Environment.GetEnvironmentVariable("NESTFAC_API_KEY"));
request.Headers.Add("nestfac-idempotency-key", "ND-1042-1");
var json = """
{
"billing_account_id": "51f77d28-4862-46ac-8de6-aa7268fc4a9e",
"establishment_id": "d60a21af-1659-4039-80fa-978928b11f38",
"DebitNoteTypeCode": "30",
"currency_code": "COP",
"note": "",
"rounding_amount": 0,
"reference": {
"invoice_id": "627eecb4-365d-4ee6-a7eb-ebf742c27389",
"referenced_invoice_number": "SETP990000092",
"referenced_invoice_cufe": "870efaa2365777bab994f45982bb298812a44d28a6237ffc860689139a72fc9266b5eff9a27f3dca2e7de51a25bdb041",
"reference_issue_date": "2026-10-22"
},
"reason": {
"reason_code": "2",
"reason_description": "Envió de mercancía a Domicilio"
},
"customer": {
"document_identity_type_code": "13",
"document_identity_type_name": "CC",
"customer_type_name": "PERSON",
"document_identification_number": "222222222222",
"legal_name": "Consumidor final",
"address": {
"country_code": "CO"
},
"legal_organization_type_code": "2",
"tax_regime_code": "49",
"responsibilities": [
"R-99-PN"
],
"taxes": []
},
"payments": [
{
"payment_form_code": "1",
"payment_method_code": "10",
"amount": 26000
}
],
"items": [
{
"sku": "ND-002",
"name": "Gastos de envío",
"quantity": 1,
"unit_measure_code": "94",
"unit_price": 26000,
"discount_percent": 0,
"taxes": [],
"withholding_taxes": [],
"code_reference": "ND-003"
}
]
}
""";
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode) throw new Exception($"{(int)response.StatusCode}: {result}");
Console.WriteLine(result);// Java 15+ (java.net.http)
import java.net.URI;
import java.net.http.*;
String json = """
{
"billing_account_id": "51f77d28-4862-46ac-8de6-aa7268fc4a9e",
"establishment_id": "d60a21af-1659-4039-80fa-978928b11f38",
"DebitNoteTypeCode": "30",
"currency_code": "COP",
"note": "",
"rounding_amount": 0,
"reference": {
"invoice_id": "627eecb4-365d-4ee6-a7eb-ebf742c27389",
"referenced_invoice_number": "SETP990000092",
"referenced_invoice_cufe": "870efaa2365777bab994f45982bb298812a44d28a6237ffc860689139a72fc9266b5eff9a27f3dca2e7de51a25bdb041",
"reference_issue_date": "2026-10-22"
},
"reason": {
"reason_code": "2",
"reason_description": "Envió de mercancía a Domicilio"
},
"customer": {
"document_identity_type_code": "13",
"document_identity_type_name": "CC",
"customer_type_name": "PERSON",
"document_identification_number": "222222222222",
"legal_name": "Consumidor final",
"address": {
"country_code": "CO"
},
"legal_organization_type_code": "2",
"tax_regime_code": "49",
"responsibilities": [
"R-99-PN"
],
"taxes": []
},
"payments": [
{
"payment_form_code": "1",
"payment_method_code": "10",
"amount": 26000
}
],
"items": [
{
"sku": "ND-002",
"name": "Gastos de envío",
"quantity": 1,
"unit_measure_code": "94",
"unit_price": 26000,
"discount_percent": 0,
"taxes": [],
"withholding_taxes": [],
"code_reference": "ND-003"
}
]
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api-sandbox.nestfac.co/api/v1/debit-notes"))
.header("nestfac-api-key", System.getenv("NESTFAC_API_KEY"))
.header("nestfac-idempotency-key", "ND-1042-1")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 400) throw new RuntimeException(response.body());
System.out.println(response.body());package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := `{
"billing_account_id": "51f77d28-4862-46ac-8de6-aa7268fc4a9e",
"establishment_id": "d60a21af-1659-4039-80fa-978928b11f38",
"DebitNoteTypeCode": "30",
"currency_code": "COP",
"note": "",
"rounding_amount": 0,
"reference": {
"invoice_id": "627eecb4-365d-4ee6-a7eb-ebf742c27389",
"referenced_invoice_number": "SETP990000092",
"referenced_invoice_cufe": "870efaa2365777bab994f45982bb298812a44d28a6237ffc860689139a72fc9266b5eff9a27f3dca2e7de51a25bdb041",
"reference_issue_date": "2026-10-22"
},
"reason": {
"reason_code": "2",
"reason_description": "Envió de mercancía a Domicilio"
},
"customer": {
"document_identity_type_code": "13",
"document_identity_type_name": "CC",
"customer_type_name": "PERSON",
"document_identification_number": "222222222222",
"legal_name": "Consumidor final",
"address": {
"country_code": "CO"
},
"legal_organization_type_code": "2",
"tax_regime_code": "49",
"responsibilities": [
"R-99-PN"
],
"taxes": []
},
"payments": [
{
"payment_form_code": "1",
"payment_method_code": "10",
"amount": 26000
}
],
"items": [
{
"sku": "ND-002",
"name": "Gastos de envío",
"quantity": 1,
"unit_measure_code": "94",
"unit_price": 26000,
"discount_percent": 0,
"taxes": [],
"withholding_taxes": [],
"code_reference": "ND-003"
}
]
}`
req, _ := http.NewRequest("POST", "https://api-sandbox.nestfac.co/api/v1/debit-notes", strings.NewReader(body))
req.Header.Set("nestfac-api-key", os.Getenv("NESTFAC_API_KEY"))
req.Header.Set("nestfac-idempotency-key", "ND-1042-1")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.StatusCode, string(out))
}// La API key NUNCA va en el navegador. React llama a TU backend,
// que agrega la key y la llave de idempotencia (pestaña Node.js).
async function enviar(datos) {
const res = await fetch("/api/nestfac/debit-notes", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(datos),
});
const json = await res.json();
if (!res.ok) throw new Error(json.message ?? json.code);
return json.data;
}
// const resultado = await enviar(datosDeLaVenta);{
"success": true,
"message": "Debit note received",
"data": {
"debit_note_id": "ea8ba94e-f38b-4d1a-95a2-91261a152ae0",
"status": "PENDING"
}
}Guarda el debit_note_id y consulta la nota hasta que la DIAN responda.
Campos
La nota usa los mismos campos de la factura para customer, payments, items y los opcionales: ver Crear factura. Los propios de la nota son los de la nota crédito, con estas diferencias:
Body
- debit_note_type_codestringpor defecto
30 Tipo de nota. Solo se admite
30(con referencia a una factura).- reference_codestring
Tu referencia de la nota. Sirve para buscarla.
- referenceobjectobligatorio
La factura que se ajusta:
invoice_id(si es de NestFac),referenced_invoice_number,referenced_invoice_cufeyreference_issue_date.- reasonobjectobligatorio
- reason_codestringobligatorio
Concepto de la tabla de arriba.
1234- reason_descriptionstringobligatoriomáx. 500
Explicación para el cliente; aparece en la nota.
- operation_typestringobligatorio si la factura no es de NestFac
Tipo de operación de la factura (
10,09,11…).
// Revisado contra la API el 24 de octubre de 2026.