Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

Create a branch

POST/v1/projects/{projectId}/branchesCreate a branch

⚠️ Experimental endpoint: this API is in active development and may change at any time without notice. ⚠️

Creates a Branch under the specified Project. The first Branch in a Project is always created with isDefault=true and role=production regardless of the body value. Later Branches are created with role=preview. Setting isDefault=true while another Branch already holds the default atomically swaps the default flag only.

Parameters

projectIdstringpathrequired

pattern ^(proj_)?([cC][^\s-]{8,}|[a-z0-9]+)$

Request body

application/json
object
gitNamestringrequired

minLength 1

isDefaultboolean
Example request
{
  "gitName": "string",
  "isDefault": true
}

Responses

201Created the Branch.application/json
object
dataobjectrequired
Show child attributes
createdAtstring · date-timerequired
gitNamestringrequired
idstringrequired

pattern ^(br_)([cC][^\s-]{8,}|[a-z0-9]+)$

isDefaultbooleanrequired
projectobjectrequired

Thin reference to the parent Project. Member resources are intentionally NOT inlined — list /v1/databases?branchId=<br_xxx> or /v1/apps?branchId=<br_xxx> instead (see API design principles "Flat and Hierarchical Coexistence").

Show child attributes
idstringrequired
namestringrequired
urlstring · urirequired
rolestringrequired

one of "production", "preview"

typestringrequired

const "branch"

updatedAtstring · date-timerequired
urlstring · urirequired
Example response
{
  "data": {
    "createdAt": "2026-06-09T00:00:00Z",
    "gitName": "string",
    "id": "string",
    "isDefault": true,
    "project": {
      "id": "string",
      "name": "string",
      "url": "https://example.com"
    },
    "role": "preview",
    "type": "branch",
    "updatedAt": "2026-06-09T00:00:00Z",
    "url": "https://example.com"
  }
}
401Missing or invalid authorization token.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
404Project not found.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
409A live Branch with the same gitName already exists.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
422Invalid gitName.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
Documentation menu