neon.databases.create ​
Create a database on a Neon branch
Create a database on a Neon branch (synchronous on the Neon API).
Issues POST /projects/{neon_project_id}/branches/{neon_branch_id}/databases with body {"database": {"name": db_name, "owner_name": owner_name}}.
Inputs:
- neon_project_id: Neon project ID hosting the branch (required).
- neon_branch_id: Neon branch ID to create the database on (required).
- db_name: Name of the database to create (required).
- owner_name: Existing role that will own the database (required).
Outputs (terminal state_data):
- neon_project_id: str — pass-through project ID
- neon_branch_id: str — pass-through branch ID
- db_name: str — confirmed database name
- owner_name: str — confirmed owner role
- provider_metadata: dict — raw Neon response (database + operations)
Idempotency / error policy:
- 4xx → WorkflowNotRetryableError (via _common.raise_for_neon_status).
- 5xx / timeouts → propagate so the engine retries.
- Neon returns operations[] that complete near-instantly; this atomic treats the response as synchronous (no polling). If the first operation is present and not yet "finished", a retryable error is raised so the engine re-runs the transition rather than implementing a polling loop.
Compensation: Use neon.databases.delete to undo. Plugin required: context.get_plugin("neon") must expose .api_token.
Overview ​
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | Base |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
connection_uuid | uuid | No | — | Cloud connection holding the Neon credential |
neon_project_id | string | Yes | — | Neon project ID hosting the branch |
neon_branch_id | string | Yes | — | Neon branch ID to create the database on |
db_name | string | Yes | — | Name of the database to create |
owner_name | string | Yes | — | Existing role that will own the database |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
connection_uuid | uuid | No | — | — |
neon_project_id | string | No | — | — |
neon_branch_id | string | No | — | — |
db_name | string | No | — | — |
owner_name | string | No | — | — |
neon_database_id | string | No | — | Neon's own database id |
neon_operation_id | string | No | — | Id of the create operation; feed to A-22 wait |
provider_metadata | json | No | — | — |
failure_reason | string | No | — | — |
failure_type | string | No | — | — |
failed_action | string | No | — | — |
failed_at_state | string | No | — | — |
failed_step | string | No | — | — |
failed_layer | string | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | execute | — |
completed | No | Yes | Yes | — | — |
failed | No | Yes | No | — | — |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
pending | execute | completed | — |
* (any state) | fail | failed | — |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "neon.databases.create",
"initial_data": {
"neon_project_id": "value",
"neon_branch_id": "value",
"db_name": "value",
"owner_name": "value"
}
}