Sales

Referencia de 32 endpoints generados desde mosend-wb-backend/src/modules/sales/sales.controller.ts.

Base path: /organizations/:orgId/sales·32 endpoints·Source: mosend-wb-backend/src/modules/sales/sales.controller.ts
GET/organizations/:orgId/sales/entitlement
bearer

Entitlement 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>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
PUT/organizations/:orgId/sales/addons
bearer

Activa/desactiva Ventas y/o Facturación electrónica como add-on de tarifa fija (billing:write).

Path params

  • orgIdstringrequerido

Body (JSON)

  • salesBillingboolean
  • einvoicingboolean

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}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/sales/products
bearer

Catálogo de productos de Ventas.

Path params

  • orgIdstringrequerido

Query params

  • qstring

    Filtra 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>'
Response · 200
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "createdAt": "2026-05-01T03:42:18.123Z"
    }
  ],
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/sales/products/:productId
bearer

Un producto del catálogo.

Path params

  • orgIdstringrequerido
  • productIdstringrequerido

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>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/sales/products
bearer

Crea un producto (sales:write).

Path params

  • orgIdstringrequerido

Body (JSON)

  • namestringrequerido
  • skustring
  • descriptionstring
  • priceCentsnumberrequerido

    Precio unitario en centavos (evita floats).

  • currencystring

    Moneda ISO-4217 (3 letras mayúsculas). Por defecto COP.

  • taxRatenumber

    IVA en porcentaje entero (0–100; típicamente 19, 5 o 0).

  • unitCodestring

    Código de unidad de medida DIAN (ej. "94"=unidad).

  • imageMediaIdstring · uuid
  • activeboolean

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}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
PATCH/organizations/:orgId/sales/products/:productId
bearer

Edita un producto (sales:write).

Path params

  • orgIdstringrequerido
  • productIdstringrequerido

Body (JSON)

  • namestring
  • skustring
  • descriptionstring
  • priceCentsnumber
  • currencystring
  • taxRatenumber
  • unitCodestring
  • imageMediaIdstring · uuid
  • activeboolean

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}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
DELETE/organizations/:orgId/sales/products/:productId
bearer

Elimina un producto (sales:write).

Path params

  • orgIdstringrequerido
  • productIdstringrequerido

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>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/sales/orders
bearer

Crea un pedido/venta (sales:write).

Path params

  • orgIdstringrequerido

Body (JSON)

  • contactIdstring · uuid
  • conversationIdstring · uuid
  • billingProfileIdstring · uuid

    Cliente de la venta (perfil de facturación). Se preselecciona al facturar.

  • channelstring
    WHATSAPPWEBINSTAGRAMSTOREMANUAL
  • currencystring
  • notesstring
  • itemsCreateSalesOrderItemDto[]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": []}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/sales/orders
bearer

Lista pedidos (filtro por estado/contacto/conversación).

Path params

  • orgIdstringrequerido

Query params

  • statusstring
  • contactIdstring
  • conversationIdstring

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>'
Response · 200
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "createdAt": "2026-05-01T03:42:18.123Z"
    }
  ],
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/sales/orders/:orderId
bearer

Un pedido con sus líneas.

Path params

  • orgIdstringrequerido
  • orderIdstringrequerido

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>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
PATCH/organizations/:orgId/sales/orders/:orderId/status
bearer

Cambia el estado de un pedido (sales:write).

Path params

  • orgIdstringrequerido
  • orderIdstringrequerido

Body (JSON)

  • statusstringrequerido
    DRAFTCONFIRMEDPAIDFULFILLEDCANCELLED

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"}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
DELETE/organizations/:orgId/sales/orders/:orderId
bearer

Elimina un pedido en borrador/cancelado (sales:write).

Path params

  • orgIdstringrequerido
  • orderIdstringrequerido

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>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/sales/billing-profiles
bearer

