Skip to main content
POST
/
v1
/
knowledge
/
assignments
Asignar nodos de la base de conocimientos a todos los workers de un asistente.
curl --request POST \
  --url https://api.keebai.com/v1/knowledge/assignments \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "assistant_id": "<string>",
  "node_ids": [
    "<string>"
  ]
}
'
{
  "workers_updated": 123
}
Associates one or more knowledge base nodes with an assistant. The assignment propagates to all of the assistant’s workers (except supervisor workers), adding the given node_id values to their list of accessible knowledge. The operation is idempotent: if a node was already assigned, it isn’t duplicated. To list available assistants use GET /v1/assistants. To get validated node_id values for your folders and documents use GET /v1/knowledge/tree. After the assignment, a reindex is enqueued to refresh the workers’ cached embeddings.

Endpoint

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

Required scope

knowledge:assign

Headers

HeaderRequiredValue
AuthorizationYesBearer kbai_pk_<token>
Content-TypeYesapplication/json

Body

FieldTypeRequiredDescription
assistant_idstringYesObjectId of the target assistant.
node_idsstring[]YesObjectId values of the nodes to assign. Minimum 1, maximum 200.

Example request

curl -X POST https://api.keebai.com/v1/knowledge/assignments \
  -H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "assistant_id": "65f3a1b2c3d4e5f6a7b8c9aa",
    "node_ids": [
      "65f3a1b2c3d4e5f6a7b8c9d3",
      "65f3a1b2c3d4e5f6a7b8c9d4"
    ]
  }'

Response

200 OK

{
  "workers_updated": 3
}
FieldTypeDescription
workers_updatednumberNumber of assistant workers that received the assignment. 0 means the assistant has no non-supervisor workers.

400 / 401 / 403 / 404 / 429

  • 400 BAD_REQUEST: assistant_id or node_ids with invalid format, or node_ids empty.
  • 403 FORBIDDEN with code: INSUFFICIENT_SCOPE: the PAT doesn’t have knowledge:assign.
  • 404 NOT_FOUND: the assistant_id doesn’t exist, or one or more node_ids don’t belong to your company.

Authorizations

Authorization
string
header
required

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

Body

application/json
assistant_id
string
required

ObjectId del asistente destino.

node_ids
string[]
required

ObjectIds de los nodos a asignar a todos los workers del asistente.

Response

200 - application/json
workers_updated
number
required