# moveFile

```graphql
mutation MoveFile($input: MoveFileInput!) {
  moveFile(input: $input) {
    success
    error
    path
    id
    versionId
    type
    content
    sizeBytes
    checksum
    updatedAt
  }
}
```

Move a file. Requires project.files.write.

## Arguments

| Name                      | Type           | Required | Description                                                                                                                                                                                                                                                              |
| ------------------------- | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `input`                   | MoveFileInput! | Yes      |                                                                                                                                                                                                                                                                          |
| `input.filePath`          | String         |          | The file to move. Send filePath or sourcePath, not two different values.                                                                                                                                                                                                 |
| `input.sourcePath`        | String         |          | Earlier spelling of filePath.                                                                                                                                                                                                                                            |
| `input.destinationPath`   | String!        | Yes      | Destination file path. The source receives a deletion version and the destination receives a new file ID derived from its path; immutable history remains.                                                                                                               |
| `input.expectedVersionId` | String         |          | Optional optimistic-concurrency guard: the move is rejected before any mutation when the source file's current version no longer matches.                                                                                                                                |
| `input.ref`               | String         |          | Canonical 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. |
| `input.branchId`          | String         |          | Legacy alias for ref=branch:<value>. Supplying both is accepted when they name the same content and rejected when they do not.                                                                                                                                           |

## Variables

```json
{
  "input": {
    "destinationPath": "string"
  }
}
```

## Responses

| Status | Description                           |
| ------ | ------------------------------------- |
| 200    | The MoveFilePayload in data.moveFile. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation MoveFile($input: MoveFileInput!) {\n  moveFile(input: $input) {\n    success\n    error\n    path\n    id\n    versionId\n    type\n    content\n    sizeBytes\n    checksum\n    updatedAt\n  }\n}",
  "variables": {
    "input": {
      "destinationPath": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "moveFile": {
      "success": false,
      "error": "string",
      "path": "string",
      "id": "string",
      "versionId": "string",
      "type": "string",
      "content": "string",
      "sizeBytes": 0,
      "checksum": "string",
      "updatedAt": "2026-01-01T00:00:00Z"
    }
  }
}
```