Perfiles 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>'
Response · 200
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "createdAt": "2026-05-01T03:42:18.123Z"
    }
  ],
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/sales/billing-profiles/:profileId
bearer

Un perfil de facturación.

Path params

  • orgIdstringrequerido
  • profileIdstringrequerido

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>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/sales/billing-profiles
bearer

Crea un perfil de facturación (sales:write).

Path params

  • orgIdstringrequerido

Body (JSON)

  • contactIdstring · uuid

    Contacto dueño (opcional: null = tercero/empresa suelta).

  • legalNamestringrequerido
  • docNumberstringrequerido
  • dvnumber
  • emailstring
  • phonestring
  • addressstring
  • municipalityIdnumber
  • typeDocumentIdnumber
  • typeOrganizationIdnumber
  • typeRegimeIdnumber
  • typeLiabilityIdnumber
  • isDefaultboolean

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}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
PATCH/organizations/:orgId/sales/billing-profiles/:profileId
bearer

Edita un perfil de facturación (sales:write).

Path params

  • orgIdstringrequerido
  • profileIdstringrequerido

Body (JSON)

  • legalNamestring
  • docNumberstring
  • dvnumber
  • emailstring
  • phonestring
  • addressstring
  • municipalityIdnumber
  • typeDocumentIdnumber
  • typeOrganizationIdnumber
  • typeRegimeIdnumber
  • typeLiabilityIdnumber
  • isDefaultboolean

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}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
DELETE/organizations/:orgId/sales/billing-profiles/:profileId
bearer

Elimina un perfil de facturación (sales:write).

Path params

  • orgIdstringrequerido
  • profileIdstringrequerido

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>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/sales/einvoicing/config
bearer

Config 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>'
Response · 200
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "createdAt": "2026-05-01T03:42:18.123Z"
    }
  ],
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/sales/einvoicing/companies
bearer

Empresas 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>'
Response · 200
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "createdAt": "2026-05-01T03:42:18.123Z"
    }
  ],
  "timestamp": "2026-05-01T03:42:18.123Z"
}
DELETE/organizations/:orgId/sales/einvoicing/companies/:configId
bearer

Elimina una empresa emisora sin documentos (sales:config).

Path params

  • orgIdstringrequerido
  • configIdstringrequerido

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>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
PUT/organizations/:orgId/sales/einvoicing/config
bearer

Configura el conector de facturación (sales:config).

Path params

  • orgIdstringrequerido

Body (JSON)

  • configIdstring · uuid

    Empresa 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.

  • namestring

    Nombre visible de la emisora ("Mosend SAS").

  • isDefaultboolean

    Convierte esta emisora en la predeterminada de la org.

  • baseUrlstring

    Solo 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).

  • apiKeystring

    Token apidian en claro (se cifra); '' lo borra.

  • idSoftwarestring
  • resolutionNumberstring

    Resolución DIAN elegida (ResolutionNumber). '' la limpia.

  • environmentstring
    habilitacionproduccion
  • establishmentNamestring
  • establishmentAddressstring
  • establishmentPhonestring

    El 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.

  • emitterNitstring

    NIT del emisor en el proveedor (solo dígitos, sin DV). Se usa para armar la ruta de descarga del PDF: /invoice/{nit}/{archivo}.

  • establishmentEmailstring
  • establishmentMunicipalityIdnumber

    null 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.

  • paymentFormIdnumber
    12

    Forma 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.

  • paymentMethodIdnumber

    Medio de pago DIAN por defecto (10=Efectivo, 42=Consignación, …).

  • sendByEmailboolean
  • autoSendOnIssueboolean

    Mandar la factura por WhatsApp en cuanto la DIAN la acepta.

  • autoSendCreditNotesboolean

    Mandar también la nota crédito al aceptarse. Interruptor aparte.

  • sendTemplateNamestring

    Plantilla aprobada con cabecera de DOCUMENTO, para fuera de la ventana de 24 h.

  • sendTemplateLangstring
  • enabledboolean
  • creditNotePrefixstring

    Prefijo 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>"}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/sales/einvoicing/validate
