---
docId: doc_481b845614b343d6a5020fa811c0bc27
title: Pause or schedule a file
description: Pauses or resumes the connection between an agent and a file, or schedules a date to activate or pause it on its own.
api:
  group: agentes/archivos
  auth: bearer
  operations:
    - operationId: patchLink
      method: PATCH
      path: '/v1/agents/{agentId}/files/{fileId}'
      postmanName: Pause or schedule a file
---

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

# Pause or schedule a file

Choose when an agent uses a file. Send `state` to pause or activate it now, and `schedule` to schedule activation or pausing. **The change applies without publishing** and does not create a version. Only this agent’s connection changes; pausing keeps the file connected.

## Example

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

```bash
curl -X PATCH https://api.platic.ai/v1/agents/$AGENT_ID/files/$FILE_ID \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "state": "paused" }'
```

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

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

</Ways.Way>
</Ways>

## Path parameters

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

## Request body

Send `state`, `schedule` or both.

| Field | Type | Description | Required |
|-------|------|-------------|----------|
| `state` | string | `active` or `paused`. | - |
| `schedule` | object \| null | Scheduled activation and pause dates. `null` removes both. | - |
| `schedule.activateAt` | string \| null | When to activate it, in UTC with milliseconds (`2026-12-01T15:00:00.000Z`). `null` removes it; if you don't send it, it is kept. | - |
| `schedule.pauseAt` | string \| null | When to pause it. Same as `activateAt`. | - |

The dates have to be in the future and at most 366 days away.

### Pause or resume

```json
{ "state": "paused" }
```

### Schedule

It will activate on December 1 at 9:00 (Mexico City time) and pause on December 31:

```json
{
  "schedule": {
    "activateAt": "2026-12-01T15:00:00.000Z",
    "pauseAt": "2026-12-31T15:00:00.000Z"
  }
}
```

To remove just one date, send it as `null`; the one you don't send stays as it is. To remove both:

```json
{ "schedule": null }
```

## Response

`200 OK` with the connection:

```json
{
  "status": "success",
  "data": {
    "agentId": "Xq8mTe2LwP4kZ1aB9cDf",
    "fileId": "fH3kL9mQ2xR7",
    "state": "paused",
    "attachedAt": "2026-10-30T16:02:11.000Z",
    "activateOnReady": false,
    "schedule": {
      "activateAt": "2026-12-01T15:00:00.000Z",
      "pauseAt": "2026-12-31T15:00:00.000Z",
      "last": null
    }
  }
}
```

`data` is the connection, with the fields from [List agent files](/api-reference/agents/files/list#connection-fields-link).

## How what is scheduled is applied

- Platica checks the schedule every few minutes. The change takes effect shortly after the scheduled time, rather than at the exact second.
- **Pausing** is always applied.
- **Activating** is applied only if the file has content ready and whoever scheduled it can still edit the agent. If not, nothing changes and `schedule.last` ends up with `outcome: "failed"` and the reason in `message`.
- Each completed scheduled date is cleared from `schedule` and recorded in `schedule.last`.
- Pausing or resuming manually does not clear the schedule.

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `400` | `INVALID_INPUT` | The body is empty or a value isn't valid. |
| `403` | `RESOURCE_NOT_ACCESSIBLE` | You can't edit the agent. |
| `404` | `RESOURCE_NOT_ACCESSIBLE` | The file isn't connected to this agent. |
| `409` | `FILE_NOT_READY` | Resuming a file that doesn't have content ready yet. |
| `422` | `INVALID_INPUT` | A date has already passed or is more than 366 days away (`details.fields`, for example `["schedule.activateAt"]`). |

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.
- In the [SDK](/sdk), to pause or activate use `platic.agents.files.setState(agentId, fileId, "paused")` and to schedule use `platic.agents.files.schedule(agentId, fileId, { activateAt, pauseAt })` (it accepts `Date` objects or UTC date strings; pass `null` instead of the object to clear both dates).
- To remove the connection, use [Disconnect a file](/api-reference/agents/files/disconnect).
- From an AI agent, the tools are [`set_agent_file_state` and `schedule_agent_file`](/mcp/tools#files).

<Note type="note">

For a file to stop being on **all** agents, use [Delete a file](/api-reference/files/delete). For a page to be read again on its own every so often (on all agents), [keep it up to date](/api-reference/files/update#keep-a-page-up-to-date).

</Note>
