> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/couchbase.md).

# Couchbase

Connect to Couchbase to run SQL++ queries and full-text or vector search.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector | Authentication |
| --------- | -------------- |
| Couchbase | Credentials    |

#### Couchbase

Connect to Couchbase Server or Capella Data API Query and Search services with a username, password, and separate HTTPS service URLs.

**Set up in Couchbase**

1. Prepare the Couchbase account or service that the workflow will access. Grant access to the required resources and operations.
2. **Username:** Couchbase Server: enter your Couchbase username. Capella: enter the cluster access name from Settings > Cluster Access and use its password below—not your Capella console login or a Management API key. The credentials must have permission for the data and actions you use.
3. **Query Service URL:** Couchbase Server: enter the Query Service HTTPS URL without a path, for example <https://query.example.com:18093>. Capella: enable the Data API under Connect > Data API, copy its Data API Endpoint, and append /\_p/query. Do not append /query/service. Both service URLs must be reachable from your StackAI deployment and use trusted TLS certificates. Localhost is not supported. Private addresses require a BYOC/on-prem deployment with private connectivity and a configured network allowlist. For public Capella access, allow your deployment's outbound IP addresses.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Couchbase**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field      | Required | What to enter                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Username           | Yes      | Couchbase Server: enter your Couchbase username. Capella: enter the cluster access name from Settings > Cluster Access and use its password below—not your Capella console login or a Management API key. The credentials must have permission for the data and actions you use. [Provider instructions](https://docs.couchbase.com/cloud/clusters/manage-database-users.html).                                                                                                                                                                                                                                                                                                     |
| Password           | Yes      | Enter the password issued for the account or service you are connecting.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Query Service URL  | Yes      | Couchbase Server: enter the Query Service HTTPS URL without a path, for example <https://query.example.com:18093>. Capella: enable the Data API under Connect > Data API, copy its Data API Endpoint, and append /\_p/query. Do not append /query/service. Both service URLs must be reachable from your StackAI deployment and use trusted TLS certificates. Localhost is not supported. Private addresses require a BYOC/on-prem deployment with private connectivity and a configured network allowlist. For public Capella access, allow your deployment's outbound IP addresses. [Provider instructions](https://docs.couchbase.com/cloud/data-api-guide/data-api-start.html). |
| Search Service URL | Yes      | Couchbase Server: enter the Search Service HTTPS URL without a path, for example <https://search.example.com:18094>. Capella: use the same Data API Endpoint as the Query Service URL and append /\_p/fts. Do not append /api or an index path. Both URLs must connect to the same cluster. [Provider instructions](https://docs.couchbase.com/server/current/rest-api/rest-fts.html).                                                                                                                                                                                                                                                                                              |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **Couchbase** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Execute SQL++ Query

Run a SQL++ query and return structured Couchbase results.

**Inputs**

| Field                 | Type     | Required | Description                                                                                  |
| --------------------- | -------- | -------- | -------------------------------------------------------------------------------------------- |
| SQL++ statement       | textarea | Yes      | The SQL++ statement to run. Put values in the parameter fields, not in the statement.        |
| Read only             | boolean  | Yes      | Reject statements that modify data or indexes. Default: true.                                |
| Positional parameters | textarea | No       | JSON array of values for $1, $2, and later placeholders.                                     |
| Named parameters      | textarea | No       | JSON object of placeholder values, keyed without the `$`.                                    |
| Query context         | string   | No       | Default bucket and scope for unqualified names, as `bucket.scope` or `default:bucket.scope`. |
| Timeout (seconds)     | integer  | No       | Maximum query runtime, from 1 to 300 seconds. Default: 30.                                   |

**Outputs**

| Field      | Type          | Description                                         |
| ---------- | ------------- | --------------------------------------------------- |
| Request ID | string        | Couchbase identifier for the query request.         |
| Results    | array         | Structured JSON rows returned by the query.         |
| Metrics    | object        | Execution counts and timings reported by Couchbase. |
| Warnings   | object\_array | Non-fatal warnings reported by Couchbase.           |

#### Get Document

Fetch one JSON document by key from a Couchbase collection.

**Inputs**

| Field        | Type            | Required | Description                                                                    |
| ------------ | --------------- | -------- | ------------------------------------------------------------------------------ |
| Bucket       | select (string) | Yes      | Bucket containing the document. Options load from the selected connection.     |
| Scope        | select (string) | Yes      | Scope containing the collection. Options load from the selected connection.    |
| Collection   | select (string) | Yes      | Collection containing the document. Options load from the selected connection. |
| Document key | string          | Yes      | Unique key of the document to fetch.                                           |

