---
docId: doc_ee39b99e0c904bde888fd440a747bdc9
title: Disconnect a file
description: Disconnects a file from an agent. It applies immediately; the file isn't deleted.
api:
  group: agentes/archivos
  auth: bearer
  operations:
    - operationId: unlinkFile
      method: DELETE
      path: '/v1/agents/{agentId}/files/{fileId}'
      postmanName: Disconnect a file
---

<script>
  import { Ways } from '$lib/components';
</script>

# Disconnect a file

Remove a file from this agent by specifying its `fileId` in the URL. **The change applies immediately, without publishing**, and does not create a version. The file remains in the workspace and on other agents. To delete it from all agents, use [Delete a file](/api-reference/files/delete).

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl -X DELETE https://api.platic.ai/v1/agents/$AGENT_ID/files/$FILE_ID \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.agents.files.disconnect("agent_123", "file_123");
```

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `agentId` | string | Agent id | ✓ |
| `fileId` | string | File id | ✓ |

## Request body

No body.

## Response

`204 No Content`, with no body.

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `403` | `RESOURCE_NOT_ACCESSIBLE` | You can't edit the agent. |
| `404` | `RESOURCE_NOT_ACCESSIBLE` | The file isn't connected to this agent. |

The ones that apply to all operations are in [common errors](/api-reference/files#common-errors).

## Notes

- Being able to edit the agent is enough; Integrations isn't needed.
- A file that no agent uses stays in the workspace, with no agents. It can be [connected](/api-reference/agents/files/connect) again or [deleted](/api-reference/files/delete).
- What was scheduled on this connection is lost.
- For the agent to stop using it without losing the connection, use [Pause or schedule a file](/api-reference/agents/files/schedule).
- From an AI agent, the tool is [`disconnect_agent_file`](/mcp/tools#files).
