Notas Crédito
Emite notas crédito electrónicas asociadas a facturas de venta. Usadas para devoluciones, descuentos o correcciones.
POST
/v1/credit-notesCrea una nota crédito asociada a una factura existente.
| Campo | Tipo | Req. | Descripción |
|---|---|---|---|
companyId | string | ✅ | UUID de la empresa emisora |
invoiceId | string | ✅ | UUID de la factura original |
reason | string | ✅ | Motivo de la nota crédito |
items | array | ✅ | Líneas a acreditar |
curl -X POST https://api.mercalo.co/v1/credit-notes \
-H "Authorization: Bearer sk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"companyId": "uuid-empresa",
"invoiceId": "inv_abc123",
"reason": "Devolución de producto",
"items": [{
"description": "Servicio de desarrollo",
"quantity": 1,
"unitPrice": 1500000,
"taxRate": 19
}]
}'Response (200 OK)
{
"id": "cn_xyz789",
"cude": "x9y8z7...",
"status": "ACCEPTED",
"invoiceId": "inv_abc123",
"total": 1785000,
"pdfUrl": "https://api.mercalo.co/v1/credit-notes/cn_xyz789/pdf",
"createdAt": "2026-03-12T11:00:00Z"
}GET
/v1/credit-notes/:idConsulta el detalle de una nota crédito.
curl https://api.mercalo.co/v1/credit-notes/cn_xyz789 \
-H "Authorization: Bearer sk_live_xxx"GET
/v1/credit-notesLista las notas crédito con filtros y paginación.
| Campo | Tipo | Req. | Descripción |
|---|---|---|---|
companyId | string | ✅ | UUID de la empresa |
invoiceId | string | — | Filtrar por factura asociada |
page | number | — | Número de página |
curl "https://api.mercalo.co/v1/credit-notes?companyId=xxx" \
-H "Authorization: Bearer sk_live_xxx"Errores comunes
| Código | Descripción | Solución |
|---|---|---|
400 | Factura no encontrada | Verifica el invoiceId |
422 | Factura no aceptada | Solo facturas aprobadas por la DIAN pueden tener NC |