> ## Documentation Index
> Fetch the complete documentation index at: https://docs.turncall.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Link Knowledge Base

> Link a knowledge base to an agent.



## OpenAPI

````yaml /openapi.json post /v1/agents/{agent_id}/knowledge-bases
openapi: 3.1.0
info:
  title: TurnCall
  description: Production voice agent platform API
  version: 0.1.0
servers: []
security: []
paths:
  /v1/agents/{agent_id}/knowledge-bases:
    post:
      tags:
        - agents
      summary: Link Knowledge Base
      description: Link a knowledge base to an agent.
      operationId: link_knowledge_base_v1_agents__agent_id__knowledge_bases_post
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Agent Id
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LinkKnowledgeBaseRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: >-
                  Response Link Knowledge Base V1 Agents  Agent Id  Knowledge
                  Bases Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    LinkKnowledgeBaseRequest:
      properties:
        knowledge_base_id:
          type: string
          format: uuid
          title: Knowledge Base Id
        mode:
          type: string
          pattern: ^(auto|tool|prompt)$
          title: Mode
          default: auto
        priority:
          type: integer
          maximum: 100
          minimum: 0
          title: Priority
          default: 0
        top_k:
          type: integer
          maximum: 50
          minimum: 1
          title: Top K
          default: 5
        similarity_threshold:
          type: number
          maximum: 1
          minimum: 0
          title: Similarity Threshold
          default: 0.3
        tool_description:
          anyOf:
            - type: string
              maxLength: 1024
            - type: 'null'
          title: Tool Description
      type: object
      required:
        - knowledge_base_id
      title: LinkKnowledgeBaseRequest
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````