> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-opensw-1772748614-696205f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Confluence integration

> Integrate with the Confluence document loader using LangChain JavaScript.

<Tip>
  **Compatibility**

  Only available on Node.js.
</Tip>

This covers how to load document objects from pages in a Confluence space.

## Credentials

* You'll need to set up an access token and provide it along with your confluence username in order to authenticate the request
* You'll also need the `space key` for the space containing the pages to load as documents. This can be found in the url when navigating to your space e.g. `https://example.atlassian.net/wiki/spaces/{SPACE_KEY}`
* And you'll need to install `html-to-text` to parse the pages into plain text

```bash npm theme={null}
npm install @langchain/community @langchain/core html-to-text
```

## Usage

```typescript theme={null}
import { ConfluencePagesLoader } from "@langchain/community/document_loaders/web/confluence";

const username = process.env.CONFLUENCE_USERNAME;
const accessToken = process.env.CONFLUENCE_ACCESS_TOKEN;
const personalAccessToken = process.env.CONFLUENCE_PAT;

if (username && accessToken) {
  const loader = new ConfluencePagesLoader({
    baseUrl: "https://example.atlassian.net/wiki",
    spaceKey: "~EXAMPLE362906de5d343d49dcdbae5dEXAMPLE",
    username,
    accessToken,
  });

  const documents = await loader.load();
  console.log(documents);
} else if (personalAccessToken) {
  const loader = new ConfluencePagesLoader({
    baseUrl: "https://example.atlassian.net/wiki",
    spaceKey: "~EXAMPLE362906de5d343d49dcdbae5dEXAMPLE",
    personalAccessToken,
  });
  const documents = await loader.load();
  console.log(documents);
} else {
  console.log(
    "You need either a username and access token, or a personal access token (PAT), to use this example."
  );
}
```

***

<div className="source-links">
  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/javascript/integrations/document_loaders/web_loaders/confluence.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
