Skip to content

Files

A site's files: list, read, write, upload and download. For the same in the control panel, see Manage files with the File Manager.

Operations

OperationRequest
List a folder of a site GET /v1/sites/{siteId}/files
Read a text file of a site GET /v1/sites/{siteId}/files/content
Write a text file of a site PUT /v1/sites/{siteId}/files/content
Make a folder in a site POST /v1/sites/{siteId}/files/actions/create-folder
Make an empty file in a site POST /v1/sites/{siteId}/files/actions/create-file
Move or rename a file or folder POST /v1/sites/{siteId}/files/actions/move
Copy a file or folder POST /v1/sites/{siteId}/files/actions/copy
Delete files and folders of a site POST /v1/sites/{siteId}/files/actions/delete
Change a file's or folder's permissions POST /v1/sites/{siteId}/files/actions/chmod
Extract a .zip archive in a site POST /v1/sites/{siteId}/files/actions/extract
Make a .zip archive in a site POST /v1/sites/{siteId}/files/actions/compress
Upload a file to a site PUT /v1/sites/{siteId}/files/upload
Download a file or folder of a site GET /v1/sites/{siteId}/files/download

The FileList object

A folder of a site, with everything it holds.

FieldType and description
path

string

The folder's path in the site.

entries

array of objects

What the folder holds: folders (and links to folders) first, then the rest, each by name.

name

string

Its name: the last part of its path.

path

string

Its path in the site, from the site's folder (always starts with /).

type

string

file, dir (a folder), link (a symbolic link: see linkTargetType) or other (anything else, like a socket).

Known values: filedirlinkother More can appear.

sizeBytes

integer

Its size, in bytes. For a folder, the size of the folder's own entry, not of what it holds.

modifiedAt

string An ISO 8601 time, in UTC

When it was last changed.

mode

string

Its permissions, as three octal digits: 644 for most files, 755 for folders.

version

string

Changes whenever the file changes. Send it as expectedVersion when writing the file, so a change made by someone else in the meantime isn't overwritten.

linkTargetType

string or null

For a link: what it leads to: file, dir (a folder), or broken (to nothing, or outside the site's folder, where it can't be followed). Null for anything else.

Known values: filedirbroken More can appear.

truncated

boolean

Whether the folder holds more than 5,000 entries, of which only 5,000 are listed (not chosen by name). List the folders inside it instead.

Example

The FileList object
{
  "path": "/wp-content",
  "entries": [
    {
      "name": "plugins",
      "path": "/wp-content/plugins",
      "type": "dir",
      "sizeBytes": 4096,
      "modifiedAt": "2026-11-12T08:03:19.000Z",
      "mode": "755",
      "version": "1794470599000000000:4096",
      "linkTargetType": null
    },
    {
      "name": "themes",
      "path": "/wp-content/themes",
      "type": "dir",
      "sizeBytes": 4096,
      "modifiedAt": "2026-10-30T14:41:02.000Z",
      "mode": "755",
      "version": "1793371262000000000:4096",
      "linkTargetType": null
    },
    {
      "name": "uploads",
      "path": "/wp-content/uploads",
      "type": "dir",
      "sizeBytes": 4096,
      "modifiedAt": "2026-11-18T16:20:45.000Z",
      "mode": "755",
      "version": "1795018845000000000:4096",
      "linkTargetType": null
    },
    {
      "name": "index.php",
      "path": "/wp-content/index.php",
      "type": "file",
      "sizeBytes": 28,
      "modifiedAt": "2026-09-14T10:00:00.000Z",
      "mode": "644",
      "version": "1789380000000000000:28",
      "linkTargetType": null
    }
  ],
  "truncated": false
}

The FileContent object

A text file of a site, with its version for a safe save.

FieldType and description
path

string

The file's path in the site.

content

string

The file's text (UTF-8).

version

string

The file's version: send it as expectedVersion when writing it back.

sizeBytes

integer

Its size, in bytes.

modifiedAt

string An ISO 8601 time, in UTC

When it was last changed.

Example

The FileContent object
{
  "path": "/robots.txt",
  "content": "User-agent: *\nDisallow: /wp-admin/\nAllow: /wp-admin/admin-ajax.php\n",
  "version": "1795017600000000000:67",
  "sizeBytes": 67,
  "modifiedAt": "2026-11-18T08:00:00.000Z"
}

The FileEntry object

A file, folder or link in a site's folder.

FieldType and description
name

string

Its name: the last part of its path.

path

string

Its path in the site, from the site's folder (always starts with /).

type

string

file, dir (a folder), link (a symbolic link: see linkTargetType) or other (anything else, like a socket).

Known values: filedirlinkother More can appear.

sizeBytes

integer

Its size, in bytes. For a folder, the size of the folder's own entry, not of what it holds.

modifiedAt

string An ISO 8601 time, in UTC

When it was last changed.

mode

string

Its permissions, as three octal digits: 644 for most files, 755 for folders.

version

string

Changes whenever the file changes. Send it as expectedVersion when writing the file, so a change made by someone else in the meantime isn't overwritten.

linkTargetType

string or null

For a link: what it leads to: file, dir (a folder), or broken (to nothing, or outside the site's folder, where it can't be followed). Null for anything else.

Known values: filedirbroken More can appear.

Example

The FileEntry object
{
  "name": "team-photo.jpg",
  "path": "/wp-content/uploads/2026/11/team-photo.jpg",
  "type": "file",
  "sizeBytes": 284113,
  "modifiedAt": "2026-11-18T16:20:45.512Z",
  "mode": "644",
  "version": "1795025645512000000:284113",
  "linkTargetType": null
}

The FilesDeleted object

What a delete removed.

FieldType and description
deleted

integer

How many of the paths were deleted (a folder with all it held counts as one).

Example

The FilesDeleted object
{
  "deleted": 3
}

The FilesExtracted object

What extracting an archive put in place.

FieldType and description
extractedFiles

integer

How many files the archive put in place (folders aren't counted).

extractedBytes

integer

Their total size, in bytes.

Example

The FilesExtracted object
{
  "extractedFiles": 1873,
  "extractedBytes": 48211943
}

Popular

API docs