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

# Attach to Agent

Attach a knowledge base document to an agent, allowing the agent to query it during calls.

### Headers

<ParamField header="X-API-Key" type="string" required>
  Your API key for authentication.
</ParamField>

<ParamField header="X-Organization-Id" type="string" required>
  The organization ID.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be `application/json`.
</ParamField>

### Request Body

<ParamField body="documentation_id" type="string" required>
  The ID of the document to attach (format: `doc_[a-f0-9]{12,}`).
</ParamField>

<ParamField body="agent_id" type="string" required>
  The ID of the agent to attach to (format: `agent_[a-f0-9]{12,}`).
</ParamField>

### Permissions

* `kb:update` (admin, agent\_manager)

### Response

<ResponseField name="success" type="boolean">
  Indicates if the attachment was successful.
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable success message.
</ResponseField>

<RequestExample>
  ```json Request theme={null}
  {
    "documentation_id": "doc_a1b2c3d4e5f6",
    "agent_id": "agent_b2c3d4e5f6a7"
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "message": "Document 'Product Manual' attached to agent 'Sales Rep'"
  }
  ```
</ResponseExample>

### Errors

<ResponseField name="404" type="object">
  Document or agent not found.
</ResponseField>

<ResponseField name="403" type="object">
  Document or agent belongs to different organization.
</ResponseField>
