---
title: "Set the directory a project builds from"
method: PUT
path: "/projects/{id}/git-connection/root-directory"
tags: ["Projects", "Git Connections"]
---

# Set the directory a project builds from

`PUT /projects/{id}/git-connection/root-directory`

## Request

- Base URL: `https://api.volcano.dev`
- URL: `https://api.volcano.dev/projects/{id}/git-connection/root-directory`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Changes only the root directory, leaving the repository and production
branch alone. Unlike PUT /projects/{id}/git-connection, this accepts a
project access token, so CI or an agent can move a project within its
repository without being able to change the repository.

The directory is a path relative to the repository root. An empty
string, `.` or `/` means the repository root. The response carries it in
the form a deploy reads it: `./apps/web/` comes back as `apps/web`.

## Path parameters

- `id` string, uuid, required

## Request body

- SetProjectGitRootDirectoryRequest
  - `root_directory` string, required: Monorepo subdirectory the project builds from, relative to the repository root. An empty string means the repository root.

## Response `200`

The project's repo connection, with the new root directory

- ProjectGitConnection
  - `repo_installation_id` integer, required
  - `repo_id` integer, required: Stable GitHub repository id (repository.id), the authoritative binding.
  - `repo_full_name` string, required
  - `root_directory` string, required
  - `production_branch` string, required: The branch a push must land on to deploy. Follows the repository's GitHub default branch unless the project set its own, which a default-branch rename on GitHub then leaves alone.
  - `updated_at` string, date-time, required: When the connection last changed: its repository, root directory or production branch. Naming the branch it already uses, and other changes to the project, leave it alone. A connection that has not changed since Volcano began tracking this reports the project's last change before then.

## Other responses

- `400`: Malformed request body, or a root_directory that is absolute or leaves the repository
- `401`: Unauthorized - invalid or missing token
- `403`: Project not owned by the caller
- `404`: Project not found, or it has no repository connected. The root directory is part of the connection, so there is nothing to set it on until one exists.
- `409`: A Git source transition is pending or complete, so the recorded root cannot be changed
- `500`: Failed to set the root directory

## Changes

- **2026-10-26** `4b0676e06128`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kong/apis/volcano-api/changes/projects/:id/git-connection/root-directory/put.md)

---

[API](https://skmtc.dev/kong/apis/volcano-api.md) - [All operations](https://skmtc.dev/kong/apis/volcano-api/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/volcano-api/revisions/84c4488f91e9?raw)
