How to hit the Neon API

Neon's API at https://console.neon.tech/api/v2 manages serverless Postgres projects, branches, and compute endpoints.

Authentication

Create a token at Account settings → API keys. Send it as Authorization: Bearer <token>. In the examples it's written {{NEON_API_KEY}}.

Full reference: https://api-docs.neon.tech/reference/getting-started-with-neon-api

List projects

curl https://console.neon.tech/api/v2/projects \
  -H "Authorization: Bearer {{NEON_API_KEY}}"
Run in PostTaco

A project's branches

curl https://console.neon.tech/api/v2/projects/{{PROJECT_ID}}/branches \
  -H "Authorization: Bearer {{NEON_API_KEY}}"
Run in PostTaco

Create a branch

A copy-on-write branch of your database, instantly.

curl -X POST https://console.neon.tech/api/v2/projects/{{PROJECT_ID}}/branches \
  -H "Authorization: Bearer {{NEON_API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{"branch": {"name": "dev-posttaco"}}'
Run in PostTaco