---
title: "Move/Rename file"
method: PATCH
path: "/api/repos/{namespace}/{repo_name}/file/{resource}"
tags: ["Files"]
---

# Move/Rename file

`PATCH /api/repos/{namespace}/{repo_name}/file/{resource}`

## Request

- Base URL: `https://hub.oxen.ai`
- URL: `https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/file/{resource}`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/oxen/apis/oxen-server/docs/api/repos/:namespace/:repo_name/file/:resource/patch.ts> (a function with typed inputs; its response is checked against the schema)

Move or rename a file within the repository and commit the change.

## Path parameters

- `namespace` string, required
- `repo_name` string, required
- `resource` string, required

## Request body

- FileMoveBody: Body for moving/renaming a file
  - `email` string, nullable
  - `message` string, nullable
  - `name` string, nullable
  - `new_path` string, required

## Response `200`

File moved/renamed successfully

- CommitResponse
  - `oxen_version` string, nullable
  - `status` string, required
  - `status_message` string, required
  - `commit` Commit, required
    - `author` string, required
    - `email` string, required
    - `id` string, required
    - `message` string, required
    - `parent_ids` string[], required
    - `timestamp` string, date-time, required

## Other responses

- `400`: Bad Request
- `404`: Branch or file not found
- `409`: new_path already exists, or a file is at a parent of new_path

---

[API](https://skmtc.dev/oxen/apis/oxen-server.md) - [All operations](https://skmtc.dev/oxen/apis/oxen-server/llms.txt) - [OpenAPI document](https://skmtc.dev/oxen/apis/oxen-server/revisions/2ae578129949?raw)
