Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

Create database

POST/v1/projects/{projectId}/databasesCreate database

Creates a new database for the given project.

Parameters

projectIdstringpathrequired

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

Request body

application/json
object
fromDatabaseobject

Deprecated: use `source` instead.

Show child attributes
backupIdstring
idstringrequired

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

isDefaultboolean

default false

namestring

minLength 1

regionstring

Use "inherit" to use the project's default region (falls back to the default database's region for projects without one).

one of "us-east-1", "us-west-1", "eu-west-3", "eu-central-1", "ap-northeast-1", "ap-southeast-1", "inherit" · default "us-east-1"

sourcevalue
Show child attributes
oneOf · 3 options
Option 1object
typestringrequired

const "empty"

Option 2object
backupIdstringrequired

ID of the backup to restore from

databaseIdstringrequired

ID of the database the backup belongs to

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

typestringrequired

const "backup"

Option 3object
databaseIdstringrequired

ID of the database to clone from

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

typestringrequired

const "database"

Example request
{
  "fromDatabase": {
    "backupId": "string",
    "id": "string"
  },
  "isDefault": false,
  "name": "string",
  "region": "us-east-1",
  "source": {
    "databaseId": "string",
    "type": "database"
  }
}

Responses

201Created a new database for the project.application/json
object
dataobjectrequired
Show child attributes
apiKeysarray of objectrequired

Deprecated: use `connections[]` instead.

Show child attributes
Show array items
connectionStringstringrequired

Deprecated: use `endpoints.direct.connectionString` or `endpoints.pooled.connectionString` instead.

createdAtstring · date-timerequired
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
branchIdnull | stringrequired
connectionStringnull | stringrequired

Deprecated: use `connections[].endpoints.direct.connectionString` or `connections[].endpoints.pooled.connectionString`.

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
connectionStringstring
hoststringrequired
portnumberrequired
directobject
Show child attributes
connectionStringstring
hoststringrequired
portnumberrequired
pooledobject
Show child attributes
connectionStringstring
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]+)$

directConnectionnull | objectrequired

Deprecated: use `connections[].endpoints.direct` instead.

Show child attributes
hoststringrequired
passstringrequired
userstringrequired
idstringrequired
isDefaultbooleanrequired
logicalIdnull | stringrequired
namestringrequired
projectobjectrequired
Show child attributes
idstringrequired
namestringrequired
urlstring · urirequired
regionobjectrequired
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 "provisioning", "ready"

typestringrequired

const "database"

urlstring · urirequired
Example response
{
  "data": {
    "apiKeys": [
      {
        "connectionString": "string",
        "createdAt": "2026-06-09T00:00:00Z",
        "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"
      }
    ],
    "branchId": "string",
    "connectionString": "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": {
            "connectionString": "string",
            "host": "string",
            "port": 0
          },
          "direct": {
            "connectionString": "string",
            "host": "string",
            "port": 0
          },
          "pooled": {
            "connectionString": "string",
            "host": "string",
            "port": 0
          }
        },
        "id": "string",
        "kind": "accelerate",
        "name": "string",
        "type": "connection",
        "url": "https://example.com"
      }
    ],
    "createdAt": "2026-06-09T00:00:00Z",
    "defaultConnectionId": "string",
    "directConnection": {
      "host": "string",
      "pass": "string",
      "user": "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": "provisioning",
    "type": "database",
    "url": "https://example.com"
  }
}
400The request is invalid due to missing or invalid parameters.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
401Missing or invalid authorization token.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
403The actor or agent permission policy does not allow database creation.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
404Project 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"
  }
}
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