**Outputs**

| Field        | Type    | Description                          |
| ------------ | ------- | ------------------------------------ |
| Found        | boolean | Whether the document exists.         |
| Document key | string  | Key that was looked up.              |
| Document     | object  | Structured JSON document when found. |

#### Upsert Document

Create or replace one JSON document in a Couchbase collection.

**Inputs**

| Field                        | Type            | Required | Description                                                                         |
| ---------------------------- | --------------- | -------- | ----------------------------------------------------------------------------------- |
| Bucket                       | select (string) | Yes      | Bucket that will store the document. Options load from the selected connection.     |
| Scope                        | select (string) | Yes      | Scope containing the target collection. Options load from the selected connection.  |
| Collection                   | select (string) | Yes      | Collection that will store the document. Options load from the selected connection. |
| Document key                 | string          | Yes      | Unique key for the document to create or replace.                                   |
| Document (JSON)              | textarea        | Yes      | JSON object to write as the document value.                                         |
| Preserve existing expiration | boolean         | No       | Keep the current expiration when replacing an existing document. Default: true.     |

**Outputs**

| Field        | Type   | Description                                              |
| ------------ | ------ | -------------------------------------------------------- |
| Document key | string | Key of the written document.                             |
| Metrics      | object | Query timing and mutation metrics returned by Couchbase. |

#### Vector Search

Find documents similar to a supplied vector in a Couchbase Search index.

**Inputs**

| Field            | Type            | Required | Description                                                                                      |
| ---------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------ |
| Bucket           | select (string) | Yes      | Bucket that contains the Search index. Options load from the selected connection.                |
| Scope            | select (string) | Yes      | Scope that contains the Search index. Options load from the selected connection.                 |
| Search index     | select (string) | Yes      | Existing Search index to query. Options load from the selected connection.                       |
| Vector field     | select (string) | Yes      | Vector field configured in the selected Search index. Options load from the selected connection. |
| Query vector     | textarea        | Yes      | JSON array or comma-separated numbers; length must match the selected vector field's dimension.  |
| Hits to return   | integer         | No       | Maximum number of nearest vector hits to return. Default: 10.                                    |
| Fields to return | string          | No       | Comma-separated stored fields to include in each hit.                                            |
| Filter (JSON)    | textarea        | No       | Optional Couchbase Search query that pre-filters documents before the nearest-neighbor scan.     |

**Outputs**

| Field                     | Type          | Description                                                                                 |
| ------------------------- | ------------- | ------------------------------------------------------------------------------------------- |
| Hits                      | object\_array | Ranked vector hits from the Search index.                                                   |
| Total hits                | integer       | Number of nearest neighbors Couchbase returned for this query, at most the requested count. |
| Search time (nanoseconds) | integer       | Search processing time reported by Couchbase, in nanoseconds.                               |

#### Full-Text Search

Search an existing Couchbase Search index and return ranked matching documents.

**Inputs**

| Field            | Type            | Required | Description                                                                       |
| ---------------- | --------------- | -------- | --------------------------------------------------------------------------------- |
| Bucket           | select (string) | Yes      | Bucket that contains the Search index. Options load from the selected connection. |
| Scope            | select (string) | Yes      | Scope that contains the Search index. Options load from the selected connection.  |
| Search index     | select (string) | Yes      | Existing Search index to query. Options load from the selected connection.        |
| Search text      | string          | Yes      | Text to match in indexed documents.                                               |
| Field to search  | string          | Yes      | Indexed document field to search.                                                 |
| Match operator   | select (string) | No       | How multiple query terms are combined. Available values: Or, And. Default: or.    |
| Results per page | integer         | No       | Number of ranked hits to return, from 1 to 100. Default: 10.                      |
| Cursor           | string          | No       | Cursor returned by a prior search page.                                           |
| Fields to return | string          | No       | Comma-separated stored fields to include in each hit.                             |

**Outputs**

| Field       | Type          | Description                                     |
| ----------- | ------------- | ----------------------------------------------- |
| Hits        | object\_array | Ranked matching documents.                      |
| Total hits  | integer       | Total matching documents reported by Couchbase. |
| Next cursor | string        | Opaque cursor for the next page.                |
| Has more    | boolean       | Whether another page of results is available.   |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/couchbase.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
