Access the Neon API with managed authentication. Read projects, branches, databases, roles, compute endpoints, and operations, and create, change, and delete them. Deleting a project, branch, database, or role destroys its data, and role passwords and connection strings are credentials. All access runs through the Maton gateway and the maton CLI.
Permissions
Suggested read access
In the Console, Read limits the connection to these 71 read-only endpoints, plus deny rules for any write endpoint a broader rule would otherwise match. Endpoints Maton has found to return credentials, start jobs, or spend credits are left out; a few reads that can change state or return a secret depending on their parameters stay in, and their descriptions say how. It is a suggestion: the saved rules are exactly the ones you see, and you can change them with Custom. See Access policy.
Reference
Account
Get the Current User
maton api '/neon/api/v2/users/me'Response:
{
"id": "1d1f5b2c-6a0e-4a7f-9a3c-2b5d7e8f9a10",
"email": "user@example.com",
"login": "user",
"name": "Sample",
"last_name": "User",
"plan": "free",
"projects_limit": 100,
"branches_limit": 10,
"max_autoscaling_limit": 2,
"auth_accounts": [
{"email": "user@example.com", "login": "user", "name": "Sample User", "provider": "google"}
]
}List Organizations
maton api '/neon/api/v2/users/me/organizations'Response:
{
"organizations": [
{
"id": "org-sample-12345678",
"name": "Example Org",
"handle": "example-org-12345678",
"plan": "free",
"managed_by": "console",
"require_mfa": false,
"created_at": "2026-11-01T10:00:00Z",
"updated_at": "2026-11-01T10:00:00Z"
}
]
}api/v2/organizations/{org_id} returns one organization; organizations/{org_id}/members and organizations/{org_id}/invitations list its people.
List API Keys
maton api '/neon/api/v2/api_keys'Returns the user's personal keys (id, name, created_at, created_by, last_used_at, last_used_from_addr); key values are never returned. api/v2/organizations/{org_id}/api_keys lists an organization's keys.
Projects
List Projects
maton api '/neon/api/v2/projects?org_id={org_id}&limit=10'Query parameters: org_id (required with a personal key for an organization's projects; not needed with an organization key), limit, cursor (from the previous page's pagination.cursor), search (by name or ID).
Response:
{
"projects": [
{
"id": "sample-project-123456",
"name": "my-app",
"region_id": "aws-us-east-2",
"pg_version": 18,
"org_id": "org-sample-12345678",
"proxy_host": "us-east-2.aws.neon.tech",
"active_time": 3600,
"cpu_used_sec": 120,
"created_at": "2026-11-01T10:00:00Z",
"updated_at": "2026-11-30T10:00:00Z"
}
],
"pagination": {"cursor": "sample-project-123456"}
}api/v2/projects/count?org_id={org_id} returns {"count": 1}.
Get a Project
maton api '/neon/api/v2/projects/{project_id}'Returns project with its settings (allowed_ips, block_public_connections, maintenance_window), default_endpoint_settings (autoscaling limits, suspend timeout), history_retention_seconds, and usage counters for the current period.
Create a Project
maton api '/neon/api/v2/projects' -X POST -H 'Content-Type: application/json' --input - <<'JSON'
{"project": {"name": "my-app", "org_id": "{org_id}", "region_id": "aws-us-east-2", "pg_version": 17}}
JSONA new project comes with a default branch, a database, a role, and a compute endpoint, returned with the operations that create them. The response also carries connection_uris with the new role's password: treat it as a secret.
Update or Delete a Project
maton api '/neon/api/v2/projects/{project_id}' -X PATCH -H 'Content-Type: application/json' --input - <<'JSON'
{"project": {"name": "my-app-prod"}}
JSON
maton api '/neon/api/v2/projects/{project_id}' -X DELETEBranches
List Branches
maton api '/neon/api/v2/projects/{project_id}/branches'Response:
{
"branches": [
{
"id": "br-sample-wildflower-a1b2c3d4",
"project_id": "sample-project-123456",
"name": "main",
"current_state": "ready",
"logical_size": 30777344,
"primary": true,
"default": true,
"protected": false,
"created_at": "2026-11-01T10:00:00Z",
"updated_at": "2026-11-30T10:00:00Z"
}
],
"annotations": {},
"pagination": {"sort_by": "updated_at", "sort_order": "desc"}
}branches/{branch_id} returns one branch; branches/count the number of branches.
Create a Branch
maton api '/neon/api/v2/projects/{project_id}/branches' -X POST -H 'Content-Type: application/json' --input - <<'JSON'
{"branch": {"name": "feature-x", "parent_id": "br-sample-wildflower-a1b2c3d4"}, "endpoints": [{"type": "read_write"}]}
JSONA branch is a copy-on-write copy of its parent (the default branch if parent_id is omitted), optionally at a point in time (parent_lsn or parent_timestamp). endpoints adds a compute endpoint so the branch can be queried; without it the branch has no compute.
Rename, Set as Default, or Delete a Branch
maton api '/neon/api/v2/projects/{project_id}/branches/{branch_id}' -X PATCH -H 'Content-Type: application/json' --input - <<'JSON'
{"branch": {"name": "feature-x-renamed"}}
JSON
maton api '/neon/api/v2/projects/{project_id}/branches/{branch_id}/set_as_default' -X POST
maton api '/neon/api/v2/projects/{project_id}/branches/{branch_id}' -X DELETEThe default branch can't be deleted; set another branch as default first.
Restore a Branch
maton api '/neon/api/v2/projects/{project_id}/branches/{branch_id}/restore' -X POST -H 'Content-Type: application/json' --input - <<'JSON'
{"source_branch_id": "{branch_id}", "source_timestamp": "2026-11-30T09:00:00Z", "preserve_under_name": "feature-x-before-restore"}
JSONRestores the branch to its own earlier state (source_branch_id set to the branch itself, with source_timestamp or source_lsn) or to another branch's data. preserve_under_name keeps the current state as a new branch.
Schema
maton api '/neon/api/v2/projects/{project_id}/branches/{branch_id}/schema?db_name=neondb'
maton api '/neon/api/v2/projects/{project_id}/branches/{branch_id}/compare_schema?db_name=neondb&base_branch_id={base_branch_id}'schema returns a database's schema as SQL (pg_dump style); compare_schema returns a diff against another branch (the parent by default).
Databases
maton api '/neon/api/v2/projects/{project_id}/branches/{branch_id}/databases'
maton api '/neon/api/v2/projects/{project_id}/branches/{branch_id}/databases/{database_name}'Response:
{
"databases": [
{
"id": 1234567,
"branch_id": "br-sample-wildflower-a1b2c3d4",
"name": "neondb",
"owner_name": "neondb_owner",
"created_at": "2026-11-01T10:00:00Z",
"updated_at": "2026-11-01T10:00:00Z"
}
]
}Create with POST databases and {"database": {"name": "analytics", "owner_name": "neondb_owner"}}; rename or change the owner with PATCH databases/{database_name}; drop with DELETE databases/{database_name}.
Roles
maton api '/neon/api/v2/projects/{project_id}/branches/{branch_id}/roles'
maton api '/neon/api/v2/projects/{project_id}/branches/{branch_id}/roles/{role_name}'Response:
{
"roles": [
{
"branch_id": "br-sample-wildflower-a1b2c3d4",
"name": "neondb_owner",
"protected": false,
"authentication_method": "password",
"created_at": "2026-11-01T10:00:00Z",
"updated_at": "2026-11-01T10:00:00Z"
}
]
}Create with POST roles and {"role": {"name": "reporting"}} (the response includes the new role's password, a secret); delete with DELETE roles/{role_name}. roles/{role_name}/reveal_password and roles/{role_name}/reset_password return a password and are kept out of the read-only policy.
Compute Endpoints
List Endpoints
maton api '/neon/api/v2/projects/{project_id}/endpoints'Response:
{
"endpoints": [
{
"id": "ep-sample-dew-a1b2c3d4",
"host": "ep-sample-dew-a1b2c3d4.c-8.us-east-2.aws.neon.tech",
"project_id": "sample-project-123456",
"branch_id": "br-sample-wildflower-a1b2c3d4",
"type": "read_write",
"current_state": "idle",
"autoscaling_limit_min_cu": 0.25,
"autoscaling_limit_max_cu": 2,
"suspend_timeout_seconds": 0,
"pooler_enabled": false,
"pooler_mode": "transaction",
"region_id": "aws-us-east-2",
"last_active": "2026-11-30T09:55:00Z",
"suspended_at": "2026-11-30T10:00:00Z"
}
]
}endpoints/{endpoint_id} returns one endpoint; branches/{branch_id}/endpoints those on a branch.
Start, Suspend, or Restart an Endpoint
maton api '/neon/api/v2/projects/{project_id}/endpoints/{endpoint_id}/start' -X POST
maton api '/neon/api/v2/projects/{project_id}/endpoints/{endpoint_id}/suspend' -X POST
maton api '/neon/api/v2/projects/{project_id}/endpoints/{endpoint_id}/restart' -X POSTCreate an endpoint with POST endpoints and {"endpoint": {"branch_id": "{branch_id}", "type": "read_only"}}; change its autoscaling limits or pooling with PATCH endpoints/{endpoint_id}; remove it with DELETE endpoints/{endpoint_id}.
Operations
maton api '/neon/api/v2/projects/{project_id}/operations?limit=10'
maton api '/neon/api/v2/projects/{project_id}/operations/{operation_id}'Response:
{
"operations": [
{
"id": "a07f8772-1877-4da9-a939-3a3ae62d1d8d",
"project_id": "sample-project-123456",
"branch_id": "br-sample-wildflower-a1b2c3d4",
"action": "create_branch",
"status": "finished",
"failures_count": 0,
"total_duration_ms": 1234,
"created_at": "2026-11-30T10:00:00Z",
"updated_at": "2026-11-30T10:00:01Z"
}
],
"pagination": {"cursor": "2026-11-30T10:00:00Z"}
}status moves through scheduling, running, and finished (or failed, error, cancelled, skipped).
Snapshots and Backups
maton api '/neon/api/v2/projects/{project_id}/snapshots'
maton api '/neon/api/v2/projects/{project_id}/branches/{branch_id}/backup_schedule'Snapshots are created with POST branches/{branch_id}/snapshot and restored with POST snapshots/{snapshot_id}/restore, which replaces the target branch's data.
Usage and Regions
maton api '/neon/api/v2/consumption_history/v2/projects?org_id={org_id}&from=2026-11-01T00:00:00Z&to=2026-12-01T00:00:00Z&granularity=daily&metrics=compute_unit_seconds,root_branch_bytes_month'
maton api '/neon/api/v2/regions'Consumption history needs from, to, granularity (hourly, daily, monthly), org_id, and metrics (such as compute_unit_seconds, root_branch_bytes_month, public_network_transfer_bytes), and is available on Launch plans and above; other plans answer 403. branches/{branch_id} and projects/{project_id} also report the current period's usage counters.
Neon Auth and Data API
Neon Auth (branches/{branch_id}/auth/...: users, OAuth providers, email settings, domains) and the Neon Data API (branches/{branch_id}/data-api/{database_name}) are configured per branch. Their reads return configuration; enabling, changing, or deleting them are writes.
Pagination
Project and operation lists return pagination.cursor; pass it as cursor with the same limit for the next page. An empty page means the end.
Notes
- Connection. The connection holds a Neon API key of either kind. A personal key, created at https://console.neon.tech/app/settings under Personal API keys → Create new API key, acts as the user across their personal account and every organization they belong to; the connection's metadata names the user (
user_id,email,login) and theirplan. An organization key, created in the organization's Settings → API keys → Create new API key, has admin access to everything in that one organization (a key limited to one project reaches only that project). Neon refuses user endpoints such asusers/meandapi_keysto it with404"not allowed for organization API keys", so the connection's metadata names the organization instead (org_id,org_name,plan). - All paths start with
api/v2/. Most projects belong to an organization: with a personal key, listing or creating projects needs the organization's ID asorg_id, whichapi/v2/users/me/organizationsreturns. An organization key needs noorg_id; its organization is implied. - Changes are asynchronous. Writes return the
operationsthat carry them out. A second change to the same branch or endpoint can answer423 Lockeduntil those finish; pollprojects/{project_id}/operations/{operation_id}untilstatusisfinished, or retry after a few seconds. - IDs carry prefixes: branches
br-, endpointsep-, organizationsorg-. Databases and roles are addressed by name. - Errors are
{"request_id": ..., "code": ..., "message": ...}. A personal key withoutorg_idon an organization's projects answers400"org_id is required"; a plan without the feature answers403; a deleted or wrong key answers401. connection_uri,roles/{role_name}/reveal_password,realtime/secret, and branchcredentialsreturn secrets and are kept out of the read-only access policy. So are the Neon Auth reads that can return them:auth/oauth_providers(client secrets),auth/email_serverandauth/email_provider(the SMTP password), andauth/plugins(both).- Personal keys are revoked at https://console.neon.tech/app/settings and organization keys in the organization's Settings → API keys; revoking the key breaks the connection.