# Confluence

Sync Confluence pages and spaces to Twig.

## Prerequisites

* Confluence Cloud account
* Read access to target spaces
* Ability to generate API tokens

## Setup Steps

### 1. Get Confluence Domain

1. Open your Confluence space in browser
2. Copy domain from URL:

   ```
   https://yourcompany.atlassian.net/wiki/...
            ^^^^^^^^^^^^^^^^^^^^^^^^
            Copy this domain
   ```
3. Format: `yourcompany.atlassian.net`

<figure><img src="/files/5eNB8qThZmGTJP2Eyo9C" alt=""><figcaption></figcaption></figure>

### 2. Get Space Key

1. Open target space in Confluence
2. Click **Space Settings** (gear icon)
3. Copy **Space Key** (e.g., "PROD", "ENG", "DOCS")

<figure><img src="/files/jM7dA5FQVEpSS71Jg9uF" alt=""><figcaption></figcaption></figure>

**Expected format**: 2-10 uppercase letters

### 3. Generate API Token

1. Click profile icon (top right) → **Manage Account**

<figure><img src="/files/TPW4VTKnsRxJOibf6UFI" alt=""><figcaption></figcaption></figure>

2. Click **Security** tab

<figure><img src="/files/cZuU76rpx2bJldJLIMew" alt=""><figcaption></figcaption></figure>

3. Click **Create and manage API tokens**

<figure><img src="/files/oD0m5xmFOIDcGxaf3H7X" alt=""><figcaption></figcaption></figure>

4. Click **Create API token**

<figure><img src="/files/yBlHZUqTUVLo2SPsSDg1" alt=""><figcaption></figcaption></figure>

5. Enter:
   * **Label**: "Twig Integration"
   * **Expires**: Select date (recommended: 90 days)
6. Click **Create**
7. Copy token (format: 24-character alphanumeric)

<figure><img src="/files/cC84JL2EHvAcq05X4xkR" alt=""><figcaption></figcaption></figure>

**Token shown once**: Store securely

### 4. Connect in Twig

**You need**:

* Domain: `yourcompany.atlassian.net`
* Space Key: e.g., "PROD"
* Email: Your Confluence email
* API Token: From step 3

**Steps**:

1. Twig → Data → Add Data Source → Confluence

<figure><img src="/files/k7YmSQUElJag52rxkPGS" alt=""><figcaption></figcaption></figure>

2. Fill form:
   * **Name**: e.g., "Product Docs Space"
   * **Domain**: `yourcompany.atlassian.net`
   * **Space Key**: `PROD`
   * **Email**: `you@company.com`
   * **API Token**: Paste token
   * **Lookback Period**: e.g., "90 days" (optional, imports pages modified in last N days)
3. Click **Test Config**

**Expected result**: "Connection successful, found X pages"

4. Click **Save**

<figure><img src="/files/mV2mPw34ZqazbzxMcpCx" alt=""><figcaption></figcaption></figure>

5. Processing starts automatically

**Expected timeline**: 10-30 min for 100 pages

## How to Verify

1. Data → \[Confluence Source] → status "Active" (green)
2. Shows "X pages indexed" (e.g., "245 pages → 1,200 chunks")
3. Playground → Query about Confluence content → Check citations reference Confluence pages

## Common Mistakes

**Symptom**: "401 Unauthorized" error

**Cause**: Invalid API token or email

**Fix**:

1. Verify email matches Confluence account
2. Regenerate API token in Confluence
3. Update token in Twig (Edit → paste new token)

***

**Symptom**: "Space not found"

**Cause**: Wrong space key or no access

**Fix**:

1. Verify space key exact match (case-sensitive)
2. Check you have read access to space in Confluence
3. Try different space if needed

## When This Doesn't Apply

**Confluence Server/Data Center** (self-hosted): Requires Personal Access Token instead of API token. Contact support for configuration.

**Multiple spaces**: Create separate data source per space (no multi-space support in single connector).


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.twig.so/product/data-integrations/confluence.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
