Bot · Conocimiento (RAG)

Referencia de 12 endpoints generados desde mosend-wb-backend/src/modules/bot/knowledge/knowledge.controller.ts.

Base path: /organizations/:orgId/bot/knowledge·12 endpoints·Source: mosend-wb-backend/src/modules/bot/knowledge/knowledge.controller.ts
GET/organizations/:orgId/bot/knowledge
bearer

Lista los documentos del knowledge base del bot.

Path params

  • orgIdstringrequerido

Respuestas

  • 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/bot/knowledge' \
  -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/bot/knowledge/search
bearer

Búsqueda semántica (RAG) sobre el knowledge base: embedding del query + similitud coseno sobre los chunks. Mismo retrieval que usa el bot IA.

Path params

  • orgIdstringrequerido

Body (JSON)

  • querystringrequerido
  • topKnumber

    Cuántos chunks devolver (1-20, default 5).

  • tagsstring[]

    Filtrar a docs que tengan alguno de estos tags.

  • minSimilaritynumber

    Umbral de similitud coseno 0-1 (default 0.3).

Respuestas

  • 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/bot/knowledge/search' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>' \
  -H 'Content-Type: application/json' \
  -d '{"query": "<query>","topK": 0,"tags": [],"minSimilarity": 0}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/bot/knowledge/insights
bearer

Qué buscó el bot en la memoria en los últimos N días: consultas, tasa de respuesta, preguntas sin respuesta agrupadas, uso por agente y por documento.

Path params

  • orgIdstringrequerido

Query params

  • diasstringrequerido

Respuestas

  • 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/bot/knowledge/insights' \
  -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/bot/knowledge/notes
bearer

Crea una nota (texto escrito en el panel) que el bot usa como conocimiento; se procesa como un documento.

Path params

  • orgIdstringrequerido

Body (JSON)

  • titlestring
  • contentstring
  • tagsstring[]
  • resolvesQuestionKeystring

    Clave de la pregunta sin respuesta que esta nota cubre (viene de insights).

Respuestas

  • 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/bot/knowledge/notes' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>' \
  -H 'Content-Type: application/json' \
  -d '{"title": "<title>","content": "<content>","tags": [],"resolvesQuestionKey": "<resolvesQuestionKey>"}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/bot/knowledge/url
bearer

Importa una página web pública como fuente de conocimiento; con syncEveryHours se vuelve a leer periódicamente.

Path params

  • orgIdstringrequerido

Body (JSON)

  • urlstringrequerido
  • titlestring
  • tagsstring[]
  • syncEveryHoursnumber

    Cada cuántas horas volver a leer la página; sin valor = solo a mano.

Respuestas

  • 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/bot/knowledge/url' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>' \
  -H 'Content-Type: application/json' \
  -d '{"url": "https://tu-app.com/endpoint","title": "<title>","tags": [],"syncEveryHours": 0}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
PATCH/organizations/:orgId/bot/knowledge/notes/:id
bearer

Edita una nota; si cambia el texto se vuelve a procesar.

Path params

  • orgIdstringrequerido
  • idstringrequerido

Body (JSON)

  • titlestring
  • contentstring
  • tagsstring[]
  • resolvesQuestionKeystring

    Clave de la pregunta sin respuesta que esta nota cubre (viene de insights).

Respuestas

  • 200
curl -X PATCH 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/bot/knowledge/notes/00000000-0000-0000-0000-000000000000' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>' \
  -H 'Content-Type: application/json' \
  -d '{"title": "<title>","content": "<content>","tags": [],"resolvesQuestionKey": "<resolvesQuestionKey>"}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/bot/knowledge/:id
bearer

Obtiene el detalle de un documento del knowledge base.

Path params

  • orgIdstringrequerido
  • idstringrequerido

Respuestas

  • 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/bot/knowledge/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/bot/knowledge
bearer

Sube un documento. Multipart: file + opcional title, tags (coma).

Path params

  • orgIdstringrequerido

Body (JSON)

  • titlestring
  • tagsstring

    Lista de tags separados por coma (viene como string en multipart).

Respuestas

  • 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/bot/knowledge' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>' \
  -H 'Content-Type: application/json' \
  -d '{"title": "<title>","tags": "<tags>"}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
PATCH/organizations/:orgId/bot/knowledge/:id/title
bearer

Renombra un documento del knowledge base.

Path params

  • orgIdstringrequerido
  • idstringrequerido

Body (JSON)

  • titlestringrequerido

Respuestas

  • 200
curl -X PATCH 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/bot/knowledge/00000000-0000-0000-0000-000000000000/title' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>' \
  -H 'Content-Type: application/json' \
  -d '{"title": "<title>"}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
PATCH/organizations/:orgId/bot/knowledge/:id/tags
bearer

Re-etiqueta un documento (afecta qué bots lo usan).

Path params

  • orgIdstringrequerido
  • idstringrequerido

Body (JSON)

  • tagsstring[]requerido

Respuestas

  • 200
curl -X PATCH 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/bot/knowledge/00000000-0000-0000-0000-000000000000/tags' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>' \
  -H 'Content-Type: application/json' \
  -d '{"tags": []}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "cliente-vip",
    "color": "#16a34a"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/bot/knowledge/:id/reprocess
bearer

Re-extrae texto + regenera embeddings.

Path params

  • orgIdstringrequerido
  • idstringrequerido

Respuestas

  • 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/bot/knowledge/00000000-0000-0000-0000-000000000000/reprocess' \
  -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/bot/knowledge/:id
bearer

Elimina un documento del knowledge base (chunks y objeto S3).

Path params

  • orgIdstringrequerido
  • idstringrequerido

Respuestas

  • 200
curl -X DELETE 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/bot/knowledge/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"
}