> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyshift.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Confluence Integration

> Connect your Confluence instance to enable Annie to search pages, access documentation, and leverage knowledge base content during incident investigation.

# Confluence Integration

Confluence integration enables Annie to access your knowledge base, allowing it to search pages, retrieve documentation, and correlate incidents with existing runbooks, procedures, and historical knowledge.

## Setup Guide

1. Go to the [Anyshift integrations page](https://app.anyshift.io/integrations)
2. Navigate to the Knowledge Base section
3. Select **Confluence**
4. Click **Connect Confluence**
5. Enter your **Confluence Domain**, **Email**, and **API Token**
6. Click **Save**

### 1. Confluence Domain

Enter your Atlassian domain (e.g., `yourcompany.atlassian.net`).

This is the same domain you use to access Confluence Cloud. For example, if you access Confluence at `https://acme.atlassian.net/wiki`, enter `acme.atlassian.net`.

### 2. Email

Enter the email address associated with your Atlassian account (e.g., `user@company.com`).

### 3. API Token

Anyshift supports both **scoped** and **classic** Atlassian API tokens. We recommend scoped tokens for least-privilege access.

No admin configuration is required — any Atlassian user can create a token and connect their Confluence instance.

#### Option A: Scoped API Token (Recommended)

Generate a scoped API token with all Confluence read permissions:

1. Go to [Atlassian API Token Management](https://id.atlassian.com/manage-profile/security/api-tokens)
2. Click **Create API token**
3. Select **Scoped** token type
4. Enter a label (e.g., "Anyshift Confluence Integration")
5. Grant the following permissions:
   * All `read:confluence-*` scopes (content, spaces, users, props, etc.)
   * `search:confluence` - Search Confluence content (**required** — this is not a `read:*` scope)
   * `read:me` - Read your profile information
   * `read:account` - Read account information
6. Click **Create**
7. Copy the token and paste it into Anyshift

#### Option B: Classic API Token

If you prefer a simpler setup, you can use a classic (non-scoped) API token. Classic tokens inherit all permissions of the Atlassian account.

1. Go to [Atlassian API Token Management](https://id.atlassian.com/manage-profile/security/api-tokens)
2. Click **Create API token**
3. Select **Classic** token type
4. Enter a label (e.g., "Anyshift Confluence Integration")
5. Click **Create**
6. Copy the token and paste it into Anyshift

For more details, see [Atlassian's API Token documentation](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/).

Keep your API token secure and do not share it publicly.

## Required Permissions

Annie performs **read-only** operations on your Confluence instance. Your API Token grants access based on your Atlassian account permissions.

Your account needs access to:

* View spaces
* View pages and their content
* Search content using CQL

Annie does not create, modify, or delete any pages, comments, or other content in your Confluence instance.

## How It Works

Once connected, Annie can leverage your Confluence instance during:

* **Incident Investigation**: When analyzing an incident, Annie searches for related runbooks, troubleshooting guides, and architecture documentation to find relevant context
* **Question Answering**: When you ask about specific topics, Annie retrieves documentation directly from Confluence
* **Correlation**: Annie can correlate alerts and incidents with documented procedures, known issues, and operational playbooks

### Example Use Cases

* "Search Confluence for the deployment runbook"
* "Find documentation about Redis failover procedures"
* "What does the architecture page say about the payment service?"
* "Search for post-incident reviews related to database outages"

Annie will search your Confluence instance using CQL (Confluence Query Language) and cite relevant pages in its responses.

### CQL Query Examples

Annie can construct CQL queries automatically based on your questions:

| Question           | CQL Query                                    |
| ------------------ | -------------------------------------------- |
| "Recent pages"     | `type = page AND lastModified >= now('-7d')` |
| "Pages in a space" | `space = OPS AND type = page`                |
| "Runbooks"         | `label = runbook AND type = page`            |
| "Deployment docs"  | `text ~ "deployment procedure"`              |

## Supported Features

Annie can access the following Confluence data:

**Pages**

* Search pages using CQL or text search
* Get full page content (title, body, metadata)
* Navigate page hierarchies (parent/child pages)
* View space page trees

**Page Metadata**

* View comments on pages
* Get labels applied to pages
* Access page version history
* Compare page versions (diffs)

**Attachments**

* List attachments on pages

## Space Scoping

You can optionally restrict which Confluence spaces Annie can access by specifying **Allowed Spaces** when configuring credentials.

Enter a comma-separated list of Confluence space keys (e.g., `ENG,OPS,SRE`). When configured:

* **Searches** are automatically scoped to the specified spaces
* **Direct page access** is restricted — Annie cannot fetch pages from spaces not in the list
* **Space listings** only show the allowed spaces

Leave the field empty to allow access to all spaces the service account can see.

This is useful when a service account has broad access but you want Annie to focus on specific documentation spaces. For stronger isolation, you can also configure space-level permissions on the Atlassian service account itself.

## Security

* API tokens are encrypted at rest using AWS KMS
* Anyshift only reads from your Confluence instance (no write operations)
* All communication uses HTTPS/TLS encryption
* Credentials are validated directly against the Confluence REST API

## Troubleshooting

### "401 Unauthorized" or "Invalid credentials" error

This is usually caused by one of the following:

1. **Token missing required scopes** (scoped tokens only): Ensure your scoped token has all `read:confluence-*` scopes, plus `search:confluence` (this is a separate scope, not covered by `read:*`), `read:me`, and `read:account`.

2. **Email/token mismatch**: Verify your email matches your Atlassian account email exactly.

3. **Expired or revoked token**: Generate a new API token from your [Atlassian account settings](https://id.atlassian.com/manage-profile/security/api-tokens).

### "No pages found" when searching

* Verify your account has permission to view the spaces being searched
* Check that the CQL query syntax is valid
* Ensure pages exist matching your search criteria

### Connection timeout

* Verify your Confluence domain is correct (e.g., `yourcompany.atlassian.net`)
* Check that your Atlassian instance is accessible

Ready to get started? [Configure Confluence Integration](https://app.anyshift.io/integrations)
