# Move renames or moves a path.


[API catalog](/reference/api/) · [Docker Sandboxes overview](/reference/api/sandboxes/latest/) · [Product manual](https://docs.docker.com/ai/sandboxes-api/) · [OpenAPI specification](/reference/api/sandboxes/api.yaml)

API version: v1


> This API is experimental. Features, interfaces,
> and behavior may change.




`POST /v1/files/move`

Move renames or moves a path. The destination is exact: an existing regular
file is replaced, the source basename is never appended, and a directory
destination is refused unchanged. A source or destination that leaves the jail
through a symlink refuses with FAILED_PRECONDITION and a error reason.

## Connection and access

[API connection and authentication guidance](/reference/api/sandboxes/latest/#authentication)


Server: `{endpoint}`

`endpoint`: The sandbox API base URL from Sandbox.core.endpoint.uri; preserve its path prefix when appending /v1 routes. HTTP endpoints require a scoped endpoint bearer; direct Unix sockets use socket access control.

Effective security: alternatives are OR; schemes within an alternative are AND. An empty array declares no HTTP authentication requirement.

```json
[
  {
    "sandboxBearer": []
  }
]
```

## Example request

Replace placeholders and provide the required credentials or request body.

```console
curl \
  --request POST \
  --header "Authorization: Bearer ${TOKEN}" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data-binary @request-body \
  'https://sandbox.invalid/v1/files/move'
```


Prepare request-body using the selected media type and schema.


## Parameters

## Request and responses

### Request  application/json




Schema:

```json
{
  "$ref": "#/components/schemas/FilesMoveRequest"
}
```










### Response 200 application/json

Success


Schema:

```json
{
  "$ref": "#/components/schemas/FilesMoveResponse"
}
```










### Response 409 application/json

The path resolves through a symlink that does not resolve to a target inside the sandbox jail.

The path names an existing socket, FIFO, device, or other non-regular object where a regular file is required.

`from` names a regular file and `to` an existing directory, which `Move` refuses rather than moving the file into it.

`from` names a directory and `to` an existing path, which `Move` refuses rather than replacing.

`from` and `to` are on different filesystems, and `Move` never copies the contents to cross the boundary.


Schema:

```json
{
  "$ref": "#/components/schemas/Error"
}
```









move_crosses_filesystem:
```json
{
  "code": "failedPrecondition",
  "message": "move_crosses_filesystem: `from` and `to` are on different filesystems, and `Move` never copies the contents to cross the boundary."
}
```

move_destination_is_directory:
```json
{
  "code": "failedPrecondition",
  "message": "move_destination_is_directory: `from` names a regular file and `to` an existing directory, which `Move` refuses rather than moving the file into it."
}
```

move_destination_occupied:
```json
{
  "code": "failedPrecondition",
  "message": "move_destination_occupied: `from` names a directory and `to` an existing path, which `Move` refuses rather than replacing."
}
```

path_authority_nonregular_object:
```json
{
  "code": "failedPrecondition",
  "message": "path_authority_nonregular_object: The path names an existing socket, FIFO, device, or other non-regular object where a regular file is required."
}
```

path_authority_symlink_escape:
```json
{
  "code": "failedPrecondition",
  "message": "path_authority_symlink_escape: The path resolves through a symlink that does not resolve to a target inside the sandbox jail."
}
```


### Response default application/json

The structured Error body identifies the failure with a stable code and optional typed details.


Schema:

```json
{
  "$ref": "#/components/schemas/Error"
}
```









Schema example:
```json
{
  "code": "notFound",
  "details": [],
  "message": "sandbox not found"
}
```


## Complete operation contract

```json
{
  "description": "Move renames or moves a path. The destination is exact: an existing regular\nfile is replaced, the source basename is never appended, and a directory\ndestination is refused unchanged. A source or destination that leaves the jail\nthrough a symlink refuses with FAILED_PRECONDITION and a error reason.",
  "operationId": "move",
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/FilesMoveRequest"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/FilesMoveResponse"
          }
        }
      },
      "description": "Success"
    },
    "409": {
      "content": {
        "application/json": {
          "examples": {
            "move_crosses_filesystem": {
              "summary": "`from` and `to` are on different filesystems, and `Move` never copies the contents to cross the boundary.",
              "value": {
                "code": "failedPrecondition",
                "message": "move_crosses_filesystem: `from` and `to` are on different filesystems, and `Move` never copies the contents to cross the boundary."
              }
            },
            "move_destination_is_directory": {
              "summary": "`from` names a regular file and `to` an existing directory, which `Move` refuses rather than moving the file into it.",
              "value": {
                "code": "failedPrecondition",
                "message": "move_destination_is_directory: `from` names a regular file and `to` an existing directory, which `Move` refuses rather than moving the file into it."
              }
            },
            "move_destination_occupied": {
              "summary": "`from` names a directory and `to` an existing path, which `Move` refuses rather than replacing.",
              "value": {
                "code": "failedPrecondition",
                "message": "move_destination_occupied: `from` names a directory and `to` an existing path, which `Move` refuses rather than replacing."
              }
            },
            "path_authority_nonregular_object": {
              "summary": "The path names an existing socket, FIFO, device, or other non-regular object where a regular file is required.",
              "value": {
                "code": "failedPrecondition",
                "message": "path_authority_nonregular_object: The path names an existing socket, FIFO, device, or other non-regular object where a regular file is required."
              }
            },
            "path_authority_symlink_escape": {
              "summary": "The path resolves through a symlink that does not resolve to a target inside the sandbox jail.",
              "value": {
                "code": "failedPrecondition",
                "message": "path_authority_symlink_escape: The path resolves through a symlink that does not resolve to a target inside the sandbox jail."
              }
            }
          },
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "description": "The path resolves through a symlink that does not resolve to a target inside the sandbox jail.\n\nThe path names an existing socket, FIFO, device, or other non-regular object where a regular file is required.\n\n`from` names a regular file and `to` an existing directory, which `Move` refuses rather than moving the file into it.\n\n`from` names a directory and `to` an existing path, which `Move` refuses rather than replacing.\n\n`from` and `to` are on different filesystems, and `Move` never copies the contents to cross the boundary."
    },
    "default": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "description": "The structured Error body identifies the failure with a stable code and optional typed details."
    }
  },
  "security": [
    {
      "sandboxBearer": []
    }
  ],
  "servers": [
    {
      "url": "{endpoint}",
      "variables": {
        "endpoint": {
          "default": "https://sandbox.invalid",
          "description": "The sandbox API base URL from Sandbox.core.endpoint.uri; preserve its path prefix when appending /v1 routes. HTTP endpoints require a scoped endpoint bearer; direct Unix sockets use socket access control."
        }
      }
    }
  ],
  "summary": "Move renames or moves a path.",
  "tags": [
    "Files"
  ],
  "x-sbx-authenticated-only": false,
  "x-sbx-conditional-permissions": [],
  "x-sbx-error-responses": [
    {
      "code": "FAILED_PRECONDITION",
      "description": "The path resolves through a symlink that does not resolve to a target inside the sandbox jail.",
      "reason": "path_authority_symlink_escape"
    },
    {
      "code": "FAILED_PRECONDITION",
      "description": "The path names an existing socket, FIFO, device, or other non-regular object where a regular file is required.",
      "reason": "path_authority_nonregular_object"
    },
    {
      "code": "FAILED_PRECONDITION",
      "description": "`from` names a regular file and `to` an existing directory, which `Move` refuses rather than moving the file into it.",
      "reason": "move_destination_is_directory"
    },
    {
      "code": "FAILED_PRECONDITION",
      "description": "`from` names a directory and `to` an existing path, which `Move` refuses rather than replacing.",
      "reason": "move_destination_occupied"
    },
    {
      "code": "FAILED_PRECONDITION",
      "description": "`from` and `to` are on different filesystems, and `Move` never copies the contents to cross the boundary.",
      "reason": "move_crosses_filesystem"
    }
  ],
  "x-sbx-plane": "data",
  "x-sbx-required-permissions": [
    "sandboxesFilesWrite"
  ],
  "x-sbx-serving-surface": "sandboxEndpoint"
}
```

## Referenced schemas

- [#/components/schemas/Error](/reference/api/sandboxes/latest/schemas/Error/)

- [#/components/schemas/FilesMoveRequest](/reference/api/sandboxes/latest/schemas/FilesMoveRequest/)

- [#/components/schemas/FilesMoveResponse](/reference/api/sandboxes/latest/schemas/FilesMoveResponse/)




