Product

Confluence

Connect Confluence spaces via API token

TL;DR

Sync Confluence pages and spaces to Twig. Confluence Cloud account Read access to target spaces * Ability to generate API tokens

Key Takeaways

  • Prerequisites
  • Setup Steps
  • How to Verify
  • Common Mistakes
  • When This Doesn't Apply
  • Agent Instructions: Querying This Documentation

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

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")

Expected format: 2-10 uppercase letters

3. Generate API Token

  1. Click profile icon (top right) → Manage Account
  1. Click Security tab
  1. Click Create and manage API tokens
  1. Click Create API token
  1. Enter:
    • Label: "Twig Integration"
    • Expires: Select date (recommended: 90 days)
  2. Click Create
  3. Copy token (format: 24-character alphanumeric)

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
  1. 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)
  2. Click Test Config

Expected result: "Connection successful, found X pages"

  1. Click Save
  1. 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 /dev/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.

Related Pages

Last updated January 26, 2026