> This page location: Tools & Workflows > API, CLI & SDKs
> Full Neon documentation index: https://neon.com/docs/llms.txt

# Neon API

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.

## Quick links

- [Neon API Reference](https://api-docs.neon.tech/reference/getting-started-with-neon-api): Interactive API documentation with "Try It" feature
- [OpenAPI Specification](https://neon.com/api_spec/release/v2.json): Machine-readable API spec (OpenAPI 3.0)
- [Neon SDKs](https://neon.com/docs/reference/sdk): TypeScript and Python SDKs for the Neon API

## Getting started

### Prerequisites

Before using the Neon API, you need:

1. **A Neon account**: [Sign up](https://console.neon.tech/signup) 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](https://neon.com/docs/reference/typescript-sdk) or [Python](https://neon.com/docs/reference/python-sdk) SDKs

### API key types

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

| Key Type                   | Scope                                  | Best For                      |
| -------------------------- | -------------------------------------- | ----------------------------- |
| **Personal API Key**       | All projects you own or have access to | Personal development, scripts |
| **Organization API Key**   | All projects within an organization    | Team automation, CI/CD        |
| **Project-scoped API Key** | Single project only                    | Limited access integrations   |

Create your first API key in the Neon Console under **Account settings** > **API keys**. For detailed instructions, see [Manage API keys](https://neon.com/docs/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:

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

### Authentication

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

```bash
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:

Tab: curl

```bash
# 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
```

Tab: TypeScript SDK

```bash
npm install @neondatabase/api-client
```

```typescript
import { createApiClient } from '@neondatabase/api-client';

const apiClient = createApiClient({
  apiKey: process.env.NEON_API_KEY!,
});

async function listProjects() {
  const response = await apiClient.listProjects({});
  console.log(response.data.projects);
}

listProjects();
```

Tab: Python SDK

```bash
pip install neon-api
```

```python
import os
from neon_api import NeonAPI

neon = NeonAPI(api_key=os.environ["NEON_API_KEY"])

projects = neon.projects()
print(projects)
```

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

```json
{
  "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:

Tab: curl

```bash
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"}}'
```

Tab: TypeScript SDK

```typescript
const response = await apiClient.createProjectBranch('spring-example-302709', {
  branch: { name: 'dev-branch' },
});
console.log(response.data.branch);
```

Tab: Python SDK

```python
branch = neon.branch_create(
    project_id="spring-example-302709",
    branch={"name": "dev-branch"}
)
print(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:

```json
"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:

```bash
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](https://neon.com/docs/manage/operations#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:

```bash
# 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:

- **[TypeScript SDK](https://neon.com/docs/reference/typescript-sdk)**: Full-featured SDK for Node.js and browser
- **[Python SDK](https://neon.com/docs/reference/python-sdk)**: Pythonic wrapper for the Neon API
- **[@neondatabase/toolkit](https://neon.com/docs/reference/neondatabase-toolkit)**: Combined SDK for AI agents (includes API SDK + Serverless Driver)
- **[Neon CLI](https://neon.com/docs/reference/neon-cli)**: Command-line interface for Neon

See [Neon SDKs](https://neon.com/docs/reference/sdk) for the full list, including community SDKs.

## API reference documentation

The interactive [Neon API reference](https://api-docs.neon.tech/reference/getting-started-with-neon-api) 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](https://neon.com/api_spec/release/v2.json) 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.

- [Manage API keys](https://neon.com/docs/manage/api-keys#manage-api-keys-with-the-neon-api): Create, list, and revoke API keys for personal accounts and organizations
- [Manage projects](https://neon.com/docs/manage/projects#manage-projects-with-the-neon-api): Create, list, update, delete, and recover projects
- [Manage branches](https://neon.com/docs/manage/branches#branching-with-the-neon-api): Create, list, and delete branches
- [Manage computes](https://neon.com/docs/manage/computes#manage-computes-with-the-neon-api): Create, configure, restart, and delete compute endpoints
- [Manage roles](https://neon.com/docs/manage/roles#manage-roles-with-the-neon-api): Create roles, reset passwords, and manage database access
- [Manage databases](https://neon.com/docs/manage/databases#manage-databases-with-the-neon-api): Create, list, update, and delete databases
- [View operations](https://neon.com/docs/manage/operations#operations-and-the-neon-api): List operations, check status, and poll for completion
- [Maintenance windows](https://neon.com/docs/manage/updates#updates-on-paid-plans): Configure maintenance windows for compute updates via API
- [Organizations API](https://neon.com/docs/manage/orgs-api): Manage organization members and permissions
- [Project transfer](https://neon.com/docs/manage/orgs-project-transfer#transfer-projects-with-the-api): Transfer projects between accounts and organizations

### Usage and billing

Monitor resource consumption and configure usage limits.

- [Monitor usage metrics](https://neon.com/docs/introduction/monitor-usage#retrieve-usage-metrics-with-the-neon-api): Retrieve usage data for projects and branches
- [Query consumption metrics](https://neon.com/docs/guides/consumption-metrics): Query project consumption metrics for usage-based plans. For legacy account and project endpoints, see [Query consumption metrics (legacy)](https://neon.com/docs/guides/consumption-metrics-legacy).
- [Organization consumption](https://neon.com/docs/manage/orgs-api-consumption#account-level-metrics): Query usage metrics for organizations
- [Configure consumption limits](https://neon.com/docs/guides/consumption-limits#configuring-quotas): Set and update quotas on compute, storage, and data transfer

### Branching workflows

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

- [Branching with the Neon API](https://neon.com/docs/guides/branching-neon-api): Comprehensive guide to branch management via API
- [Branch restore](https://neon.com/docs/introduction/branch-restore#how-to-use-instant-restore): Restore branches to a previous state using Time Travel
- [Branch expiration](https://neon.com/docs/guides/branch-expiration#creating-a-branch-with-expiration): Automatically delete branches after a specified time
- [Schema-only branches](https://neon.com/docs/guides/branching-schema-only#creating-schema-only-branches): Create branches with schema but no data
- [Reset from parent](https://neon.com/docs/guides/reset-from-parent#how-to-reset-from-parent): Reset a branch to match its parent's current state
- [Protected branches](https://neon.com/docs/guides/protected-branches#define-an-ip-allowlist-for-your-project): Configure IP allowlist restrictions for protected branches
- [Branching for testing](https://neon.com/docs/guides/branching-test-queries#create-a-test-branch): Create isolated branches for running test queries
- [Branch archiving](https://neon.com/docs/guides/branch-archiving#monitoring-branch-archiving): Monitor branch archive status via API

### Snapshots and backup

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

- [Backup and restore](https://neon.com/docs/guides/backup-restore#create-snapshots-manually): Create scheduled and on-demand snapshots
- [Database versioning](https://neon.com/docs/ai/ai-database-versioning#creating-snapshots): Create and manage snapshots via API for version control

### Data management

Transform and compare data across branches.

- [Data anonymization API](https://neon.com/docs/workflows/data-anonymization-api#create-anonymized-branch): Create anonymized copies of production data with masking rules
- [Data anonymization workflow](https://neon.com/docs/workflows/data-anonymization#create-a-branch-with-anonymized-data): End-to-end guide for setting up data anonymization
- [Schema comparison](https://neon.com/docs/guides/schema-diff#using-the-neon-api): Compare schemas between branches via API
- [Schema diff tutorial](https://neon.com/docs/guides/schema-diff-tutorial#view-the-schema-differences): Step-by-step schema comparison guide with API example

### Read replicas

Scale read operations with dedicated read-only compute endpoints.

- [Read replicas overview](https://neon.com/docs/introduction/read-replicas#manage-read-replicas-using-the-neon-api): List and manage read replica endpoints
- [Create read replicas](https://neon.com/docs/guides/read-replica-guide#create-a-read-replica-using-the-api): Create, configure, and delete read replica computes
- [Read replicas for data analysis](https://neon.com/docs/guides/read-replica-data-analysis#create-a-read-replica): Create read replicas for analytics workloads
- [Read replicas for ad-hoc queries](https://neon.com/docs/guides/read-replica-adhoc-queries#setting-up-a-read-replica-for-ad-hoc-queries): Create read replicas for exploratory queries

### Security and compliance

Configure security features and compliance settings.

- [HIPAA compliance](https://neon.com/docs/security/hipaa#step-2-enable-hipaa-for-your-projects): Create and configure HIPAA-compliant projects via API
- [API key management](https://neon.com/docs/manage/api-keys): Secure API key handling for personal and organization accounts

---

## Related docs (Tools & Workflows)

- [Local development](https://neon.com/docs/local/neon-local)
- [Integrations (3rd party)](https://neon.com/docs/guides/integrations)
- [Workflows & CI/CD](https://neon.com/docs/reference/instagres)
- [Templates](https://neon.com/docs/https://neon.com/templates)
- [Examples repo](https://neon.com/docs/https://github.com/neondatabase/examples)
