K

neon

Latest version
Domain
OpenAPI file
The Neon API allows you to access and manage Neon programmatically. You can use the Neon API to manage API keys, projects, branches, endpoints, databases, roles, and operations. For information about ...read more

Versions

Authentication

HTTP Authentication

bearer

The Neon API requires an API key to authorize your requests, which you can enter below. Refer to our documentation to find out how to generate and use API keys.

Api Keys

get
/api_keys

Retrieves the API keys for your Neon account. The response does not include API key tokens. A token is only provided when creating an API key. API keys can also be managed in the Neon Console. For more information, see Manage API keys.

post
/api_keys

Creates an API key. The key_name is a user-specified name for the key. This method returns an id and key. The key is a randomly generated, 64-bit token required to access the Neon API. API keys can also be managed in the Neon Console. See Manage API keys.

Body params

Name
key_name
Type
string
Required
Description
A user-specified API key name. This value is required when creating an API key.

delete
/api_keys/{key_id}

Revokes the specified API key. An API key that is no longer needed can be revoked. This action cannot be reversed. You can obtain key_id values by listing the API keys for your Neon account. API keys can also be managed in the Neon Console. See Manage API keys.

Path parameters

  • Name
    key_id
    Type
    integer
    Required
    Description

    The API key ID

Projects

get
/projects/{project_id}/operations/{operation_id}

Retrieves details for the specified operation. An operation is an action performed on a Neon project resource. You can obtain a project_id by listing the projects for your Neon account. You can obtain a operation_id by listing operations for the project.

get
/projects

Retrieves a list of projects for the Neon account. A project is the top-level object in the Neon object hierarchy. For more information, see Manage projects.

Path parameters

  • Name
    cursor
    Type
    string
    Description

    Specify the cursor value from the previous response to get the next batch of projects.

  • Name
    limit
    Type
    integer
    Description

    Specify a value from 1 to 100 to limit number of projects in the response.

post
/projects

Creates a Neon project. A project is the top-level object in the Neon object hierarchy. Plan limits define how many projects you can create. Neon's Free plan permits one project per Neon account. For more information, see Manage projects.

You can specify a region and PostgreSQL version in the request body. Neon currently supports PostgreSQL 14 and 15. For supported regions and region_id values, see Regions.

Body params

