---
title: "Create database branch"
method: POST
path: "/database/v1/projects/{id}/branches"
tags: ["Database"]
---

# Create database branch

`POST /database/v1/projects/{id}/branches`

Creates a new branch from the specified parent branch (or default 'main' branch). Branches provide instant point-in-time clones of your database for isolated development, staging, testing, or feature work. Perfect for testing schema changes, running migrations safely, or creating ephemeral preview environments.

## Path parameters

- `id` string, required

## Request body

- object
  - `name` string, required — Branch name (letters, numbers, hyphens, underscores only)
  - `parentBranchId` string — Parent branch ID to clone from (defaults to main branch)

## Response `201`

Branch created successfully

- object
  - `id` string, required — Branch ID
  - `name` string, required — Branch name
  - `parentBranchId` string, nullable, required — Parent branch ID
  - `isDefault` boolean, required — Whether this is the default branch (always false for new branches)
  - `status` string, required — Branch status
  - `createdAt` string, date-time, required — Branch creation timestamp

## Other responses

- `400` — Bad request - invalid name format or missing required field
- `401` — Invalid or missing API key
- `404` — Database project or parent branch not found
- `409` — Branch with this name already exists
- `500` — Failed to create branch

---

[API](https://skmtc.net/casemark/apis/case-dev-api.md) · [All operations](https://skmtc.net/casemark/apis/case-dev-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/casemark/case-dev-api/revisions/5b7e64e6d6f9/schema)
