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

# Files

> List, read and manage files and directories in an application.

Use the application ID as `appId` in each call, or use the corresponding [Application method](https://docs.camposcloud.com/sdk/javascript/application.md#methods). For ZIP archives, see [`uploadFile`](https://docs.camposcloud.com/sdk/javascript/client#uploadfile) and [`downloadFile`](https://docs.camposcloud.com/sdk/javascript/client#downloadfile).

## Local validation

All five methods require a non-blank string ID other than `.` or `..`. The SDK encodes the ID as a URL segment.

| Parameter | Local rules |
| - | - |
| Path | Non-blank string up to 1,024 characters. Use forward slashes. The SDK rejects a `..` component, control characters, backslashes, angle brackets, colons, double quotes, vertical bars, question marks and asterisks. `listFiles` also accepts an empty path for the root. |
| Source path | The same rules apply. The SDK also rejects the root, including forms made entirely of slashes and `.` components. |
| Name | A single component up to 255 characters, with no slash, leading or trailing whitespace, or trailing period. Path rules apply. |

## Methods

### listFiles

`GET /v1/apps/{appId}/files`

Pass optional `path: string` to list a directory or read a UTF-8 file. Omit it or pass `path: ""` to list the root. Pass the raw path and the SDK encodes the query parameter.

Returns [`ApplicationFilesResponse`](https://docs.camposcloud.com/sdk/javascript/types#applicationfilesresponse).

```typescript theme={null}
const root = await api.listFiles({ appId, path: "" });
const file = await api.listFiles({ appId, path: "/settings.json" });
if (!file.isDirectory) console.log(file.content);
```

An inaccessible app or path can return HTTP 404.

### deleteFiles

`DELETE /v1/apps/{appId}/files`

Pass `files: string[]` with 1–50 source paths.

Returns [`DeleteFilesResponse`](https://docs.camposcloud.com/sdk/javascript/types#deletefilesresponse), with separate arrays of successful and failed paths.

```typescript theme={null}
const { success, failed } = await api.deleteFiles({ appId, files: ["/old.json"] });
```

### createFile

`POST /v1/apps/{appId}/files/create`

Pass `path: string` (parent directory), `name: string` and `isDirectory: boolean`. For a file, `content: string` is required and may be empty. The SDK enforces a 1 MiB UTF-8 limit. For a directory, set `isDirectory: true` and omit `content`.

Returns [`MessageResponse`](https://docs.camposcloud.com/sdk/javascript/types#messageresponse).

```typescript theme={null}
await api.createFile({ appId, path: "/", name: "settings.json", isDirectory: false, content: "{}" });
```

### renameFile

`PATCH /v1/apps/{appId}/files/rename`

Pass `filePath: string` (source path) and `newName: string` (one name in the same directory).

Returns [`MessageResponse`](https://docs.camposcloud.com/sdk/javascript/types#messageresponse).

```typescript theme={null}
await api.renameFile({ appId, filePath: "/settings.json", newName: "config.json" });
```

### moveFiles

`PATCH /v1/apps/{appId}/files/move`

Pass `filePath: string[]` with 1–50 source paths and `pathTarget: string` for the destination directory. Use `/` for the root.

Returns [`MessageResponse`](https://docs.camposcloud.com/sdk/javascript/types#messageresponse).

```typescript theme={null}
await api.moveFiles({ appId, filePath: ["/config.json"], pathTarget: "/config" });
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.