Skip to content
Guide
Index
Integrations
Data Sources

Confluence Data Source

Guide to configuring Confluence as a data source in LlamaCloud, including UI, API, client setup, and OAuth 2.0 token creation.

Load data from Confluence

Confluence

from llama_cloud.types.data_source_create_params import (
CloudConfluenceDataSource,
)
data_source = client.data_sources.create(
name="my-data-source",
component=CloudConfluenceDataSource(
server_url='<server_url>',
user_name='<user_name>',
api_token='<api_token>',
space_key='<space_key>', # optional
page_ids='<page_ids>', # optional
cql='<cql>', # optional
label='<label>', # optional
),
source_type="CONFLUENCE",
project_id="my-project-id",
)

Instances without a functional search index

Section titled “Instances without a functional search index”

By default, the pages in a space are enumerated through Confluence’s CQL search API (rest/api/content/search), which depends on the instance’s search index. On Confluence Server/Data Center instances where the search index is unavailable or disabled, credential validation succeeds but syncs fetch zero pages, because CQL silently returns no results.

For those instances, set the deployment-level configuration DEFAULT_CONFLUENCE_V2_SOURCE_SEARCH_METHOD=content_api (default: cql). Pages are then listed through the database-backed content API (rest/api/content) instead. This is an environment/self-hosting setting rather than a per–data source option, and it applies to space_key sources only — the cql and label filters are always served by the search API.

A step-by-step guide to creating an OAuth 2.0 token and using it to fetch data from a Confluence space. It includes instructions on setting up an OAuth 2.0 app in the Atlassian Developer Console, obtaining an access token, and making API requests using the token.

  1. An Atlassian account.
  2. Access to the Atlassian Developer Console.
  3. Basic knowledge of OAuth 2.0 and API requests.
  4. A Confluence account with the necessary permissions.
  1. Go to the Atlassian Developer Console.
  2. Log in with your Atlassian account.
  3. Click on your profile icon in the top-right corner and select Developer console.
  4. Click on Create app.
  5. Enter the app name and click Create.
  6. In your app’s settings, go to Authorization in the left menu.
  7. Next to OAuth 2.0 (3LO), click Configure https://auth.atlassian.com/oauth/token.
  8. Enter the Callback URL (this is the URL that will handle the OAuth callback).
  9. Click Save changes.
  10. Go to Permissions in the left menu.
  11. Next to the Confluence API, click Add.
  12. Select the necessary scopes (e.g., read:confluence-space.summary).

3. Implementing OAuth 2.0 (3LO) in Your App

Section titled “3. Implementing OAuth 2.0 (3LO) in Your App”
  1. Direct the User to the Authorization URL:
https://auth.atlassian.com/authorize?audience=api.atlassian.com&client_id=YOUR_CLIENT_ID&scope=read:confluence-space.summary&redirect_uri=YOUR_APP_CALLBACK_URL&state=YOUR_USER_BOUND_VALUE&response_type=code&prompt=consent
  1. Replace the placeholders with the appropriate values:

    1. YOUR_CLIENT_ID: The client ID of your app.
    2. YOUR_APP_CALLBACK_URL: The callback URL configured in your app settings.
    3. YOUR_USER_BOUND_VALUE: A unique value to maintain state between the request and callback.
  2. Exchange the Authorization Code for an Access Token:

    Once the user grants access, they will be redirected to your callback URL with an authorization code. Use this code to obtain an access token:

    curl --request POST \
    --url 'https://auth.atlassian.com/oauth/token' \
    --header 'Content-Type: application/json' \
    --data '{
    "grant_type": "authorization_code",
    "client_id": "YOUR_CLIENT_ID",
    "client_secret": "YOUR_CLIENT_SECRET",
    "code": "YOUR_AUTHORIZATION_CODE",
    "redirect_uri": "YOUR_APP_CALLBACK_URL"
    }'

    Replace the placeholders with the appropriate values:

    1. YOUR_CLIENT_ID: The client ID of your app.
    2. YOUR_CLIENT_SECRET: The client secret of your app.
    3. YOUR_AUTHORIZATION_CODE: The authorization code received from the callback.
    4. YOUR_APP_CALLBACK_URL: The callback URL configured in your app settings.
  1. Get the Cloud ID: Use the access token to get the cloud ID for your Confluence site:

    curl --request GET \
    --url 'https://api.atlassian.com/oauth/token/accessible-resources' \
    --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
    --header 'Accept: application/json'

    Replace YOUR_ACCESS_TOKEN with the actual access token received in the previous step.

  2. Read the Space: Use the cloud ID and access token to make a request to read the space:

    curl --request GET \
    --url 'https://api.atlassian.com/ex/confluence/CLOUD_ID/rest/api/space' \
    --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
    --header 'Accept: application/json'

User Inputs: Replace the placeholders with the appropriate values:•

  1. CLOUD_ID : The cloud ID of your Confluence site.
  2. YOUR_ACCESS_TOKEN : The actual access token received in the previous step.
Note for AI agents: this documentation is built for programmatic access. - Overview of all docs: https://developers.llamaindex.ai/llms.txt - Any page is available as raw Markdown by appending index.md to its URL — e.g. https://developers.llamaindex.ai/llamaparse/parse/getting_started/index.md - Agent-friendly REST search APIs live under https://developers.llamaindex.ai/api/ — search (BM25 full-text), grep (regex), read (fetch a page), and list (browse the doc tree). See https://developers.llamaindex.ai/llms.txt for parameters. - A hosted documentation MCP server is available at https://developers.llamaindex.ai/mcp. If you support MCP, you can ask the user to install it for browsing these docs directly (an alternative to the REST API). Setup: https://developers.llamaindex.ai/python/shared/mcp/