Get Started with the Data API

  • Capella Operational
  • how-to
    +
    To get started with the Couchbase Capella Data API, you must create a cluster access credential and enable the Data API for the cluster.

    Introduction

    To access the Data API, you must first enable the Data API for the cluster. Couchbase Capella provides a unique base URL which you can use to access the Data API for that cluster.

    Cluster Access

    A cluster access credential authenticates and authorizes you to access the Data API. You can use an existing cluster access credential, or create a new one. The access privileges that you specify for the cluster access credential determine the buckets, scopes, and collections that you can access via the Data API.

    Private Networking

    If you want to access the Data API over a VPC Peering connection, you must activate VPC Peering for the Data API when you enable the Data API itself. You must then set up VPC Peering in a separate step.

    If you want to access the Data API through a private endpoint, do not activate VPC Peering for the Data API. Instead, enable the Data API, and set up a private endpoint for the Data API in a separate step.

    IP Access over Public Network

    To use the Data API over a public network, you must specify which IP addresses can access the Couchbase Capella cluster. For security, it’s recommended that clients should only be able to access the cluster from specific IP addresses.

    For each cluster, you can grant access from:

    • Any IP address.

    • Individual IP addresses.

    • Blocks of IP addresses using CIDR notation.

    Permitted IP addresses and address ranges must be in IPv4 format.

    If you’re accessing the Data API via a VPC Peering connection or a private endpoint, you do not need to permit access from the peered range of private IP addresses.

    Prerequisites

    The procedures on this page assume the following:

    • You have configured cluster access by creating a cluster access credential. You’ll need the username and password for the cluster credential to connect to the Data API.

    • You have added your IP address to the cluster’s list of allowed IPs, if required.

    • You’re not connecting from an IPv6-only environment — you need to be able to use the IPv4 records published for Capella clusters.

    You can do all of this from a single location using the Connect page in the Capella UI, or the Management API.

    Examples on this Page

    In the Management API examples on this page:

    • $organizationId is the organization ID.

    • $projectId is the project ID.

    • $clusterId is the cluster ID.

    • $apiKeySecret is the API key secret, used as the Bearer token.

    The endpoints described on this page all have the same base path: /v4/organizations/{organizationId}/projects/{projectId}/clusters/{clusterId}. For clarity, this is not shown in the instructions, but it’s included in the examples.

    Enable the Data API

    You can enable the Data API using the Capella UI or the Management API.

    • Capella UI

    • Management API

    1. On the Operational Clusters page, click on the cluster that you want to connect to.

    2. Go to Connect  Data API.

    3. If necessary, follow the instructions on screen to enter an allowed IP address range.

    4. If necessary, follow the instructions on screen to create a new cluster user.

    5. Click Enable Data API. When prompted, type Yes and click Confirm.

    6. Wait for Couchbase Capella to deploy the Data API. This may take several minutes.

    7. When the Data API is deployed, copy the Data API Endpoint — this is the base URL you’ll need to connect to the cluster.

    8. If required, select Enable Data API over VPC Peered Network. This will incur extra charges.

    9. To get started with the Data API, choose a cluster user from the drop-down, and then copy the generated sample code. Replace <<password>> with the password you specified when you created the cluster access user.

    1. If necessary, use POST /allowedcidrs to enter an allowed IP address range.

      curl -X POST "https://cloudapi.cloud.couchbase.com/v4/organizations/$organizationId/projects/$projectId/clusters/$clusterId/allowedcidrs" \
        -H "Accept: application/json" \
        -H "Authorization: Bearer $apiKeySecret" \
        -d '{
        "cidr": "6.60.28.100/32",
        "comment": "Allows access from my local developer machine",
        "expiresAt": "2026-05-14T21:49:58.465Z"
      }'
    2. If necessary, use POST /users to create a cluster user.

      curl -X POST "https://cloudapi.cloud.couchbase.com/v4/organizations/$organizationId/projects/$projectId/clusters/$clusterId/users" \
        -H "Accept: application/json" \
        -H "Authorization: Bearer $apiKeySecret" \
        -d '{
        "name": "WriteAccessForAllBuckets",
        "access": [
          {
            "privileges": [
              "data_writer"
            ]
          }
        ]
      }'
    3. Use PUT /dataAPI to enable the Data API, and optionally enable VPC peering for the Data API.

      • To enable the Data API, pass "enableDataAPI": true in the request body.

      • To enable VPC peering for the Data API, pass "enableNetworkPeering": true in the request body. This will incur extra charges.

      curl -X PUT "https://cloudapi.cloud.couchbase.com/v4/organizations/$organizationId/projects/$projectId/clusters/$clusterId/dataAPI" \
        -H "Accept: application/json" \
        -H "Authorization: Bearer $apiKeySecret" \
        -d '{
        "enableDataApi": true,
        "enableNetworkPeering": true
      }'
    4. Use GET /dataAPI to check the status of the Data API. It may take several minutes to deploy the Data API.

      curl -X GET "https://cloudapi.cloud.couchbase.com/v4/organizations/$organizationId/projects/$projectId/clusters/$clusterId/dataAPI" \
        -H "Accept: application/json" \
        -H "Authorization: Bearer $apiKeySecret"
    5. Copy the connection string returned by GET /dataAPI — this is the base URL you’ll need to connect to the cluster.

    Disable the Data API

    You can disable the Data API using the Capella UI or the Management API.

    • Capella UI

    • Management API

    1. On the Operational Clusters page, click on the cluster that you want to connect to.

    2. Go to Connect  Data API.

    3. Click Disable Data API. When prompted, click Confirm.

    1. Use PUT /dataAPI to disable VPC peering for the Data API, or disable the Data API altogether.

      • To disable VPC peering for the Data API, pass "enableNetworkPeering": false in the request body.

      • To disable the Data API altogether, pass "enableDataAPI": false in the request body.

      curl -X PUT "https://cloudapi.cloud.couchbase.com/v4/organizations/$organizationId/projects/$projectId/clusters/$clusterId/dataAPI" \
        -H "Accept: application/json" \
        -H "Authorization: Bearer $apiKeySecret" \
        -d '{
        "enableDataApi": false,
        "enableNetworkPeering": false
      }'
    2. Use GET /dataAPI to check the status of the Data API.

      curl -X GET "https://cloudapi.cloud.couchbase.com/v4/organizations/$organizationId/projects/$projectId/clusters/$clusterId/dataAPI" \
        -H "Accept: application/json" \
        -H "Authorization: Bearer $apiKeySecret"

    Next Steps