Move file

moveFile(input: MoveFileInput!): MoveFilePayload

Requires project.files.write.

Arguments

ArgumentTypeRequired
inputMoveFileInput!Yes

Input fields

input

MoveFileInput

FieldTypeRequiredDescription
filePathStringNoThe file to move. Send filePath or sourcePath, not two different values.
sourcePathStringNoEarlier spelling of filePath.
destinationPathString!YesDestination file path. The source receives a deletion version and the destination receives a new file ID derived from its path; immutable history remains.
expectedVersionIdStringNoOptional optimistic-concurrency guard: the move is rejected before any mutation when the source file's current version no longer matches.
refStringNoCanonical content selector: main, branch:<name-or-id>, release:<version> or env:<name>. An unresolvable reference is rejected; it never falls back to main. A release or environment is read-only, so a write addressed to one is refused rather than applied elsewhere.
branchIdStringNoLegacy alias for ref=branch:<value>. Supplying both is accepted when they name the same content and rejected when they do not.

Response

Returns MoveFilePayload. Open the type for its fields and nested types.

FieldTypeDescription
successBoolean
errorString
pathString
idStringID of the file at its new path; null when the mutation failed.
versionIdStringVersion ID the write produced; null when the mutation failed.
typeStringFile kind: page, function, component or file; null when the mutation failed.
contentStringContent of the file after the mutation; null when the mutation failed.
sizeBytesIntSize of the content encoded as UTF-8, in bytes; null when the mutation failed.

All fields of MoveFilePayload.

Types marked with ! cannot be null. Lists use [Type] notation. The type index lists all published input and response types.

Example

graphql
mutation MoveFile($input: MoveFileInput!) {
  moveFile(input: $input) {
    id
    updatedAt
    checksum
    content
    error
  }
}
json
{
  "input": {
    "filePath": "notes.txt",
    "destinationPath": "archive/notes.txt"
  }
}