Name
project
Type
object
Required
Name
settings
Type
object
Name
quota
Type
object
Description
The consumption quota of a project. After the quota has been exceeded, it is impossible to use the project until either: * Neon cloud resets the calculated consumption, * or the user increases quota for the project. The Neon cloud resets the quota at the beginning of the billing period. If the quota is not set, the project can use as many resources as needed.
Name
active_time_sec
Type
integer
Description
The total amount of wall-clock time allowed to be spent by a project's compute endpoints.
Name
cpu_quota_sec
Type
integer
Description
The total amount of CPU seconds allowed to be spent by a project's compute endpoints.
Name
name
Type
string
Description
The project name
Name
branch
Type
object
Name
name
Type
string
Description
The branch name. If not specified, the default branch name will be used.
Name
role_name
Type
string
Description
The role name. If not specified, the default role name will be used.
Name
database_name
Type
string
Description
The database name. If not specified, the default database name will be used.
Name
autoscaling_limit_min_cu
Type
number
Description
The minimum number of CPU units
Name
autoscaling_limit_max_cu
Type
number
Description
The maximum number of CPU units
Name
provisioner
Type
string
Description
The Neon compute provisioner.
Name
region_id
Type
string
Description
The region identifier. See [the documentation](https://neon.tech/docs/introduction/regions) for the list of supported regions.
Name
default_endpoint_settings
Type
object
Description
A raw representation of PostgreSQL settings
Name
pg_version
Type
integer
Description
The major PostgreSQL version number. Currently supported version are `14` and `15`.
Name
store_passwords
Type
boolean
Description
Whether or not passwords are stored for roles in the Neon project. Storing passwords facilitates access to Neon features that require authorization.

get
/projects/{project_id}

Retrieves information about the specified project. A project is the top-level object in the Neon object hierarchy. You can obtain a project_id by listing the projects for your Neon account.

delete
/projects/{project_id}

Deletes the specified project. You can obtain a project_id by listing the projects for your Neon account. Deleting a project is a permanent action. Deleting a project also deletes endpoints, branches, databases, and users that belong to the project.

patch
/projects/{project_id}

Updates the specified project. You can obtain a project_id by listing the projects for your Neon account. Neon permits updating the project name only.

Body params

Name
project
Type
object
Required
Name
settings
Type
object
Name
quota
Type
object
Description
The consumption quota of a project. After the quota has been exceeded, it is impossible to use the project until either: * Neon cloud resets the calculated consumption, * or the user increases quota for the project. The Neon cloud resets the quota at the beginning of the billing period. If the quota is not set, the project can use as many resources as needed.
Name
active_time_sec
Type
integer
Description
The total amount of wall-clock time allowed to be spent by a project's compute endpoints.
Name
cpu_quota_sec
Type
integer
Description
The total amount of CPU seconds allowed to be spent by a project's compute endpoints.
Name
name
Type
string
Name
default_endpoint_settings
Type
object
Description
A raw representation of PostgreSQL settings

get
/projects/{project_id}/operations

Retrieves a list of operations for the specified Neon project. You can obtain a project_id by listing the projects for your Neon account. The number of operations returned can be large. To paginate the response, issue an initial request with a limit value. Then, add the cursor value that was returned in the response to the next request.

Path parameters

  • Name
    cursor
    Type
    string
    Description

    Specify the cursor value from the previous response to get the next batch of operations

  • Name
    limit
    Type
    integer
    Description

    Specify a value from 1 to 1000 to limit number of operations in the response

  • Name
    project_id
    Type
    string
    Required
    Description

    The Neon project ID

get
/projects/{project_id}/branches

Retrieves a list of branches for the specified project. You can obtain a project_id by listing the projects for your Neon account.

Each Neon project has a root branch named main. A branch_id value has a br- prefix. A project may contain child branches that were branched from main or from another branch. A parent branch is identified by the parent_id value, which is the id of the parent branch. For related information, see Manage branches.

post
/projects/{project_id}/branches

Creates a branch in the specified project. You can obtain a project_id by listing the projects for your Neon account.

This method does not require a request body, but you can specify one to create an endpoint for the branch or to select a non-default parent branch. The default behavior is to create a branch from the project's root branch (main) with no endpoint, and the branch name is auto-generated. For related information, see Manage branches.

Body params

Name
endpoints
Type
array[object]
Name
type
Type
string
Required
Description
The compute endpoint type. Either `read_write` or `read_only`. The `read_only` compute endpoint type is not yet supported.
Name
autoscaling_limit_min_cu
Type
number
Description
The minimum number of CPU units
Name
autoscaling_limit_max_cu
Type
number
Description
The maximum number of CPU units
Name
provisioner
Type
string
Description
The Neon compute provisioner.
Name
suspend_timeout_seconds
Type
integer
Description
Duration of inactivity in seconds after which endpoint will be automatically suspended. Value `0` means use global default, `-1` means never suspend. Maximum value is 24 hours in seconds.
Name
branch
Type
object
Name
parent_id
Type
string
Description
The `branch_id` of the parent branch
Name
name
Type
string
Description
The branch name
Name
parent_lsn
Type
string
Description
A Log Sequence Number (LSN) on the parent branch. The branch will be created with data from this LSN.
Name
parent_timestamp
Type
string
Description
A timestamp identifying a point in time on the parent branch. The branch will be created with data starting from this point in time.

get
/projects/{project_id}/branches/{branch_id}

Retrieves information about the specified branch. You can obtain a project_id by listing the projects for your Neon account. You can obtain a branch_id by listing the project's branches. A branch_id value has a br- prefix.

Each Neon project has a root branch named main. A project may contain child branches that were branched from main or from another branch. A parent branch is identified by a parent_id value, which is the id of the parent branch. For related information, see Manage branches.

delete
/projects/{project_id}/branches/{branch_id}

Deletes the specified branch from a project, and places all endpoints into an idle state, breaking existing client connections. You can obtain a project_id by listing the projects for your Neon account. You can obtain a branch_id by listing the project's branches. For related information, see Manage branches.

When a successful response status is received, the endpoints are still active, and the branch is not yet deleted from storage. The deletion occurs after all operations finish. You cannot delete a branch if it is the only remaining branch in the project. A project must have at least one branch.

patch
/projects/{project_id}/branches/{branch_id}

Updates the specified branch. Only changing the branch name is supported. You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id by listing the project's branches. For more information, see Manage branches.

Body params

Name
branch
Type
object
Required
Name
name
Type
string

post
/projects/{project_id}/branches/{branch_id}/set_as_primary

The primary mark is automatically removed from the previous primary branch. You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id by listing the project's branches. For more information, see Manage branches.

get
/projects/{project_id}/branches/{branch_id}/endpoints

Retrieves a list of endpoints for the specified branch. Currently, Neon permits only one endpoint per branch. You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id by listing the project's branches.

get
/projects/{project_id}/branches/{branch_id}/databases

Retrieves a list of databases for the specified branch. A branch can have multiple databases. You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id by listing the project's branches. For related information, see Manage databases.

post
/projects/{project_id}/branches/{branch_id}/databases

Creates a database in the specified branch. A branch can have multiple databases. You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id by listing the project's branches. For related information, see Manage databases.

Body params

Name
database
Type
object
Required
Name
name
Type
string
Required
Description
The name of the datbase
Name
owner_name
Type
string
Required
Description
The name of the role that owns the database

get
/projects/{project_id}/branches/{branch_id}/databases/{database_name}

Retrieves information about the specified database. You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id and database_name by listing branch's databases. For related information, see Manage databases.

delete
/projects/{project_id}/branches/{branch_id}/databases/{database_name}

Deletes the specified database from the branch. You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id and database_name by listing branch's databases. For related information, see Manage databases.

patch
/projects/{project_id}/branches/{branch_id}/databases/{database_name}

Updates the specified database in the branch. You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id and database_name by listing the branch's databases. For related information, see Manage databases.

Body params

Name
database
Type
object
Required
Name
name
Type
string
Description
The name of the database
Name
owner_name
Type
string
Description
The name of the role that owns the database

get
/projects/{project_id}/branches/{branch_id}/roles

Retrieves a list of roles from the specified branch. You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id by listing the project's branches. In Neon, the terms "role" and "user" are synonymous. For related information, see Manage users.

post
/projects/{project_id}/branches/{branch_id}/roles

Creates a role in the specified branch. You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id by listing the project's branches. In Neon, the terms "role" and "user" are synonymous. For related information, see Manage users.

Connections established to the active read-write endpoint will be dropped. If the read-write endpoint is idle, the endpoint becomes active for a short period of time and is suspended afterward.

Body params

Name
role
Type
object
Required
Name
name
Type
string
Required
Description
The role name. Cannot exceed 63 bytes in length.

get
/projects/{project_id}/branches/{branch_id}/roles/{role_name}

Retrieves details about the specified role. You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id by listing the project's branches. You can obtain the role_name by listing the roles for a branch. In Neon, the terms "role" and "user" are synonymous. For related information, see Managing users.

delete
/projects/{project_id}/branches/{branch_id}/roles/{role_name}

Deletes the specified role from the branch. You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id by listing the project's branches. You can obtain the role_name by listing the roles for a branch. In Neon, the terms "role" and "user" are synonymous. For related information, see Managing users.

get
/projects/{project_id}/branches/{branch_id}/roles/{role_name}/reveal_password

Retrieves password of the specified role if possible. You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id by listing the project's branches. You can obtain the role_name by listing the roles for a branch. In Neon, the terms "role" and "user" are synonymous. For related information, see Managing users.

post
/projects/{project_id}/branches/{branch_id}/roles/{role_name}/reset_password

Resets the password for the specified role. Returns a new password and operations. The new password is ready to use when the last operation finishes. The old password remains valid until last operation finishes. Connections to the read-write endpoint are dropped. If idle, the read-write endpoint becomes active for a short period of time.

You can obtain a project_id by listing the projects for your Neon account. You can obtain the branch_id by listing the project's branches. You can obtain the role_name by listing the roles for a branch. In Neon, the terms "role" and "user" are synonymous. For related information, see Managing users.

get
/projects/{project_id}/endpoints

Retrieves a list of endpoints for the specified project. An endpoint is a Neon compute instance. You can obtain a project_id by listing the projects for your Neon account. For more information about endpoints, see Manage endpoints.

post
/projects/{project_id}/endpoints

Creates an endpoint for the specified branch. An endpoint is a Neon compute instance. There is a maximum of one endpoint per branch. If the specified branch already has an endpoint, the operation fails.

You can obtain a project_id by listing the projects for your Neon account. You can obtain branch_id by listing the project's branches. A branch_id has a br- prefix. Currently, only the read_write endpoint type is supported. For supported regions and region_id values, see Regions. For more information about endpoints, see Manage endpoints.

Body params

Name
endpoint
Type
object
Required
Name
branch_id
Type
string
Required
Description
The ID of the branch the compute endpoint will be associated with
Name
region_id
Type
string
Description
The region where the compute endpoint will be created. Only the project's `region_id` is permitted.
Name
type
Type
string
Required
Description
The compute endpoint type. Either `read_write` or `read_only`. The `read_only` compute endpoint type is not yet supported.
Name
settings
Type
object
Description
A collection of settings for a compute endpoint
Name
pg_settings
Type
object
Description
A raw representation of PostgreSQL settings
Name
autoscaling_limit_min_cu
Type
number
Description
The minimum number of CPU units
Name
autoscaling_limit_max_cu
Type
number
Description
The maximum number of CPU units
Name
provisioner
Type
string
Description
The Neon compute provisioner.
Name
pooler_enabled
Type
boolean
Description
Whether to enable connection pooling for the compute endpoint
Name
pooler_mode
Type
string
Description
The connection pooler mode. Neon supports PgBouncer in `transaction` mode only.
Name
disabled
Type
boolean
Description
Whether to restrict connections to the compute endpoint
Name
passwordless_access
Type
boolean
Description
NOT YET IMPLEMENTED. Whether to permit passwordless access to the compute endpoint.
Name
suspend_timeout_seconds
Type
integer
Description
Duration of inactivity in seconds after which endpoint will be automatically suspended. Value `0` means use global default, `-1` means never suspend. Maximum value is 24 hours in seconds.

get
/projects/{project_id}/endpoints/{endpoint_id}

Retrieves information about the specified endpoint. An endpoint is a Neon compute instance. You can obtain a project_id by listing the projects for your Neon account. You can obtain an endpoint_id by listing your project's endpoints. An endpoint_id has an ep- prefix. For more information about endpoints, see Manage endpoints.

delete
/projects/{project_id}/endpoints/{endpoint_id}

Delete the specified endpoint. An endpoint is a Neon compute instance. Deleting an endpoint drops existing network connections to the endpoint. The deletion is completed when last operation in the chain finishes successfully.

You can obtain a project_id by listing the projects for your Neon account. You can obtain an endpoint_id by listing your project's endpoints. An endpoint_id has an ep- prefix. For more information about endpoints, see Manage endpoints.

patch
/projects/{project_id}/endpoints/{endpoint_id}

Updates the specified endpoint. Currently, only changing the associated branch is supported. The branch that you specify cannot have an existing endpoint.

You can obtain a project_id by listing the projects for your Neon account. You can obtain an endpoint_id and branch_id by listing your project's endpoints. An endpoint_id has an ep- prefix. A branch_id has a br- prefix. For more information about endpoints, see Manage endpoints.

If the returned list of operations is not empty, the endpoint is not ready to use. The client must wait for the last operation to finish before using the endpoint. If the endpoint was idle before the update, the endpoint becomes active for a short period of time, and the control plane suspends it again after the update.

Body params

Name
endpoint
Type
object
Required
Name
branch_id
Type
string
Description
The destination branch ID. The destination branch must not have an exsiting read-write endpoint.
Name
autoscaling_limit_min_cu
Type
number
Description
The minimum number of CPU units
Name
autoscaling_limit_max_cu
Type
number
Description
The maximum number of CPU units
Name
provisioner
Type
string
Description
The Neon compute provisioner.
Name
settings
Type
object
Description
A collection of settings for a compute endpoint
Name
pg_settings
Type
object
Description
A raw representation of PostgreSQL settings
Name
pooler_enabled
Type
boolean
Description
Whether to enable connection pooling for the compute endpoint
Name
pooler_mode
Type
string
Description
The connection pooler mode. Neon supports PgBouncer in `transaction` mode only.
Name
disabled
Type
boolean
Description
Whether to restrict connections to the compute endpoint
Name
passwordless_access
Type
boolean
Description
NOT YET IMPLEMENTED. Whether to permit passwordless access to the compute endpoint.
Name
suspend_timeout_seconds
Type
integer
Description
Duration of inactivity in seconds after which endpoint will be automatically suspended. Value `0` means use global default, `-1` means never suspend. Maximum value is 24 hours in seconds.

post
/projects/{project_id}/endpoints/{endpoint_id}/start

Starts an endpoint. The endpoint is ready to use after the last operation in chain finishes successfully.

You can obtain a project_id by listing the projects for your Neon account. You can obtain an endpoint_id by listing your project's endpoints. An endpoint_id has an ep- prefix. For more information about endpoints, see Manage endpoints.

Path parameters

  • Name
    project_id
    Type
    string
    Required
    Description

    The Neon project ID

  • Name
    endpoint_id
    Type
    string
    Required
    Description

    The endpoint ID

post
/projects/{project_id}/endpoints/{endpoint_id}/suspend

Suspend the specified endpoint You can obtain a project_id by listing the projects for your Neon account. You can obtain an endpoint_id by listing your project's endpoints. An endpoint_id has an ep- prefix. For more information about endpoints, see Manage endpoints.

Consumption

get
/consumption/projects

Note, this is a preview API and could be subjected to significant changes in the future. Retrieves a list of per-project consumption for the current billing period.

Path parameters

  • Name
    cursor
    Type
    string
    Description

    Specify the cursor value from the previous response to get the next batch of projects.

  • Name
    limit
    Type
    integer
    Description

    Specify a value from 1 to 1000 to limit number of projects in the response.