---
title: "Initialize VCS repository"
method: POST
path: "/api/vcs/init"
tags: ["vcs"]
---

# Initialize VCS repository

`POST /api/vcs/init`

## Request

- Base URL: `https://opencode.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://opencode.ai/api/vcs/init`
- Auth: none required

Initialize a repository using the selected VCS provider in a markerless project's directory and refresh its location services. Omitting provider defaults to git; built-in git and hg providers support initialization. An unknown provider returns 400; a registered provider without init returns 501.

## Query parameters

- `location` object, nullable
  - `directory` string, nullable
- `provider` string, nullable

## Response `204`

<No Content>

## Other responses

- `400`: InvalidRequestError
- `401`: UnauthorizedError
- `404`: LocationNotFoundError
- `409`: ConflictError
- `501`: VcsInitNotSupportedError
- `503`: ServiceUnavailableError

---

[API](https://skmtc.dev/kaaass/apis/opencode.md) - [All operations](https://skmtc.dev/kaaass/apis/opencode/llms.txt) - [OpenAPI document](https://skmtc.dev/kaaass/apis/opencode/revisions/4e083d954707?raw)
