# Detach files from agent (/docs/api-reference/knowledge-base/detachKnowledgeBaseFiles)

> Detach multiple knowledge-base files from an agent.



**POST** `/knowledge_base/detach`

Detach multiple knowledge-base files from an agent.

```yaml
operationId: detachKnowledgeBaseFiles
requestBody:
  required: true
  content:
    application/json:
      schema:
        type: object
        required:
          - file_ids
          - agent_id
        properties:
          file_ids:
            type: array
            minItems: 1
            items:
              type: integer
            description: List of knowledge-base file IDs to detach.
            example:
              - 17686
          agent_id:
            type: integer
            description: ID of the agent to detach files from.
            example: 158910
responses:
  '200':
    description: Files detached.
    content:
      application/json:
        schema:
          type: object
          properties:
            success:
              type: boolean
            message:
              type: string
        example:
          success: true
          message: 1 files detached from agent successfully
```

**Python SDK**

```python
# Detach files from an agent
file_ids = [123, 456]  # Replace with your file IDs
agent_id = 789  # Replace with your agent ID

response = client.knowledge_base.detach(file_ids, agent_id)
print(response)
```

**curl**

```bash
curl -X POST "https://backend.omnidim.io/api/v1/knowledge_base/detach" \
  -H "Authorization: Bearer $OMNIDIM_API_KEY"
```
