# Confluence

> Create, read, update, and search Confluence Cloud pages and spaces using the Confluence REST API v2.

Source: https://cotera.co/docs/reference/tools/individual-tools/confluence

---

**Authentication Type:** API Key (Basic Auth)
**Description:** Create, read, update, and search Confluence Cloud pages and spaces using the Confluence REST API v2.

***

## Authentication

To authenticate, you'll need your Atlassian account credentials:

1. Go to [Atlassian API Tokens](https://id.atlassian.com/manage-profile/security/api-tokens) and create a new API token
2. Note your Atlassian account email address
3. Note your Confluence domain (e.g., `yourcompany` from `yourcompany.atlassian.net`)

You'll need to provide:

* **email**: Your Atlassian account email
* **apiToken**: Your Atlassian API token
* **domain**: Your Confluence domain (e.g., `yourcompany`)

***

## Pages

Operations for managing Confluence pages.

### Create Page

Create a new page in a Confluence space. Supports creating top-level pages or child pages under an existing parent.

**Operation Type:** Mutation (Write)

**Parameters:**

* **spaceId** `string` (required): The ID of the space to create the page in
* **title** `string` (required): The title of the page
* **body** `string` (required): The body content of the page in Confluence storage format (HTML)
* **parentId** `string` (nullable): Optional parent page ID to create as a child page

**Returns:**

* **pageId** `string`: The ID of the created page
* **title** `string`: The title of the created page
* **url** `string`: The web URL of the created page
* **spaceId** `string`: The space ID the page was created in

**Example Usage:**

```json
{
  "spaceId": "65539",
  "title": "Q1 2024 Project Plan",
  "body": "<h1>Project Plan</h1><p>This document outlines the goals and milestones for Q1 2024.</p>",
  "parentId": null
}
```

### Get Page

Retrieve a Confluence page by ID with its full content, version information, and metadata.

**Operation Type:** Query (Read)

**Parameters:**

* **pageId** `string` (required): The ID of the page to retrieve

**Returns:**

* **pageId** `string`: The page ID
* **title** `string`: The page title
* **body** `string`: The page body in storage format (HTML)
* **version** `number`: The current version number
* **spaceId** `string`: The space ID
* **status** `string`: The page status
* **createdAt** `string`: Created timestamp
* **lastModified** `string`: Last modified timestamp

**Example Usage:**

```json
{
  "pageId": "98304"
}
```

### Update Page

Update an existing Confluence page with new title and content. Requires the current version number to prevent conflicting edits.

**Operation Type:** Mutation (Write)

**Parameters:**

* **pageId** `string` (required): The ID of the page to update
* **title** `string` (required): The new title of the page
* **body** `string` (required): The new body content in Confluence storage format (HTML)
* **version** `number` (required): The new version number (must be current version + 1)
* **versionMessage** `string` (nullable): Optional message describing the update

**Returns:**

* **pageId** `string`: The page ID
* **title** `string`: The updated title
* **version** `number`: The new version number
* **url** `string`: The web URL of the page
* **lastModified** `string`: Last modified timestamp

**Example Usage:**

```json
{
  "pageId": "98304",
  "title": "Q1 2024 Project Plan - Updated",
  "body": "<h1>Project Plan</h1><p>Updated with final milestones and deliverables.</p>",
  "version": 3,
  "versionMessage": "Added final milestones"
}
```

### List Children

List child pages of a Confluence page with pagination support.

**Operation Type:** Query (Read)

**Parameters:**

* **pageId** `string` (required): The ID of the parent page
* **limit** `number` (nullable): Maximum number of children to return (default 25)
* **cursor** `string` (nullable): Cursor for pagination

**Returns:**

* **children** `array of objects`: List of child pages
  * **pageId** `string`: The child page ID
  * **title** `string`: The child page title
  * **status** `string`: The child page status
* **nextCursor** `string` (nullable): Cursor for the next page of results

**Example Usage:**

```json
{
  "pageId": "98304",
  "limit": 10,
  "cursor": null
}
```

***

## Spaces

Operations for listing and browsing Confluence spaces.

### List Spaces

List available Confluence spaces with optional filtering by type and status.

**Operation Type:** Query (Read)

**Parameters:**

* **limit** `number` (nullable): Maximum number of spaces to return (default 25, max 250)
* **cursor** `string` (nullable): Cursor for pagination
* **type** `string` (nullable): Filter by space type: "global" or "personal"
* **status** `string` (nullable): Filter by status: "current" or "archived"

**Returns:**

* **spaces** `array of objects`: List of spaces
  * **spaceId** `string`: The space ID
  * **name** `string`: The space name
  * **key** `string`: The space key
  * **type** `string`: The space type
  * **status** `string`: The space status
* **nextCursor** `string` (nullable): Cursor for the next page of results

**Example Usage:**

```json
{
  "limit": 25,
  "cursor": null,
  "type": "global",
  "status": "current"
}
```

***

## Search

Search operations for finding pages across Confluence.

### Search Pages

Search for Confluence pages using Confluence Query Language (CQL). Supports full-text search, space filtering, and label queries.

**Operation Type:** Query (Read)

**Parameters:**

* **cql** `string` (required): Confluence Query Language (CQL) query string. Example: `type=page AND space=MYSPACE AND title~"search term"`
* **limit** `number` (nullable): Maximum number of results to return (default 25)
* **start** `number` (nullable): Offset for pagination (default 0)

**Returns:**

* **results** `array of objects`: Search results
  * **pageId** `string`: The page ID
  * **title** `string`: The page title
  * **url** `string`: The web URL of the page
  * **spaceKey** `string`: The space key
  * **excerpt** `string` (nullable): Search result excerpt
* **totalSize** `number`: Total number of matching results
* **start** `number`: The start offset of these results

**Example Usage:**

```json
{
  "cql": "type=page AND space=ENG AND title~\"project plan\"",
  "limit": 10,
  "start": 0
}
```

***

## Common Use Cases

**Knowledge Base Management:**

* Create and organize documentation pages within team spaces
* Search across all Confluence content using CQL to find relevant documentation
* Update pages with versioned edits and descriptive change messages
* List child pages to navigate documentation hierarchies

**Project Documentation:**

* Create project pages with structured HTML content for plans, specs, and reports
* Update existing pages as projects evolve while maintaining version history
* Organize project documentation under parent pages using the child page structure
* Search for project-related content across multiple spaces

**Content Migration & Automation:**

* Programmatically create pages from external data sources or templates
* Bulk update page content across spaces for standardization
* List and audit spaces to manage organizational knowledge structure
* Search and extract content for reporting or cross-platform synchronization

**Team Collaboration:**

* List available spaces to discover team wikis and project areas
* Retrieve page content for integration with other tools and workflows
* Create meeting notes and action item pages automatically
* Navigate page hierarchies to understand content organization

