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

# Assign Agent

> Assigns an existing knowledge base to one or more agents.



## OpenAPI

````yaml /api-reference/openapi.json post /api/agents/knowledge-bases/{kb_id}/assign
openapi: 3.1.0
info:
  title: Ello.AI API
  description: API for managing agents and calls in Ello.AI
  version: 1.0.0
servers:
  - url: https://api.getello.ai/
security: []
paths:
  /api/agents/knowledge-bases/{kb_id}/assign:
    post:
      tags:
        - Agents
      summary: Assign Agent
      description: Assigns an existing knowledge base to one or more agents.
      operationId: assignKnowledgeBaseToAgent
      parameters:
        - name: kb_id
          in: path
          required: true
          description: Unique identifier of the knowledge base to assign.
          schema:
            type: string
            example: kb_12345
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              example: {}
              properties:
                agent_ids:
                  type: array
                  items:
                    type: string
                  example:
                    - 68dce5202fc07b92........
              required:
                - agent_ids
      responses:
        '200':
          description: Knowledge base assigned successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 200
                  message:
                    type: string
                    example: Knowledge base assigned successfully
                  data:
                    type: object
                    properties:
                      assigned_assistant_ids:
                        type: array
                        items:
                          type: string
                        description: >-
                          List of agent IDs that the knowledge base was assigned
                          to
                        example:
                          - 6960a6a1f89b3cdd196544cb
                      assistants_with_kb_count:
                        type: integer
                        description: >-
                          Total number of agents that now have this knowledge
                          base assigned
                        example: 2
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 400
                  message:
                    type: string
                    example: Invalid request parameters
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 401
                  message:
                    type: string
                    example: Unauthorized access
                  details:
                    type: string
                    example: Authentication token is missing or invalid
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 404
                  message:
                    type: string
                    example: Knowledge base or agent not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 500
                  message:
                    type: string
                    example: Something went wrong. Please try again later.
      security:
        - apiKey: []
        - bearerAuth: []
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````