Sales
Referencia de 32 endpoints generados desde mosend-wb-backend/src/modules/sales/sales.controller.ts.
/organizations/:orgId/sales·32 endpoints·Source: mosend-wb-backend/src/modules/sales/sales.controller.ts/organizations/:orgId/sales/entitlementEntitlement del módulo de Ventas y de la Facturación electrónica (plan vs add-on).
Path params
orgIdstringrequerido
Respuestas
- 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/entitlement' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/addonsActiva/desactiva Ventas y/o Facturación electrónica como add-on de tarifa fija (billing:write).
Path params
orgIdstringrequerido
Body (JSON)
salesBillingbooleaneinvoicingboolean
Respuestas
- 200
curl -X PUT 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/addons' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"salesBilling": true,"einvoicing": true}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/productsCatálogo de productos de Ventas.
Path params
orgIdstringrequerido
Query params
qstringFiltra por texto (nombre o SKU).
activestring'true' = solo activos, 'false' = solo inactivos, ausente = todos.
Respuestas
- 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/products' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": [
{
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
}
],
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/products/:productIdUn producto del catálogo.
Path params
orgIdstringrequeridoproductIdstringrequerido
Respuestas
- 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/products/00000000-0000-0000-0000-000000000000' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/productsCrea un producto (sales:write).
Path params
orgIdstringrequerido
Body (JSON)
namestringrequeridoskustringdescriptionstringpriceCentsnumberrequeridoPrecio unitario en centavos (evita floats).
currencystringMoneda ISO-4217 (3 letras mayúsculas). Por defecto COP.
taxRatenumberIVA en porcentaje entero (0–100; típicamente 19, 5 o 0).
unitCodestringCódigo de unidad de medida DIAN (ej. "94"=unidad).
imageMediaIdstring · uuidactiveboolean
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/products' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"name": "<name>","sku": "<sku>","description": "<description>","priceCents": 0,"currency": "<currency>","taxRate": 0,"unitCode": "<unitCode>","imageMediaId": "00000000-0000-0000-0000-000000000000","active": true}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/products/:productIdEdita un producto (sales:write).
Path params
orgIdstringrequeridoproductIdstringrequerido
Body (JSON)
namestringskustringdescriptionstringpriceCentsnumbercurrencystringtaxRatenumberunitCodestringimageMediaIdstring · uuidactiveboolean
Respuestas
- 200
curl -X PATCH 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/products/00000000-0000-0000-0000-000000000000' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"name": "<name>","sku": "<sku>","description": "<description>","priceCents": 0,"currency": "<currency>","taxRate": 0,"unitCode": "<unitCode>","imageMediaId": "00000000-0000-0000-0000-000000000000","active": true}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/products/:productIdElimina un producto (sales:write).
Path params
orgIdstringrequeridoproductIdstringrequerido
Respuestas
- 200
curl -X DELETE 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/products/00000000-0000-0000-0000-000000000000' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/ordersCrea un pedido/venta (sales:write).
Path params
orgIdstringrequerido
Body (JSON)
contactIdstring · uuidconversationIdstring · uuidbillingProfileIdstring · uuidCliente de la venta (perfil de facturación). Se preselecciona al facturar.
channelstringWHATSAPPWEBINSTAGRAMSTOREMANUALcurrencystringnotesstringitemsCreateSalesOrderItemDto[]requerido
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/orders' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"contactId": "00000000-0000-0000-0000-000000000000","conversationId": "00000000-0000-0000-0000-000000000000","billingProfileId": "00000000-0000-0000-0000-000000000000","channel": "WHATSAPP","currency": "<currency>","notes": "<notes>","items": []}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/ordersLista pedidos (filtro por estado/contacto/conversación).
Path params
orgIdstringrequerido
Query params
statusstringcontactIdstringconversationIdstring
Respuestas
- 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/orders' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": [
{
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
}
],
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/orders/:orderIdUn pedido con sus líneas.
Path params
orgIdstringrequeridoorderIdstringrequerido
Respuestas
- 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/orders/00000000-0000-0000-0000-000000000000' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/orders/:orderId/statusCambia el estado de un pedido (sales:write).
Path params
orgIdstringrequeridoorderIdstringrequerido
Body (JSON)
statusstringrequeridoDRAFTCONFIRMEDPAIDFULFILLEDCANCELLED
Respuestas
- 200
curl -X PATCH 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/orders/00000000-0000-0000-0000-000000000000/status' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"status": "DRAFT"}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/orders/:orderIdElimina un pedido en borrador/cancelado (sales:write).
Path params
orgIdstringrequeridoorderIdstringrequerido
Respuestas
- 200
curl -X DELETE 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/orders/00000000-0000-0000-0000-000000000000' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/billing-profilesPerfiles de facturación (opcional: por contacto).
Path params
orgIdstringrequerido
Query params
contactIdstring
Respuestas
- 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/billing-profiles' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": [
{
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
}
],
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/billing-profiles/:profileIdUn perfil de facturación.
Path params
orgIdstringrequeridoprofileIdstringrequerido
Respuestas
- 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/billing-profiles/00000000-0000-0000-0000-000000000000' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/billing-profilesCrea un perfil de facturación (sales:write).
Path params
orgIdstringrequerido
Body (JSON)
contactIdstring · uuidContacto dueño (opcional: null = tercero/empresa suelta).
legalNamestringrequeridodocNumberstringrequeridodvnumberemailstringphonestringaddressstringmunicipalityIdnumbertypeDocumentIdnumbertypeOrganizationIdnumbertypeRegimeIdnumbertypeLiabilityIdnumberisDefaultboolean
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/billing-profiles' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"contactId": "00000000-0000-0000-0000-000000000000","legalName": "<legalName>","docNumber": "<docNumber>","dv": 0,"email": "<email>","phone": "<phone>","address": "<address>","municipalityId": 0,"typeDocumentId": 0,"typeOrganizationId": 0,"typeRegimeId": 0,"typeLiabilityId": 0,"isDefault": true}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/billing-profiles/:profileIdEdita un perfil de facturación (sales:write).
Path params
orgIdstringrequeridoprofileIdstringrequerido
Body (JSON)
legalNamestringdocNumberstringdvnumberemailstringphonestringaddressstringmunicipalityIdnumbertypeDocumentIdnumbertypeOrganizationIdnumbertypeRegimeIdnumbertypeLiabilityIdnumberisDefaultboolean
Respuestas
- 200
curl -X PATCH 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/billing-profiles/00000000-0000-0000-0000-000000000000' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"legalName": "<legalName>","docNumber": "<docNumber>","dv": 0,"email": "<email>","phone": "<phone>","address": "<address>","municipalityId": 0,"typeDocumentId": 0,"typeOrganizationId": 0,"typeRegimeId": 0,"typeLiabilityId": 0,"isDefault": true}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/billing-profiles/:profileIdElimina un perfil de facturación (sales:write).
Path params
orgIdstringrequeridoprofileIdstringrequerido
Respuestas
- 200
curl -X DELETE 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/billing-profiles/00000000-0000-0000-0000-000000000000' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/configConfig del conector de facturación (sin el token).
Path params
orgIdstringrequerido
Query params
configIdstringrequerido
Respuestas
- 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/config' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": [
{
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
}
],
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/companiesEmpresas emisoras de la org (la predeterminada primero).
Path params
orgIdstringrequerido
Respuestas
- 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/companies' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": [
{
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
}
],
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/companies/:configIdElimina una empresa emisora sin documentos (sales:config).
Path params
orgIdstringrequeridoconfigIdstringrequerido
Respuestas
- 200
curl -X DELETE 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/companies/00000000-0000-0000-0000-000000000000' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/configConfigura el conector de facturación (sales:config).
Path params
orgIdstringrequerido
Body (JSON)
configIdstring · uuidEmpresa emisora a editar. Sin esto se edita la predeterminada, o se crea la primera — que es el flujo de una org con una sola empresa.
namestringNombre visible de la emisora ("Mosend SAS").
isDefaultbooleanConvierte esta emisora en la predeterminada de la org.
baseUrlstringSolo https. El host además se valida contra la allowlist en el service (anti-SSRF: este valor termina en un fetch con el Bearer del emisor).
apiKeystringToken apidian en claro (se cifra); '' lo borra.
idSoftwarestringresolutionNumberstringResolución DIAN elegida (ResolutionNumber). '' la limpia.
environmentstringhabilitacionproduccionestablishmentNamestringestablishmentAddressstringestablishmentPhonestringEl proveedor valida `numeric|digits_between:7,10` y un "+57 320 555 1234" tumba TODAS las emisiones con un 422. Se acepta cualquier formato y el servicio se queda con los dígitos: rechazarlo dejaba a las orgs con un teléfono legado sin poder guardar nada más.
emitterNitstringNIT del emisor en el proveedor (solo dígitos, sin DV). Se usa para armar la ruta de descarga del PDF: /invoice/{nit}/{archivo}.
establishmentEmailstringestablishmentMunicipalityIdnumbernull lo borra (la factura vuelve al establecimiento de Diaxpi). `@Min(1)` porque un 0 es falsy: se colaba como "sin municipio" y devolvía al proveedor a su default (Cali), justo lo que el respaldo evita.
paymentFormIdnumber12Forma de pago DIAN por defecto (1=Contado, 2=Crédito). El proveedor NO lo valida cuando llega como objeto: un id inexistente revienta en 500.
paymentMethodIdnumberMedio de pago DIAN por defecto (10=Efectivo, 42=Consignación, …).
sendByEmailbooleanautoSendOnIssuebooleanMandar la factura por WhatsApp en cuanto la DIAN la acepta.
autoSendCreditNotesbooleanMandar también la nota crédito al aceptarse. Interruptor aparte.
sendTemplateNamestringPlantilla aprobada con cabecera de DOCUMENTO, para fuera de la ventana de 24 h.
sendTemplateLangstringenabledbooleancreditNotePrefixstringPrefijo de la resolución de Nota Crédito en el proveedor (default "NC"). '' vuelve al default.
Respuestas
- 200
curl -X PUT 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/config' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"configId": "00000000-0000-0000-0000-000000000000","name": "<name>","isDefault": true,"baseUrl": "https://tu-app.com/endpoint","apiKey": "<apiKey>","idSoftware": "<idSoftware>","resolutionNumber": "<resolutionNumber>","environment": "habilitacion","establishmentName": "<establishmentName>","establishmentAddress": "<establishmentAddress>","establishmentPhone": "<establishmentPhone>","emitterNit": "<emitterNit>","establishmentEmail": "<establishmentEmail>","establishmentMunicipalityId": 0,"paymentFormId": 1,"paymentMethodId": 0,"sendByEmail": true,"autoSendOnIssue": true,"autoSendCreditNotes": true,"sendTemplateName": "<sendTemplateName>","sendTemplateLang": "<sendTemplateLang>","enabled": true,"creditNotePrefix": "<creditNotePrefix>"}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/validateValida el token y trae la numeración vigente (sales:config).
Path params
orgIdstringrequerido
Body (JSON)
apiKeystringToken en claro a probar; si se omite, usa el guardado.
idSoftwarestringbaseUrlstring
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/validate' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"apiKey": "<apiKey>","idSoftware": "<idSoftware>","baseUrl": "https://tu-app.com/endpoint"}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/customers/importImporta los clientes de Diaxpi como perfiles de facturación (sales:write).
Path params
orgIdstringrequerido
Query params
configIdstringrequerido
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/customers/import' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/customer-lookupBusca un cliente por documento (registrados en Diaxpi) para autocompletar (sales:read).
Path params
orgIdstringrequerido
Query params
docstringrequeridodocTypestringrequeridoconfigIdstringrequerido
Respuestas
- 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/customer-lookup' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": [
{
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
}
],
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/invoicesFacturas/notas crédito (filtro por pedido, estado, tipo).
Path params
orgIdstringrequerido
Query params
orderIdstringcontactIdstringDocumentos de los pedidos de UN contacto (panel del inbox). Sin esto el panel tenía que traerse los 200 últimos de toda la org y los pedidos antiguos del contacto se quedaban sin su estado fiscal.
statusstringdocTypestring
Respuestas
- 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/invoices' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": [
{
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
}
],
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/invoicesGenera la factura electrónica de un pedido (opcional, sales:write).
Path params
orgIdstringrequerido
Body (JSON)
orderIdstring · uuiditemsCreateSalesOrderItemDto[]Líneas de la factura directa. Excluyente con `orderId`.
contactIdstring · uuidContacto/conversación de origen, para poder rastrear de dónde salió.
conversationIdstring · uuidnotesstringNota que va en el documento.
idempotencyKeystringClave de idempotencia de la emisión directa. Sin pedido no hay nada a lo que atar «una factura activa por X», y un consecutivo de la DIAN quemado dos veces solo se deshace con nota crédito. Dos envíos con la misma clave son la misma factura.
configIdstring · uuidEmpresa emisora desde la que se factura. Sin esto, la predeterminada.
billingProfileIdstring · uuidA quién facturar (opcional: si no, el perfil por defecto del contacto).
paymentFormIdnumberOverride de forma/medio de pago para ESTA factura (si no, el de la config).
paymentMethodIdnumber
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/invoices' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"orderId": "00000000-0000-0000-0000-000000000000","items": [],"contactId": "00000000-0000-0000-0000-000000000000","conversationId": "00000000-0000-0000-0000-000000000000","notes": "<notes>","idempotencyKey": "<idempotencyKey>","configId": "00000000-0000-0000-0000-000000000000","billingProfileId": "00000000-0000-0000-0000-000000000000","paymentFormId": 0,"paymentMethodId": 0}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/credit-notesEmite una NOTA CRÉDITO total que anula una factura emitida (sales:write).
Path params
orgIdstringrequerido
Body (JSON)
invoiceIdstring · uuidrequeridodiscrepancyCodenumberCódigo de discrepancia DIAN, tal cual el catálogo oficial: 1=Devolución parcial, 2=Anulación de factura, 3=Rebaja o descuento, 4=Ajuste de precio, 5=Otros. Default 2 (anulación). El catálogo llega hasta el 5. El proveedor valida `between:1,6` pero luego busca el 6 en su tabla con `findOrFail` fuera del try/catch: un 6 devuelve 500 y deja la nota en ERROR, con la factura imposible de anular sin forzar.
reasonstringMotivo visible en la nota.
forcebooleanConfirma emitir aunque un intento anterior quedara sin confirmar (el usuario ya verificó en el proveedor que no salió). Evita la doble NC.
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/credit-notes' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"invoiceId": "00000000-0000-0000-0000-000000000000","discrepancyCode": 0,"reason": "<reason>","force": true}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/license-orders/invoiceFactura una venta de licencias que el cliente pidió con factura (sales:write).
Path params
orgIdstringrequerido
Body (JSON)
customerOrderIdstring · uuidrequeridoVenta de licencia ya PAGADA/ENTREGADA a facturar.
billingProfileIdstring · uuidA quién facturar. Si no viene, se usan los datos fiscales de abajo.
legalNamestringDatos fiscales que dio el cliente al pedir la factura.
docNumberstringdvnumberemailstringaddressstringtypeDocumentIdnumbertypeOrganizationIdnumbertypeRegimeIdnumbertypeLiabilityIdnumberpaymentFormIdnumberpaymentMethodIdnumberitemsCreateSalesOrderItemDto[]Líneas EDITADAS desde el Facturador (revisión antes de emitir): si vienen, la factura se arma con estas (con su IVA por línea) en vez de derivarlas de la venta. Cada línea = descripción + cantidad + precio + IVA%.
notesstringNotas/observaciones de la factura (opcional).
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/license-orders/invoice' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"customerOrderId": "00000000-0000-0000-0000-000000000000","billingProfileId": "00000000-0000-0000-0000-000000000000","legalName": "<legalName>","docNumber": "<docNumber>","dv": 0,"email": "<email>","address": "<address>","typeDocumentId": 0,"typeOrganizationId": 0,"typeRegimeId": 0,"typeLiabilityId": 0,"paymentFormId": 0,"paymentMethodId": 0,"items": [],"notes": "<notes>"}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/license-orders/draftCrea (o reutiliza) el pedido espejo BORRADOR de una venta de licencia, sin emitir. Para revisar y facturar luego desde Ventas → Pedidos (sales:write).
Path params
orgIdstringrequerido
Body (JSON)
customerOrderIdstring · uuidrequerido
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/license-orders/draft' \
-H 'X-Api-Key: mk_live_<prefix>.<secret>' \
-H 'Content-Type: application/json' \
-d '{"customerOrderId": "00000000-0000-0000-0000-000000000000"}'{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/invoices/:invoiceId/sendEnvía la factura/nota al cliente por WhatsApp, en su misma conversación (messages:send).
Path params
orgIdstringrequeridoinvoiceIdstringrequerido
Respuestas
- 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/invoices/00000000-0000-0000-0000-000000000000/send' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/einvoicing/invoices/:invoiceId/pdfDescarga el PDF de una factura/nota emitida (base64, sales:read).
Path params
orgIdstringrequeridoinvoiceIdstringrequerido
Respuestas
- 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/sales/einvoicing/invoices/00000000-0000-0000-0000-000000000000/pdf' \ -H 'X-Api-Key: mk_live_<prefix>.<secret>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}/organizations/:orgId/sales/sales/invoice-pdf/:tokenSirve el PDF de una factura por token (público).
Path params
tokenstringrequerido
curl -X GET 'https://api.mosend.dev/organizations/:orgId/sales/sales/invoice-pdf/<token>'
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"createdAt": "2026-05-01T03:42:18.123Z"
},
"timestamp": "2026-05-01T03:42:18.123Z"
}