Skip to main content
POST
/
v1
/
knowledge
/
documents
Crear un documento desde markdown. El contenido se convierte a BlockNote y se reindexa para búsquedas.
curl --request POST \
  --url https://api.keebai.com/v1/knowledge/documents \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "Política de devolución",
  "markdown": "# Política\n\nTexto de la política...",
  "parent_id": "<string>"
}
'
{
  "id": "<string>",
  "title": "<string>",
  "position": 123,
  "path_cache": "<string>",
  "parent_id": {},
  "created_at": "<string>",
  "updated_at": "<string>"
}
Creates a document in the knowledge base from Markdown. The API converts the Markdown to BlockNote (the editor format used by the portal) and triggers a reindex of the vector store and the full-text index so the document becomes immediately available in POST /v1/knowledge/search. The reindex is enqueued asynchronously in the processing service; the endpoint returns as soon as the document is persisted. Search may take a few seconds to surface the new content (depends on the queue).

Endpoint

POST https://api.keebai.com/v1/knowledge/documents

Required scope

knowledge:write

Headers

HeaderRequiredValue
AuthorizationYesBearer kbai_pk_<token>
Content-TypeYesapplication/json

Body

FieldTypeRequiredDescription
titlestringYesDocument title. Max. 200 characters.
parent_idstringNoObjectId of the parent folder. Omit to create at the root.
markdownstringYesMarkdown content. Supports headings (# ## ###), lists (bulleted, numbered, and task lists) and tables.

Example request

curl -X POST https://api.keebai.com/v1/knowledge/documents \
  -H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Política de devolución",
    "parent_id": "65f3a1b2c3d4e5f6a7b8c9d0",
    "markdown": "# Política de devolución\n\nLas devoluciones se aceptan dentro de los **10 días** posteriores a la compra.\n\n## Pasos\n\n1. Contactar a soporte.\n2. Adjuntar la boleta.\n3. Enviar el producto."
  }'

Response

201 Created

{
  "id": "65f3a1b2c3d4e5f6a7b8c9d3",
  "title": "Política de devolución",
  "node_type": "document",
  "parent_id": "65f3a1b2c3d4e5f6a7b8c9d0",
  "position": 0,
  "path_cache": "/Soporte/Política de devolución",
  "created_at": "2026-04-27T15:35:00.000Z",
  "updated_at": "2026-04-27T15:35:00.000Z"
}
FieldTypeDescription
idstringObjectId of the created document.
node_typestringAlways document.
path_cachestringAbsolute path computed at creation.

400 / 401 / 403 / 404 / 429

  • 400 BAD_REQUEST: title or markdown empty, parent_id points to a document.
  • 403 FORBIDDEN with code: INSUFFICIENT_SCOPE: the PAT doesn’t have knowledge:write.
  • 404 NOT_FOUND: parent_id doesn’t exist or belongs to another company.
To make sure the document is available to assistants, assign it with POST /v1/knowledge/assignments. The content is always searchable via the knowledge:query scope even if it isn’t assigned to any assistant.

Authorizations

Authorization
string
header
required

Personal Access Token con prefijo kbai_pk_. Generar desde el portal con permiso developer.manage_tokens.

Body

application/json
title
string
required

Título del documento.

Maximum string length: 200
Example:

"Política de devolución"

markdown
string
required

Contenido en Markdown. Se convierte a BlockNote JSON al guardar.

Example:

"# Política\n\nTexto de la política..."

parent_id
string

ObjectId de la carpeta padre. Omitir para crear en la raíz.

Response

201 - application/json
id
string
required
title
string
required
node_type
enum<string>
required
Available options:
folder,
document
position
number
required
path_cache
string
required
parent_id
object
created_at
string
updated_at
string