API Reference

Files

Browse and manage files and directories. Supports multi-mount storage (internal, SD card, USB).

Type Definitions

bash
type File {
  name: String!
  path: String!
  permission: String!        # "rw" | "r"
  createdAt: String          # ISO 8601, null on some filesystems
  updatedAt: String!         # ISO 8601
  size: Long!                # 0 for directories
  isDir: Boolean!
  children: Int!             # 0 for files; child count for directories
  mediaId: String!           # media store ID, empty when unavailable
}

type StorageMount {
  id: String!
  name: String!
  path: String!
  mountPoint: String!
  fsType: String!
  totalBytes: Long!
  usedBytes: Long!
  freeBytes: Long!
  remote: Boolean!
  alias: String!
}

type FileInfo {
  path: String!
  updatedAt: String!
  size: Long!
  tags: [Tag!]!
  data: MediaFileInfo          # image/video/audio metadata, null for other types
}

type MediaFileInfo {
  # Union-like structure; fields vary by media type (image / video / audio)
  width: Int
  height: Int
  duration: Int               # milliseconds (video / audio)
  artist: String
  album: String
  title: String
}

type FavoriteFolder {
  rootPath: String!
  fullPath: String!
  alias: String               # optional display alias, empty when not set
}

Operations

query

mounts

List all available storage volumes (internal, SD card, USB).

bash
query GetMounts {
  mounts {
    id name path mountPoint fsType totalBytes usedBytes freeBytes remote alias
  }
}
query

recentFiles

List recently modified files across all storage. Source of the "Recent" view in the Files UI.

bash
query GetRecentFiles {
  recentFiles {
    name path permission createdAt updatedAt size isDir children mediaId
  }
}
query

files

List and search files under a root path with pagination. Pass an empty query to list all.

bash
query GetFiles($root: String!, $offset: Int!, $limit: Int!, $query: String!, $sortBy: FileSortBy!) {
  files(root: $root, offset: $offset, limit: $limit, query: $query, sortBy: $sortBy) {
    name path permission createdAt updatedAt size isDir children mediaId
  }
}
query

fileInfo

Get stat + media metadata + tags for a single file. Pass fileName so the server can detect image/video/audio and load width, height, duration, etc.

bash
query GetFileInfo($id: ID!, $path: String!, $fileName: String!) {
  fileInfo(id: $id, path: $path, fileName: $fileName) {
    path updatedAt size
    tags { id name }
    data { width height duration artist album title }
  }
}
query

fileIds

Resolve a list of filesystem paths to their media-store IDs (empty string when not indexed).

bash
query GetFileIds($paths: [String!]!) {
  fileIds(paths: $paths)
}
query

uploadedChunks

List chunk indexes that have already been received for a resumable chunked upload. Used to resume interrupted uploads.

bash
query GetUploadedChunks($fileId: String!) {
  uploadedChunks(fileId: $fileId)
}
mutation

createDir

Create a new directory and return it as a File object.

bash
mutation CreateDir($path: String!) {
  createDir(path: $path) {
    name path permission createdAt updatedAt size isDir children mediaId
  }
}
mutation

renameFile

Rename a file or directory.

bash
mutation RenameFile($path: String!, $name: String!) {
  renameFile(path: $path, name: $name)
}
mutation

writeTextFile

Write text content to a file. Set overwrite=false to append a "(1)" suffix when the file already exists.

bash
mutation WriteTextFile($path: String!, $content: String!, $overwrite: Boolean!) {
  writeTextFile(path: $path, content: $content, overwrite: $overwrite) {
    name path size updatedAt
  }
}
mutation

deleteFiles

Delete one or more files or directories by exact path.

bash
mutation DeleteFiles($paths: [String!]!) {
  deleteFiles(paths: $paths)
}
mutation

copyFile

Copy a file or directory to a destination path. Set overwrite to replace an existing file.

bash
mutation CopyFile($src: String!, $dst: String!, $overwrite: Boolean!) {
  copyFile(src: $src, dst: $dst, overwrite: $overwrite)
}
mutation

moveFile

Move a file or directory to a destination path. Set overwrite to replace an existing file.

bash
mutation MoveFile($src: String!, $dst: String!, $overwrite: Boolean!) {
  moveFile(src: $src, dst: $dst, overwrite: $overwrite)
}
mutation

addFavoriteFolder

Bookmark a folder for quick access. Returns the updated list of all bookmarked folders.

bash
mutation AddFavoriteFolder($rootPath: String!, $fullPath: String!) {
  addFavoriteFolder(rootPath: $rootPath, fullPath: $fullPath) {
    rootPath fullPath alias
  }
}
mutation

removeFavoriteFolder

Remove a bookmarked folder. Returns the updated list of remaining folders.

bash
mutation RemoveFavoriteFolder($fullPath: String!) {
  removeFavoriteFolder(fullPath: $fullPath) {
    rootPath fullPath alias
  }
}
mutation

setFavoriteFolderAlias

Set or update the alias shown for a bookmarked folder. Pass an empty string to clear the alias.

bash
mutation SetFavoriteFolderAlias($fullPath: String!, $alias: String!) {
  setFavoriteFolderAlias(fullPath: $fullPath, alias: $alias) {
    rootPath fullPath alias
  }
}
mutation

deleteChunks

Delete all stored chunks for a chunked upload fileId. Use after a cancelled or failed upload to free up disk space.

bash
mutation DeleteChunks($fileId: String!) {
  deleteChunks(fileId: $fileId)
}
mutation

mergeChunks

Merge previously uploaded chunks into the final file. Pass isAppFile=true to import the result into PlainApp's content-addressable AppFile store (used by chat attachments).

bash
mutation MergeChunks($fileId: String!, $totalChunks: Int!, $path: String!, $replace: Boolean!, $isAppFile: Boolean!) {
  mergeChunks(fileId: $fileId, totalChunks: $totalChunks, path: $path, replace: $replace, isAppFile: $isAppFile)
}