Assign to an agent

Assign (connect) a knowledge base to an agent, enforcing the one-knowledge-base-per-agent policy.

POST https://api.centerfy.ai/webhooks/inbound/agents/:id/knowledge-base

Headers

HeaderRequiredValueDescription
x-api-keyYesyour sub-account API key (cfy_…)Authenticates the request; or Authorization: Bearer <key>.
Content-TypeYesapplication/jsonRequest body is JSON.

Path parameters

NameTypeRequiredDescription
idstring (uuid)YesThe agent id.

Body parameters

NameTypeRequiredDefaultDescription
knowledge_base_idstringYes—UUID of the knowledge base to assign; must be a valid UUID and reference an existing knowledge base (404 otherwise).
max_resultsintegerNo—Maximum number of retrieval results. Must be a positive integer if provided (400 otherwise). Defaults to 5.
similarity_thresholdnumberNo—Retrieval similarity cutoff. Must be a number between 0 and 1 inclusive if provided (400 otherwise). Defaults to 0.30.
enabledbooleanNo—Whether the connection is enabled. Defaults to true.

Request body

{
  "knowledge_base_id": "<knowledge_base_id>",
  "max_results": 5,
  "similarity_threshold": 0.3,
  "enabled": true
}

Example

curl -X POST "https://api.centerfy.ai/webhooks/inbound/agents/{id}/knowledge-base" \
  -H "x-api-key: $CENTERFY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "knowledge_base_id": "<knowledge_base_id>",
  "max_results": 5,
  "similarity_threshold": 0.3,
  "enabled": true
}'
import { CenterfyClient } from "@centerfy/sdk";

const centerfy = new CenterfyClient({ apiKey: process.env.CENTERFY_API_KEY! });

const result = await centerfy.agents.assignKnowledgeBase("<agentId>", {
  "knowledge_base_id": "<knowledge_base_id>",
  "max_results": 5,
  "similarity_threshold": 0.3,
  "enabled": true
});
console.log(result);
centerfy agents assign-knowledge-base <agentId> '{"knowledge_base_id":"<knowledge_base_id>","max_results":5,"similarity_threshold":0.3,"enabled":true}'

MCP tool: centerfy_agents_assign_knowledge_base (see MCP server)

Response

{
  "status": "success",
  "assigned": true,
  "connection_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "agent_id": "11111111-2222-3333-4444-555555555555",
  "knowledge_base_id": "66666666-7777-8888-9999-000000000000",
  "max_results": 5,
  "similarity_threshold": 0.3,
  "enabled": true
}

Errors

  • 201 — on success.
  • 400 — for an invalid agent id, invalid knowledge_base_id, or bad max_results/similarity_threshold.
  • 404 — if the agent or the knowledge base does not exist.

Notes

One knowledge base per agent: any existing knowledge base connection for the agent is replaced.

© 2026 Centerfy AI. All rights reserved.