Neon is now SOC 2 Type 2 compliant 🚀Read more
Manage

Operations

An operation is an action performed by the Neon Control Plane on a Neon object or resource. Operations are typically initiated by user actions, such as creating a branch or deleting a database. Other operations may be initiated by the Neon Control Plane, such as suspending a compute endpoint after a period of inactivity or checking its availability. You can monitor operations to keep an eye on the overall health of your Neon project or to check the status of specific operations. When working with the Neon API, you can poll the status of operations to ensure that an API request is completed before issuing the next API request. For more information, see Poll operation status.

OperationDescription
apply_configApplies a new configuration to a Neon object or resource. For example, creating, deleting, or updating PostgreSQL users and databases initiates this operation.
check_availabilityChecks the availability of data in a branch and that a compute endpoint can start on a branch. Branches without a compute endpoint are not checked. This operation, performed by the availability checker, is a periodic load generated by the Control Plane.
create_branchCreates a branch in a Neon project. For related information, see Manage branches.
create_timelineCreates a project with a primary branch.
delete_tenantDeletes stored data when a Neon project is deleted.
start_computeStarts a compute endpoint when there is an event or action that requires compute resources. For example, connecting to a suspended compute endpoint initiates this operation.
suspend_computeSuspends a compute endpoint after a period of inactivity. For information about how Neon manages compute resources, see Compute lifecycle.

View operations

You can view operations in the Operations widget on the Neon Dashboard or on the Operations page.

Operations

Operation details include:

  • Action: The action performed by the operation.
  • Branch: The branch on which the operation was performed.
  • Status: The status of the operation.
  • Duration: The duration of the operation.
  • Date: The date and time the operation occurred.

View operations with the Neon API

The following topics are covered in this section:

  • List operations: Describes how to list all operations for a Neon project.
  • List operations with pagination: Describes how to list all operations for a Neon project and paginate the response.
  • Get operation: Describes how to retrieve the details for a specific operation by the operation ID.
  • Poll operation status: Describes how to poll an operation for its status, which may be necessary to avoid failed requests due to in-progress operations when using the Neon API programmatically.

List operations

Lists operations for the specified project. This method supports response pagination. For more information, see List operations with pagination.

cURL command:

Response body

List operations with pagination

Pagination allows you to limit the number of operations displayed, as the number of operations for project can be large. To paginate responses, issue an initial request with a limit value. For brevity, the limit is set to 1 in the following example.

cURL command:

Response body

To list the next page of operations, add the cursor value returned in the response body of the previous request and a limit value for the next page.

Response body

Get operation

This method shows only the details for the specified operation ID.

cURL command:

Response body

Poll operation status

Some Neon API requests may take a few moments to complete. When using the Neon API programmatically, you can check the status of an operation before proceeding with the next API request. For example, you may want to check the operation status of a create branch request before issuing a create database request for that branch.

The response to a Neon API request includes information about the operations that were initiated. For example, a create branch request initiates create_branch and start_compute operations.

You can use the Get operation details method to poll the status of an operation by the operation ID. You might do this at intervals of 5 seconds until the status of the operation changes to finished before issuing the next request. For example, this request polls the start_compute operation shown above:

Response body

Possible operation status values include running, finished, failed, scheduling. Initially, the status of an operation might be scheduling. Before issuing the next API request, you would poll the operation until the status changes to finished. You could also add logic to handle a failed status.

Need help?

Join the Neon community forum to ask questions or see what others are doing with Neon. Neon Pro Plan users can open a support ticket from the console. For more detail, see Getting Support.

Last updated on

Edit this page
Was this page helpful?