bearer

Valida el token y trae la numeración vigente (sales:config).

Path params

  • orgIdstringrequerido

Body (JSON)

  • apiKeystring

    Token en claro a probar; si se omite, usa el guardado.

  • idSoftwarestring
  • baseUrlstring

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"}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/sales/einvoicing/customers/import
bearer

Importa 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>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/sales/einvoicing/customer-lookup
bearer

Busca un cliente por documento (registrados en Diaxpi) para autocompletar (sales:read).

Path params

  • orgIdstringrequerido

Query params

  • docstringrequerido
  • docTypestringrequerido
  • configIdstringrequerido

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>'
Response · 200
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "createdAt": "2026-05-01T03:42:18.123Z"
    }
  ],
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/sales/einvoicing/invoices
bearer

Facturas/notas crédito (filtro por pedido, estado, tipo).

Path params

  • orgIdstringrequerido

Query params

  • orderIdstring
  • contactIdstring

    Documentos 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.

  • statusstring
  • docTypestring

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>'
Response · 200
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "createdAt": "2026-05-01T03:42:18.123Z"
    }
  ],
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/sales/einvoicing/invoices
bearer

Genera la factura electrónica de un pedido (opcional, sales:write).

Path params

  • orgIdstringrequerido

Body (JSON)

  • orderIdstring · uuid
  • itemsCreateSalesOrderItemDto[]

    Líneas de la factura directa. Excluyente con `orderId`.

  • contactIdstring · uuid

    Contacto/conversación de origen, para poder rastrear de dónde salió.

  • conversationIdstring · uuid
  • notesstring

    Nota que va en el documento.

  • idempotencyKeystring

    Clave 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 · uuid

    Empresa emisora desde la que se factura. Sin esto, la predeterminada.

  • billingProfileIdstring · uuid

    A quién facturar (opcional: si no, el perfil por defecto del contacto).

  • paymentFormIdnumber

    Override 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}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/sales/einvoicing/credit-notes
bearer

Emite una NOTA CRÉDITO total que anula una factura emitida (sales:write).

Path params

  • orgIdstringrequerido

Body (JSON)

  • invoiceIdstring · uuidrequerido
  • discrepancyCodenumber

    Có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.

  • reasonstring

    Motivo visible en la nota.

  • forceboolean

    Confirma 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}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/sales/einvoicing/license-orders/invoice
bearer

Factura una venta de licencias que el cliente pidió con factura (sales:write).

Path params

  • orgIdstringrequerido

Body (JSON)

  • customerOrderIdstring · uuidrequerido

    Venta de licencia ya PAGADA/ENTREGADA a facturar.

  • billingProfileIdstring · uuid

    A quién facturar. Si no viene, se usan los datos fiscales de abajo.

  • legalNamestring

    Datos fiscales que dio el cliente al pedir la factura.

  • docNumberstring
  • dvnumber
  • emailstring
  • addressstring
  • typeDocumentIdnumber
  • typeOrganizationIdnumber
  • typeRegimeIdnumber
  • typeLiabilityIdnumber
  • paymentFormIdnumber
  • paymentMethodIdnumber
  • itemsCreateSalesOrderItemDto[]

    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%.

  • notesstring

    Notas/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>"}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/sales/einvoicing/license-orders/draft
bearer

Crea (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"}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/sales/einvoicing/invoices/:invoiceId/send
bearer

Envía la factura/nota al cliente por WhatsApp, en su misma conversación (messages:send).

Path params

  • orgIdstringrequerido
  • invoiceIdstringrequerido

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>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/sales/einvoicing/invoices/:invoiceId/pdf
bearer

Descarga el PDF de una factura/nota emitida (base64, sales:read).

Path params

  • orgIdstringrequerido
  • invoiceIdstringrequerido

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>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/sales/sales/invoice-pdf/:token
público

Sirve 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>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}