Skip to main content

Create a database

POST /projects/:projectid/databases

Provision a new Postgres database.

Provisions real infrastructure, which is billable from the moment it exists. Requires the provision permission, which no key holds unless you grant it explicitly.

Authentication

  • Project API key: The credential for everything external. Created in Project Settings, bound to one project, and limited to the scopes it was granted. Format: proj.<keyId>.<secret>.
  • Required permission: databases.admin on all databases.

Path parameters

NameTypeRequiredDefaultDescription
projectidstringYes-The project id.

Request body

Content type: application/json

NameTypeRequiredDefaultDescription
namestringYes-A display name for the database.

Example

{
"name": "analytics"
}

Example request

curl -X POST \
-H "Authorization: proj.KEY_ID.SECRET" \
-H "Content-Type: application/json" \
-d '{"name":"analytics"}' \
{{BASE_URL}}/projects/{{PROJECT_ID}}/databases

Responses

201

Provisioned.

{
"dbid": "db_4hT2"
}

403

The key lacks the provision permission.