Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

Update database

PATCH/v1/databases/{databaseId}Update database

Updates the database with the given ID. logicalId cannot be combined with branchId or branchGitName in one request; move the database first, then set its logicalId.

Parameters

databaseIdstringpathrequired

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

Request body

application/json
object
branchGitNamenull | string

Git name of the Branch to move the database to; the Branch is created when it does not exist. Mutually exclusive with branchId. Every database belongs to a Branch, so null (detach) is rejected.

minLength 1

branchIdnull | string

ID of the Branch to move the database to. Every database belongs to a Branch, so null (detach) is rejected.

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

logicalIdstring

Declared identity of the resource, unique within its branch. Set by the tool that declares the resource.

maxLength 255 · pattern ^[A-Za-z0-9][A-Za-z0-9._-]*$

namestring

New display name for the database

minLength 1

Example request
{
  "branchGitName": "string",
  "branchId": "string",
  "logicalId": "string",
  "name": "string"
}

Responses

200Updated the database.application/json
object
dataobjectrequired
Show child attributes
branchIdnull | stringrequired
connectionsarray of objectrequired
Show child attributes
Show array items
createdAtstring · date-timerequired
databaseobjectrequired
Show child attributes
idstringrequired
namestringrequired
urlstring · urirequired
directConnectionnull | object

Deprecated: use `endpoints.direct` instead.

Show child attributes
hoststringrequired
passstringrequired
userstringrequired
endpointsobjectrequired
Show child attributes
accelerateobject
Show child attributes
hoststringrequired
portnumberrequired
directobject
Show child attributes
hoststringrequired
portnumberrequired
pooledobject
Show child attributes
hoststringrequired
portnumberrequired
idstringrequired

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

kindstringrequired

one of "postgres", "accelerate"

namestringrequired
typestringrequired

const "connection"

urlstring · urirequired
createdAtstring · date-timerequired
defaultConnectionIdnull | stringrequired

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

idstringrequired
isDefaultbooleanrequired
logicalIdnull | stringrequired
namestringrequired
projectobjectrequired
Show child attributes
idstringrequired
namestringrequired
urlstring · urirequired
regionnull | objectrequired
Show child attributes
idstringrequired
namestringrequired
sourcevaluerequired
Show child attributes
oneOf · 4 options
Option 1object
typestringrequired

const "empty"

Option 2object
backupIdstringrequired

ID of the backup to restore from

databaseIdstringrequired
typestringrequired

const "backup"

Option 3object
databaseIdstringrequired
typestringrequired

const "database"

Option 4nullnullable
statusstringrequired

one of "failure", "provisioning", "ready", "recovering"

typestringrequired

const "database"

urlstring · urirequired
Example response
{
  "data": {
    "branchId": "string",
    "connections": [
      {
        "createdAt": "2026-06-09T00:00:00Z",
        "database": {
          "id": "string",
          "name": "string",
          "url": "https://example.com"
        },
        "directConnection": {
          "host": "string",
          "pass": "string",
          "user": "string"
        },
        "endpoints": {
          "accelerate": {
            "host": "string",
            "port": 0
          },
          "direct": {
            "host": "string",
            "port": 0
          },
          "pooled": {
            "host": "string",
            "port": 0
          }
        },
        "id": "string",
        "kind": "accelerate",
        "name": "string",
        "type": "connection",
        "url": "https://example.com"
      }
    ],
    "createdAt": "2026-06-09T00:00:00Z",
    "defaultConnectionId": "string",
    "id": "string",
    "isDefault": true,
    "logicalId": "string",
    "name": "string",
    "project": {
      "id": "string",
      "name": "string",
      "url": "https://example.com"
    },
    "region": {
      "id": "string",
      "name": "string"
    },
    "source": {
      "backupId": "string",
      "databaseId": "string",
      "type": "backup"
    },
    "status": "failure",
    "type": "database",
    "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"
  }
}
403Actor does not have access to the database.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
404Database with the given ID was not found.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
409A database with the same `logicalId` already exists on the branch.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
413Request body exceeds this endpoint's size cap.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
Documentation menu