{"id":12991,"library":"confluence-api","title":"Confluence API Wrapper for Node.js","description":"The `confluence-api` package provides a Node.js wrapper for interacting with Atlassian's Confluence REST API. It simplifies common operations such as content retrieval by ID or page title, creating and updating content, managing attachments, labels, and performing searches within Confluence. The current stable version is `1.4.0`. Releases tend to be feature-driven or for dependency maintenance, with no strict time-based cadence, but show active development. This library differentiates itself by offering a straightforward, callback-based interface for Confluence API access, supporting basic HTTP authentication, and including specific configuration options for compatibility with older Confluence instances, such as version 4, via a `version` parameter in its configuration object. It's suitable for backend Node.js applications needing to programmatically manage Confluence content.","status":"active","version":"1.4.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/johnpduane/confluence-api","tags":["javascript","atlassian","confluence","api","wiki","node.js"],"install":[{"cmd":"npm install confluence-api","lang":"bash","label":"npm"},{"cmd":"yarn add confluence-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add confluence-api","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used as the underlying HTTP client for making requests to the Confluence API.","package":"superagent","optional":false}],"imports":[{"note":"This library is primarily a CommonJS module. While ES module syntax might work with bundlers or Node.js's interop features, the intended and documented usage is CommonJS 'require()'.","wrong":"import Confluence from 'confluence-api';","symbol":"Confluence","correct":"const Confluence = require('confluence-api');"}],"quickstart":{"code":"const Confluence = require('confluence-api');\n\nconst config = {\n    username: process.env.CONFLUENCE_USERNAME ?? 'your-confluence-username',\n    password: process.env.CONFLUENCE_PASSWORD ?? 'your-confluence-api-token-or-password',\n    baseUrl:  process.env.CONFLUENCE_BASE_URL ?? 'https://your-instance.atlassian.net/wiki',\n    version: parseInt(process.env.CONFLUENCE_VERSION ?? '0', 10) || undefined // Optional: Set to 4 for Confluence v4, otherwise omit or leave undefined for latest.\n};\n\nconst confluence = new Confluence(config);\n\nconsole.log('Attempting to fetch content by page title...');\nconfluence.getContentByPageTitle('my-space-key', 'My Page Title', function(err, data) {\n    if (err) {\n        console.error('Error fetching content:', err);\n        // Handle specific error codes or messages from Confluence API\n        return;\n    }\n\n    // Check if data and results exist before accessing\n    if (data && data.results && data.results.length > 0) {\n        console.log('Successfully fetched content. Stored markup for the first page:');\n        console.log(data.results[0].body.storage.value);\n    } else {\n        console.log('No content found for the specified space and title.');\n    }\n});","lang":"javascript","description":"This quickstart initializes the Confluence API client and demonstrates fetching content by space key and page title. It uses environment variables for sensitive credentials."},"warnings":[{"fix":"Upgrade to `confluence-api@1.4.0` or later to ensure the patched `superagent` version is used. Run `npm install confluence-api@latest`.","message":"Version 1.4.0 upgraded the `superagent` dependency to address a reported security vulnerability. Using versions prior to `1.4.0` may expose your application to this vulnerability.","severity":"gotcha","affected_versions":"<1.4.0"},{"fix":"If connecting to Confluence v4, ensure your configuration includes `version: 4`, e.g., `{ baseUrl: '...', username: '...', password: '...', version: 4 }`.","message":"When targeting older Confluence instances, specifically Confluence v4, you must explicitly set the `version` property in the configuration object to `4` for correct API compatibility.","severity":"gotcha","affected_versions":">=1.0.5"},{"fix":"Generate a Confluence REST API token from your Atlassian account settings and use it in place of your user password in the `password` field of the configuration object.","message":"While the library supports direct password authentication, Atlassian recommends using REST API tokens for basic authentication, especially in cloud instances, due to enhanced security and revocability.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Verify that your `username`, `password` (or API token), and `baseUrl` in the configuration object are absolutely correct and that the user has the necessary permissions to access the Confluence instance.","cause":"Incorrect username, password (or API token), or `baseUrl` for your Confluence instance.","error":"Error: Request failed with status code 401 (Unauthorized) or 'Authentication failed'"},{"fix":"Double-check the existence and exact spelling of `space`, `title`, `id`, or `attachmentId` parameters used in your API calls against your Confluence instance.","cause":"The specified space key, page title, content ID, or attachment ID does not exist or is inaccessible at the provided `baseUrl`.","error":"Error: Request failed with status code 404 (Not Found) or 'Content not found'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}