Skip to main content
Neon Postgres Docs
current

Search documentation

Type to search this documentation.

On this pageOverview

List databases

Retrieves a list of databases for the specified branch.

GET /projects/{project_id}/branches/{branch_id}/databases

Retrieves a list of databases for the specified branch. A branch can have multiple databases. For related information, see Manage databases.

Markdown for AI context

REST API - curl
curl "https://console.neon.tech/api/v2/projects/$PROJECT_ID/branches/$BRANCH_ID/databases" \
  -H "Authorization: Bearer $NEON_API_KEY"

Every field below is optional. An empty body works too.

Also available in

Bash
neon connection-string [branch] list

Tool: inspect_database

Reach for this first when asked why a database is slow, large, bloated, or behind. It runs one predefined, read-only Postgres diagnostic against a Neon branch — pick the one that answers the question from the check parameter's list, instead of writing catalog SQL by hand. These are the same checks as the neon inspect db CLI command.

Not for: arbitrary SQL (run_sql), the slowest queries by average execution time with your own threshold and limit (list_slow_queries), the plan of one statement (explain_sql_statement), applying an optimization (prepare_query_tuning), compute and Neon Function logs (query_logs), or listing tables and columns (get_database_tables, describe_table_schema). Several checks read alike and are not: long-running-queries is what is running right now in the inspected database and has been for over five minutes; stalled-queries is a compute-wide snapshot of active queries running longer than 30 seconds with parallel-worker grouping, waits, and blockers; outliers is cumulative execution time since statistics were last reset; and calls is call frequency over that same history. Omit databaseName to run a database-scoped check against every database on the branch. The result adds a database column. stalled-queries, lfc-hit-rate, working-set, and replication-slots are compute-wide: they run once against the first listed database. For lfc-hit-rate and working-set, cache counters reset when the compute restarts. One failing database fails the whole run. bloat is a statistical estimate, not a measurement. When a check needs an extension that is not installed, the tool says so and names the CREATE EXTENSION statement. Installing it writes to the user's database — ask before running it.

  • check (enum, required) Which diagnostic to run:
  • projectId (string, required) The ID of the project to inspect
  • branchId (string, optional) An optional ID of the branch. If not provided the default branch is used.
  • databaseName (string, optional)
  • computeId (string, optional) The ID of the compute/endpoint. If not provided, the read-write compute associated with the branch will be used.
  • limit (number, optional) Maximum number of rows to return from the combined result. Per-database ranking and SQL caps are applied first. The response reports how many rows the check produced and whether they were truncated, so raise this only when truncated is true. A few checks are capped in SQL and say so in their description.

Console path: Projects → Branches → Roles & Databases

Project ID

project_id

string

The Neon project ID

Branch ID

branch_id

string

The branch ID

200

Returned a list of databases of the specified branch

Depth

default

General error

This endpoint can return the standard Neon API error response.

Response fields

  • message Required. Human-readable error message.
  • code Required. Machine-readable error code.
  • request_id Optional. Request identifier for debugging. You can provide one with the X-Request-ID header.

Retry guidance

If no response is returned, the request may still have reached the server. This is why retry safety depends on the method and status code.

Idempotent methods (GET, HEAD, OPTIONS) are generally safe to retry after a network error or timeout. Non-idempotent methods (POST, PATCH, DELETE, PUT) can change state, so avoid automatic retries unless your workflow can tolerate duplicate effects.

Responses with 423 Locked or 503 Service Unavailable are safe to retry. 423 Locked means the resource is temporarily locked, usually because another operation is in progress.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu