/projects/{project_id}/branches/{branch_id}/databasesCreate databaseCreates a database in the specified branch. A branch can have multiple databases. For related information, see Manage databases.
Parameters
project_idstringpathrequiredThe Neon project ID
branch_idstringpathrequiredThe branch ID
Request body
requiredapplication/json
databaseobjectrequiredConfiguration for the new Postgres database.
Show child attributes
namestringrequiredName of the database to create.
owner_namestringrequiredThe name of the role that owns the database
{
"database": {
"name": "mydb",
"owner_name": "casey"
}
}Responses
allOf · 2 options
databaseobjectrequiredShow child attributes
branch_idstringrequiredThe ID of the branch this database belongs to.
created_atstring · date-timerequiredA timestamp indicating when the database was created
idinteger · int64requiredThe database ID
namestringrequiredThe database name
owner_namestringrequiredThe name of role that owns the database
updated_atstring · date-timerequiredA timestamp indicating when the database was last updated
operationsarray of objectrequiredShow child attributes
Show array items
An asynchronous action Neon performs on your resources (for example, starting a compute or creating a branch). Fields such as `action`, `status`, and `total_duration_ms` describe the operation and its progress.
actionstringrequiredThe action performed by the operation
branch_idstringThe ID of the branch this operation ran on.
created_atstring · date-timerequiredA timestamp indicating when the operation was created
endpoint_idstringThe ID of the compute endpoint this operation ran on.
errorstringHuman-readable message describing why the operation failed.
failures_countinteger · int32requiredThe number of times the operation failed
idstring · uuidrequiredThe operation ID
project_idstringrequiredThe ID of the project this operation ran on.
retry_atstring · date-timeA timestamp indicating when the operation was last retried
statusstringrequiredLifecycle state of the operation. `scheduling`: queued, not yet started. `running`: actively executing. `finished`: completed successfully. `failed`: ended with a failure. `error`: ended with a terminal error. `cancelling`: cancellation requested but not yet complete. `cancelled`: stopped before completion. `skipped`: bypassed without executing.
total_duration_msinteger · int32requiredThe total duration of the operation in milliseconds
updated_atstring · date-timerequiredA timestamp indicating when the operation status was last updated
{
"database": {
"branch_id": "br-aged-salad-637688",
"created_at": "2022-12-04T00:15:04Z",
"id": 876692,
"name": "mydb",
"owner_name": "casey",
"updated_at": "2022-12-04T00:15:04Z"
},
"operations": [
{
"action": "apply_config",
"branch_id": "br-aged-salad-637688",
"created_at": "2022-12-04T00:15:04Z",
"endpoint_id": "ep-little-smoke-851426",
"failures_count": 0,
"id": "39426015-db00-40fa-85c5-1c7072df46d0",
"project_id": "shiny-wind-028834",
"status": "running",
"total_duration_ms": 100,
"updated_at": "2022-12-04T00:15:04Z"
},
{
"action": "suspend_compute",
"branch_id": "br-aged-salad-637688",
"created_at": "2022-12-04T00:15:04Z",
"endpoint_id": "ep-little-smoke-851426",
"failures_count": 0,
"id": "b7483d4e-33da-4d40-b319-ac858d4d3e69",
"project_id": "shiny-wind-028834",
"status": "scheduling",
"total_duration_ms": 100,
"updated_at": "2022-12-04T00:15:04Z"
}
]
}codestringrequiredmessagestringrequiredError message
request_idstringUnique identifier for the request, useful for debugging. You can set this value manually by including an `X-Request-ID` header in the request. If not provided, the value will be generated automatically.
{
"code": "",
"message": "string",
"request_id": "string"
}