# Client API: Container Apps: Files

> The 13 Client API operations for files.

Source: https://docs.coritan.com/api/reference/client/container-apps/servers-files/

Part of [Container Apps](/api/reference/client/container-apps/).

## Operations

| Method | Path | Summary |
| --- | --- | --- |
| POST | [`/api/v1/client/servers/{uuid}/files/chmod`](#op-post-api-v1-client-servers-uuid-files-chmod) | Set the mode of files under root: [{"file": name, "mode": "0644"}] |
| POST | [`/api/v1/client/servers/{uuid}/files/compress`](#op-post-api-v1-client-servers-uuid-files-compress) | Create a compressed archive of files |
| GET | [`/api/v1/client/servers/{uuid}/files/contents`](#op-get-api-v1-client-servers-uuid-files-contents) | Get contents of a file |
| POST | [`/api/v1/client/servers/{uuid}/files/copy`](#op-post-api-v1-client-servers-uuid-files-copy) | Duplicate a file next to itself; Wings picks the name copy suffix |
| POST | [`/api/v1/client/servers/{uuid}/files/decompress`](#op-post-api-v1-client-servers-uuid-files-decompress) | Extract an archive on the server |
| POST | [`/api/v1/client/servers/{uuid}/files/delete`](#op-post-api-v1-client-servers-uuid-files-delete) | Delete a file |
| GET | [`/api/v1/client/servers/{uuid}/files/download`](#op-get-api-v1-client-servers-uuid-files-download) | Stream one file from Wings through the platform, as an attachment |
| GET | [`/api/v1/client/servers/{uuid}/files/list`](#op-get-api-v1-client-servers-uuid-files-list) | List files in a server directory |
| POST | [`/api/v1/client/servers/{uuid}/files/mkdir`](#op-post-api-v1-client-servers-uuid-files-mkdir) | Create a folder name under root |
| POST | [`/api/v1/client/servers/{uuid}/files/pull`](#op-post-api-v1-client-servers-uuid-files-pull) | Download and save a file from a URL |
| POST | [`/api/v1/client/servers/{uuid}/files/rename`](#op-post-api-v1-client-servers-uuid-files-rename) | Rename a file |
| POST | [`/api/v1/client/servers/{uuid}/files/upload`](#op-post-api-v1-client-servers-uuid-files-upload) | Multipart upload proxied to Wings, so the browser never talks to the node |
| POST | [`/api/v1/client/servers/{uuid}/files/write`](#op-post-api-v1-client-servers-uuid-files-write) | Write content to a file |

### Set the mode of files under root: [{"file": name, "mode": "0644"}] {#op-post-api-v1-client-servers-uuid-files-chmod}

`POST /api/v1/client/servers/{uuid}/files/chmod`

Set the mode of files under ``root``: ``[{"file": name, "mode": "0644"}]``.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `root` | string | no |
| `files` | array of object | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Create a compressed archive of files {#op-post-api-v1-client-servers-uuid-files-compress}

`POST /api/v1/client/servers/{uuid}/files/compress`

Create a compressed archive of files.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `paths` | array of string | yes |
| `archive_name` | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Get contents of a file {#op-get-api-v1-client-servers-uuid-files-contents}

`GET /api/v1/client/servers/{uuid}/files/contents`

Get contents of a file.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `path` | query | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Duplicate a file next to itself; Wings picks the name copy suffix {#op-post-api-v1-client-servers-uuid-files-copy}

`POST /api/v1/client/servers/{uuid}/files/copy`

Duplicate a file next to itself; Wings picks the ``name copy`` suffix.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `location` | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Extract an archive on the server {#op-post-api-v1-client-servers-uuid-files-decompress}

`POST /api/v1/client/servers/{uuid}/files/decompress`

Extract an archive on the server.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `archive_path` | string | yes |
| `destination` | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Delete a file {#op-post-api-v1-client-servers-uuid-files-delete}

`POST /api/v1/client/servers/{uuid}/files/delete`

Delete a file.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `path` | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Stream one file from Wings through the platform, as an attachment {#op-get-api-v1-client-servers-uuid-files-download}

`GET /api/v1/client/servers/{uuid}/files/download`

Stream one file from Wings through the platform, as an attachment.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `path` | query | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### List files in a server directory {#op-get-api-v1-client-servers-uuid-files-list}

`GET /api/v1/client/servers/{uuid}/files/list`

List files in a server directory.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuid` | path | string | yes |  |
| `directory` | query | string | no | Default: `/`. |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Create a folder name under root {#op-post-api-v1-client-servers-uuid-files-mkdir}

`POST /api/v1/client/servers/{uuid}/files/mkdir`

Create a folder ``name`` under ``root``.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `root` | string | no |
| `name` | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Download and save a file from a URL {#op-post-api-v1-client-servers-uuid-files-pull}

`POST /api/v1/client/servers/{uuid}/files/pull`

Download and save a file from a URL.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `url` | string | yes |
| `destination_path` | string | yes |
| `filename` | string or null | no |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Rename a file {#op-post-api-v1-client-servers-uuid-files-rename}

`POST /api/v1/client/servers/{uuid}/files/rename`

Rename a file.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `old_path` | string | yes |
| `new_path` | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Multipart upload proxied to Wings, so the browser never talks to the node {#op-post-api-v1-client-servers-uuid-files-upload}

`POST /api/v1/client/servers/{uuid}/files/upload`

Multipart upload proxied to Wings, so the browser never talks to the node.

A batch is written file by file; when a later file fails after earlier
ones landed, the response names both lists rather than failing the whole
request, so a retry does not have to guess what is already on disk.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuid` | path | string | yes |  |
| `directory` | query | string | no | Default: `/`. |

#### Request body

`multipart/form-data` (required)

| Field | Type | Required |
| --- | --- | --- |
| `files` | array of string (binary) | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Write content to a file {#op-post-api-v1-client-servers-uuid-files-write}

`POST /api/v1/client/servers/{uuid}/files/write`

Write content to a file.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `path` | string | yes |
| `content` | string | no |
| `expected_hash` | string or null | no |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |
