Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

Update a branch

PATCH/v1/branches/{branchId}Update a branch

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

Promotes a Branch to be the Project's default. Only isDefault is mutable — gitName rename and role changes are rejected.

Parameters

branchIdstringpathrequired

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

Request body

application/json
object
isDefaultboolean | null
Example request
{
  "isDefault": true
}

Responses

200Branch updated.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"
  }
}
404Branch not found.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
422gitName rename, role change, demote-default, or unknown field rejected.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
Documentation menu