---
title: "Rename repository"
method: POST
path: "/repos/{repo_id}/rename"
tags: ["Repository Manipulation"]
---

# Rename repository

`POST /repos/{repo_id}/rename`

## Request

- Base URL: `https://api.diversion.dev/v0`
- URL: `https://api.diversion.dev/v0/repos/{repo_id}/rename`
- Auth: OAuth 2
  - Implicit: `https://auth.diversion.dev/oauth2/authorize`
  - Scopes: `coreapi/write`
- TypeScript: <https://skmtc.dev/diversion/apis/diversion-core-api/docs/repos/:repo_id/rename/post.ts> (a function with typed inputs; its response is checked against the schema)

Change the name of a repository

## Request body

- RenameRepoRequest
  - `new_name` string, required: The new name for the repository

## Response `200`

Repository renamed successfully

- Repo
  - `repo_name` string, required
  - `description` string
  - `organization_id` string: The ID of the organization to associate the repo with. If not provided, the system will use the user's organization if they belong to exactly one.
  - `repo_id` string, required
  - `default_branch_id` string
  - `default_branch_name` string
  - `size_bytes` number, float, required
  - `owner_user_id` string, required
  - `created_timestamp` integer, required: Seconds since epoch UTC
  - `sync_git_repo_url` string: Optional URL of the git repository being synced with the repo
  - `sync_git_level` 1 | 2 | 3 | 4: One of: 1 - latest commit of default branch, 2 - default branch with history, 3 - full repo with history, 4 - full repo with history and sync [default]
  - `digest_method` 'sha1' | 'md5': The method used to calculate the digest of BLOBs in the repo.
  - `def_auto_forwarding_enabled` boolean

## Other responses

- `400`: Invalid repository name
- `403`: Only repository owner can rename
- `404`: Repository not found
- `409`: Repository name already exists
- `default`: An error occurred

---

[API](https://skmtc.dev/diversion/apis/diversion-core-api.md) - [All operations](https://skmtc.dev/diversion/apis/diversion-core-api/llms.txt) - [OpenAPI document](https://skmtc.dev/diversion/apis/diversion-core-api/revisions/38a18aba804b?raw)
