Report: Production databases using Neon Autoscaling consume 2.4x less compute than the same workload on a non-autoscaling platform.
/API, CLI & SDKs/Neon API

Neon API

Copy this prompt into your AI coding assistant (Cursor, Copilot, etc.) to get help creating your first API key and making your first successful API call — using curl, the TypeScript SDK, or the Python SDK.

The Neon API allows you to manage your Neon projects programmatically. You can create and manage projects, branches, databases, roles, compute endpoints, and more — everything you can do in the Neon Console, you can do with the API.

Getting started

Prerequisites

Before using the Neon API, you need:

  1. A Neon accountSign up if you don't have one
  2. An API key — Create one in the Neon Console (see below)
  3. curl or an HTTP client — Or use our TypeScript or Python SDKs

API key types

Neon supports three types of API keys, each with different scopes:

Key TypeScopeBest For
Personal API KeyAll projects you own or have access toPersonal development, scripts
Organization API KeyAll projects within an organizationTeam automation, CI/CD
Project-scoped API KeySingle project onlyLimited access integrations

Create your first API key in the Neon Console under Account settings > API keys. For detailed instructions, see Manage API keys.

important

API key tokens are shown only once at creation. Store them securely — you cannot retrieve them later.

Base URL

All API requests use this base URL:

https://console.neon.tech/api/v2/

Authentication

Include your API key in the Authorization header using Bearer authentication:

curl 'https://console.neon.tech/api/v2/projects' \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer $NEON_API_KEY"

Make your first API call

Set your API key as an environment variable, then list your projects:

# Set your API key
export NEON_API_KEY="your-api-key-here"

# List all projects
curl 'https://console.neon.tech/api/v2/projects' \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer $NEON_API_KEY" | jq

The response includes your projects with their IDs, regions, and other details:

{
  "projects": [
    {
      "id": "spring-example-302709",
      "name": "my-project",
      "region_id": "aws-us-east-2",
      "pg_version": 17,
      "created_at": "2024-01-15T10:30:00Z"
    }
  ]
}

Use the project_id from the response to make subsequent requests, such as creating a branch:

curl -X POST 'https://console.neon.tech/api/v2/projects/spring-example-302709/branches' \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer $NEON_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"branch": {"name": "dev-branch"}}'

Key concepts

Asynchronous operations

Many Neon API operations (creating branches, starting computes, etc.) are asynchronous. The API response includes an operations array with status information:

"operations": [
  {
    "id": "22acbb37-209b-4b90-a39c-8460090e1329",
    "action": "create_branch",
    "status": "running"
  }
]

Status values: scheduling, running, finished, failed, cancelling, cancelled, skipped

When building automation, poll the operation status before proceeding with dependent requests:

curl 'https://console.neon.tech/api/v2/projects/{project_id}/operations/{operation_id}' \
  -H "Authorization: Bearer $NEON_API_KEY"

For details, see Poll operation status.

Rate limiting

  • 700 requests per minute (approximately 11 per second)
  • 40 requests per second burst limit per route

Exceeding these limits returns HTTP 429 Too Many Requests. Implement retry logic with exponential backoff in your applications.

Pagination

Some endpoints that return lists support cursor-based pagination. Include limit and cursor parameters:

# First request with limit
curl 'https://console.neon.tech/api/v2/projects?limit=10' ...

# Subsequent request with cursor from previous response
curl 'https://console.neon.tech/api/v2/projects?limit=10&cursor=...' ...

SDKs and tools

Instead of using curl, you can use our official SDKs:

See Neon SDKs for the full list, including community SDKs.

API reference documentation

The interactive Neon API reference provides:

  • Complete endpoint documentation
  • Request/response examples
  • "Try It" feature to execute requests directly
  • Schema definitions for all objects

You can also access the OpenAPI specification directly for code generation or API tooling.

API examples index

The following sections link to API examples and guides throughout the Neon documentation, organized by resource type and use case.

Core resources

Manage the fundamental building blocks of your Neon account.

Usage and billing

Monitor resource consumption and configure usage limits.

Branching workflows

Work with branches programmatically for development, testing, and CI/CD.

Snapshots and backup

Create and manage point-in-time snapshots for backup and versioning.

Data management

Transform and compare data across branches.

Read replicas

Scale read operations with dedicated read-only compute endpoints.

Security and compliance

Configure security features and compliance settings.

Need help?

Join our Discord Server to ask questions or see what others are doing with Neon. For paid plan support options, see Support.

Last updated on

Was this page helpful?