Neon API Reference
Base URL: https://console.neon.tech/api/v2
Auth: Authorization: Bearer $NEON_API_KEY
Interface-specific indexes:
- API endpoint index: all endpoints grouped by resource, each with curl and SDK examples
- Neon CLI: Neon CLI commands, options, and usage
- OpenAPI spec: machine-readable schemas for request/response validation and codegen
AI Gateway
Section titled “AI Gateway”- Get branch AI Gateway endpoint
GET /projects/{project_id}/branches/{branch_id}/ai_gateway
API Keys
Section titled “API Keys”- Create API key
POST /api_keys - List API keys
GET /api_keys - Revoke API key
DELETE /api_keys/{key_id}
Authentication
Section titled “Authentication”- Add an OAuth provider
POST /projects/{project_id}/branches/{branch_id}/auth/oauth_providers - Add domain to redirect_uri whitelist
POST /projects/{project_id}/branches/{branch_id}/auth/domains - Create new auth user
POST /projects/{project_id}/branches/{branch_id}/auth/users - Delete auth user
DELETE /projects/{project_id}/branches/{branch_id}/auth/users/{auth_user_id} - Delete domain from redirect_uri whitelist
DELETE /projects/{project_id}/branches/{branch_id}/auth/domains - Delete OAuth provider
DELETE /projects/{project_id}/branches/{branch_id}/auth/oauth_providers/{oauth_provider_id} - Disable Neon Auth for the branch
DELETE /projects/{project_id}/branches/{branch_id}/auth - Enable Neon Auth for the branch
POST /projects/{project_id}/branches/{branch_id}/auth - List domains in redirect_uri whitelist
GET /projects/{project_id}/branches/{branch_id}/auth/domains - List OAuth providers for the branch
GET /projects/{project_id}/branches/{branch_id}/auth/oauth_providers - Retrieve email and password configuration
GET /projects/{project_id}/branches/{branch_id}/auth/email_and_password - Retrieve email provider configuration
GET /projects/{project_id}/branches/{branch_id}/auth/email_provider - Retrieve localhost allow setting
GET /projects/{project_id}/branches/{branch_id}/auth/allow_localhost - Retrieve Neon Auth details for the branch
GET /projects/{project_id}/branches/{branch_id}/auth - Retrieve Neon Auth plugin configurations
GET /projects/{project_id}/branches/{branch_id}/auth/plugins - Retrieve Neon Auth webhook configuration
GET /projects/{project_id}/branches/{branch_id}/auth/webhooks - Retrieve phone number plugin configuration
GET /projects/{project_id}/branches/{branch_id}/auth/plugins/phone-number - Send test email using the saved email provider
POST /projects/{project_id}/branches/{branch_id}/auth/email_provider/test - Update auth configuration
PATCH /projects/{project_id}/branches/{branch_id}/auth/config - Update auth user role
PUT /projects/{project_id}/branches/{branch_id}/auth/users/{auth_user_id}/role - Update email and password configuration
PATCH /projects/{project_id}/branches/{branch_id}/auth/email_and_password - Update email provider configuration
PATCH /projects/{project_id}/branches/{branch_id}/auth/email_provider - Update localhost allow setting
PATCH /projects/{project_id}/branches/{branch_id}/auth/allow_localhost - Update magic link plugin configuration
PATCH /projects/{project_id}/branches/{branch_id}/auth/plugins/magic-link - Update Neon Auth webhook configuration
PUT /projects/{project_id}/branches/{branch_id}/auth/webhooks - Update OAuth provider
PATCH /projects/{project_id}/branches/{branch_id}/auth/oauth_providers/{oauth_provider_id} - Update organization plugin configuration
PATCH /projects/{project_id}/branches/{branch_id}/auth/plugins/organization - Update phone number plugin configuration
PATCH /projects/{project_id}/branches/{branch_id}/auth/plugins/phone-number - Send test email
POST /projects/{project_id}/branches/{branch_id}/auth/send_test_email
Branches
Section titled “Branches”- Compare database schema
GET /projects/{project_id}/branches/{branch_id}/compare_schema - Create anonymized branch
POST /projects/{project_id}/branch_anonymized - Create branch
POST /projects/{project_id}/branches - Create database
POST /projects/{project_id}/branches/{branch_id}/databases - Create role
POST /projects/{project_id}/branches/{branch_id}/roles - Delete branch
DELETE /projects/{project_id}/branches/{branch_id} - Delete database
DELETE /projects/{project_id}/branches/{branch_id}/databases/{database_name} - Delete role
DELETE /projects/{project_id}/branches/{branch_id}/roles/{role_name} - Finalize branch restore from snapshot
POST /projects/{project_id}/branches/{branch_id}/finalize_restore - List branch endpoints
GET /projects/{project_id}/branches/{branch_id}/endpoints - List branches
GET /projects/{project_id}/branches - List databases
GET /projects/{project_id}/branches/{branch_id}/databases - List roles
GET /projects/{project_id}/branches/{branch_id}/roles - Reset role password
POST /projects/{project_id}/branches/{branch_id}/roles/{role_name}/reset_password - Restore branch to a historical state
POST /projects/{project_id}/branches/{branch_id}/restore - Retrieve anonymized branch status
GET /projects/{project_id}/branches/{branch_id}/anonymized_status - Retrieve branch details
GET /projects/{project_id}/branches/{branch_id} - Retrieve database details
GET /projects/{project_id}/branches/{branch_id}/databases/{database_name} - Retrieve database schema
GET /projects/{project_id}/branches/{branch_id}/schema - Retrieve masking rules
GET /projects/{project_id}/branches/{branch_id}/masking_rules - Retrieve number of branches
GET /projects/{project_id}/branches/count - Retrieve role details
GET /projects/{project_id}/branches/{branch_id}/roles/{role_name} - Retrieve role password
GET /projects/{project_id}/branches/{branch_id}/roles/{role_name}/reveal_password - Set branch as default
POST /projects/{project_id}/branches/{branch_id}/set_as_default - Start anonymization
POST /projects/{project_id}/branches/{branch_id}/anonymize - Update branch
PATCH /projects/{project_id}/branches/{branch_id} - Update database
PATCH /projects/{project_id}/branches/{branch_id}/databases/{database_name} - Update masking rules
PATCH /projects/{project_id}/branches/{branch_id}/masking_rules
Buckets
Section titled “Buckets”- Create a bucket on the branch
POST /projects/{project_id}/branches/{branch_id}/buckets - Delete a bucket on the branch
DELETE /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name} - Delete an object in a bucket
DELETE /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects/{object_key} - Delete every object under a key prefix (folder) in a bucket
DELETE /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects-by-prefix - Download an object's bytes
GET /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects/{object_key}/download - List buckets on the branch
GET /projects/{project_id}/branches/{branch_id}/buckets - List objects in a bucket
GET /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects - Presign an upload or download for an object in a bucket
POST /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects/{object_key}/presign
Consumption
Section titled “Consumption”- Retrieve branch consumption metrics
GET /consumption_history/v2/branches - Retrieve project consumption metrics
GET /consumption_history/v2/projects - Retrieve project consumption metrics (legacy plans)
GET /consumption_history/projects
Credentials
Section titled “Credentials”- Issue a scoped credential on the branch
POST /projects/{project_id}/branches/{branch_id}/credentials - List credentials on the branch
GET /projects/{project_id}/branches/{branch_id}/credentials - Reveal a credential's secrets
POST /projects/{project_id}/branches/{branch_id}/credentials/{token_id}/reveal - Revoke a credential
DELETE /projects/{project_id}/branches/{branch_id}/credentials/{token_id} - Rotate a credential's secrets
POST /projects/{project_id}/branches/{branch_id}/credentials/{token_id}/rotate
Data API
Section titled “Data API”- Create Neon Data API
POST /projects/{project_id}/branches/{branch_id}/data-api/{database_name} - Delete Neon Data API
DELETE /projects/{project_id}/branches/{branch_id}/data-api/{database_name} - Get advisor issues
GET /projects/{project_id}/advisors - Retrieve Neon Data API configuration
GET /projects/{project_id}/branches/{branch_id}/data-api/{database_name} - Update Neon Data API
PATCH /projects/{project_id}/branches/{branch_id}/data-api/{database_name}
Endpoints
Section titled “Endpoints”- Create compute endpoint
POST /projects/{project_id}/endpoints - Delete compute endpoint
DELETE /projects/{project_id}/endpoints/{endpoint_id} - List compute endpoints
GET /projects/{project_id}/endpoints - Restart compute endpoint
POST /projects/{project_id}/endpoints/{endpoint_id}/restart - Retrieve compute endpoint details
GET /projects/{project_id}/endpoints/{endpoint_id} - Start compute endpoint
POST /projects/{project_id}/endpoints/{endpoint_id}/start - Suspend compute endpoint
POST /projects/{project_id}/endpoints/{endpoint_id}/suspend - Update compute endpoint
PATCH /projects/{project_id}/endpoints/{endpoint_id}
Functions
Section titled “Functions”- Create a trigger
POST /projects/{project_id}/branches/{branch_id}/triggers - Delete a custom domain from a branch
DELETE /projects/{project_id}/branches/{branch_id}/custom-domains/{domain} - Delete a function on the branch
DELETE /projects/{project_id}/branches/{branch_id}/functions/{slug} - Delete a trigger
DELETE /projects/{project_id}/branches/{branch_id}/triggers/{trigger_id} - Deploy code to a function
POST /projects/{project_id}/branches/{branch_id}/functions/{slug}/deployments - Get a trigger
GET /projects/{project_id}/branches/{branch_id}/triggers/{trigger_id} - Get function details
GET /projects/{project_id}/branches/{branch_id}/functions/{slug} - List functions on the branch
GET /projects/{project_id}/branches/{branch_id}/functions - List the custom domains on a branch
GET /projects/{project_id}/branches/{branch_id}/custom-domains - List triggers on the branch
GET /projects/{project_id}/branches/{branch_id}/triggers - Register a custom domain on a branch
POST /projects/{project_id}/branches/{branch_id}/custom-domains - Update a function
PATCH /projects/{project_id}/branches/{branch_id}/functions/{slug} - Update a trigger
PATCH /projects/{project_id}/branches/{branch_id}/triggers/{trigger_id}
- List branch log field values
GET /projects/{project_id}/branches/{branch_id}/logs/fields/{field_name}/values - List branch log fields
GET /projects/{project_id}/branches/{branch_id}/logs/fields - Query branch logs
POST /projects/{project_id}/branches/{branch_id}/logs/query
Operations
Section titled “Operations”- List operations
GET /projects/{project_id}/operations - Retrieve operation details
GET /projects/{project_id}/operations/{operation_id}
Organizations
Section titled “Organizations”- Assign or update VPC endpoint
POST /organizations/{org_id}/vpc/region/{region_id}/vpc_endpoints/{vpc_endpoint_id} - Create organization API key
POST /organizations/{org_id}/api_keys - Create organization invitations
POST /organizations/{org_id}/invitations - Delete VPC endpoint
DELETE /organizations/{org_id}/vpc/region/{region_id}/vpc_endpoints/{vpc_endpoint_id} - List organization API keys
GET /organizations/{org_id}/api_keys - List organization invitations
GET /organizations/{org_id}/invitations - List organization members
GET /organizations/{org_id}/members - List VPC endpoints
GET /organizations/{org_id}/vpc/region/{region_id}/vpc_endpoints - List VPC endpoints across all regions
GET /organizations/{org_id}/vpc/vpc_endpoints - Remove organization member
DELETE /organizations/{org_id}/members/{member_id} - Remove organization spending limit
DELETE /organizations/{org_id}/billing/spending_limit - Retrieve organization details
GET /organizations/{org_id} - Retrieve organization member details
GET /organizations/{org_id}/members/{member_id} - Retrieve organization spending limit
GET /organizations/{org_id}/billing/spending_limit - Retrieve VPC endpoint details
GET /organizations/{org_id}/vpc/region/{region_id}/vpc_endpoints/{vpc_endpoint_id} - Revoke organization API key
DELETE /organizations/{org_id}/api_keys/{key_id} - Set organization spending limit
PUT /organizations/{org_id}/billing/spending_limit - Transfer projects between organizations
POST /organizations/{source_org_id}/projects/transfer - Update role for organization member
PATCH /organizations/{org_id}/members/{member_id}
Projects
Section titled “Projects”- Accept a project transfer request
PUT /projects/{project_id}/transfer_requests/{request_id} - Add JWKS URL
POST /projects/{project_id}/jwks - Create a project transfer request
POST /projects/{project_id}/transfer_requests - Create project
POST /projects - Delete JWKS URL
DELETE /projects/{project_id}/jwks/{jwks_id} - Delete project
DELETE /projects/{project_id} - Delete VPC endpoint restriction
DELETE /projects/{project_id}/vpc_endpoints/{vpc_endpoint_id} - Grant project access
POST /projects/{project_id}/permissions - List available shared preload libraries
GET /projects/{project_id}/available_preload_libraries - List JWKS URLs
GET /projects/{project_id}/jwks - List org members and their project roles
GET /projects/{project_id}/members - List project access
GET /projects/{project_id}/permissions - List projects
GET /projects - List shared projects
GET /projects/shared - List VPC endpoint restrictions
GET /projects/{project_id}/vpc_endpoints - Recover a deleted project
POST /projects/{project_id}/recover - Remove an org member's role on a project
DELETE /projects/{project_id}/members/{member_id}/role - Retrieve connection URI
GET /projects/{project_id}/connection_uri - Retrieve project details
GET /projects/{project_id} - Revoke project access
DELETE /projects/{project_id}/permissions/{permission_id} - Set an org member's role on a project
PUT /projects/{project_id}/members/{member_id}/role - Set VPC endpoint restriction
POST /projects/{project_id}/vpc_endpoints/{vpc_endpoint_id} - Update project
PATCH /projects/{project_id}
Regions
Section titled “Regions”- List supported regions
GET /regions
Snapshots
Section titled “Snapshots”- Create snapshot
POST /projects/{project_id}/branches/{branch_id}/snapshot - Delete snapshot
DELETE /projects/{project_id}/snapshots/{snapshot_id} - List project snapshots
GET /projects/{project_id}/snapshots - Restore snapshot
POST /projects/{project_id}/snapshots/{snapshot_id}/restore - Retrieve backup schedule
GET /projects/{project_id}/branches/{branch_id}/backup_schedule - Update backup schedule
PUT /projects/{project_id}/branches/{branch_id}/backup_schedule - Update snapshot
PATCH /projects/{project_id}/snapshots/{snapshot_id}
Storage
Section titled “Storage”- Get branch object storage state
GET /projects/{project_id}/branches/{branch_id}/storage
- List organizations for the current user
GET /users/me/organizations - Retrieve current user details
GET /users/me - Retrieve request authentication details
GET /auth - Transfer projects from personal account to organization
POST /users/me/projects/transfer
Legacy Auth
Section titled “Legacy Auth”- Create Auth Provider SDK keys
POST /projects/auth/keys - Transfer Neon-managed auth project to your own account
POST /projects/auth/transfer_ownership - Add an OAuth provider
POST /projects/{project_id}/auth/oauth_providers - Add trusted redirect URI domain
POST /projects/{project_id}/auth/domains - Create Neon Auth integration
POST /projects/auth/create - Create new auth user
POST /projects/auth/user - Delete auth user
DELETE /projects/{project_id}/auth/users/{auth_user_id} - Delete integration with auth provider
DELETE /projects/{project_id}/auth/integration/{auth_provider} - Delete OAuth provider
DELETE /projects/{project_id}/auth/oauth_providers/{oauth_provider_id} - Delete trusted redirect URI domain
DELETE /projects/{project_id}/auth/domains - List active integrations with auth providers
GET /projects/{project_id}/auth/integrations - List OAuth providers
GET /projects/{project_id}/auth/oauth_providers - List trusted redirect URI domains
GET /projects/{project_id}/auth/domains - Retrieve email server configuration
GET /projects/{project_id}/auth/email_server - Update email server configuration
PATCH /projects/{project_id}/auth/email_server - Update OAuth provider
PATCH /projects/{project_id}/auth/oauth_providers/{oauth_provider_id}