Connect Confluence to let an Agent search spaces, read pages, work with comments, and — when permitted — create or update pages and attachments.
Agent Barn stores the Atlassian API token as an encrypted Agent Secret, and creates an aai-cli profile named confluence-work when the Agent starts.
Connection model
- Atlassian account
- API token
- Encrypted Agent Secret
- confluence-work profile
- Confluence Cloud
The credential authenticates the Agent. The Confluence Skill supplies the aai-cli workflows the Agent runs against it.
Before you begin
You need:
- A Confluence Cloud site
- An Atlassian account with Confluence product access
- Permission to create an Atlassian API token
- The base Confluence site URL
- The email address associated with the token
- Access to configure the Agent
agent.updateandagent.secret.managepermissions- Lifecycle permission when connecting a running Agent
Decide whether the Agent needs read-only space and page access, page creation or editing, page comments, attachment downloads, or attachment uploads.
Use a dedicated Atlassian account or service identity when possible.
Understand the credential fields
| Field | Purpose |
|---|---|
| Site URL | Identifies the Atlassian Cloud tenant |
| Authentication type | Selects scoped or non-scoped token routing |
| Atlassian account associated with the token | |
| API token | Authenticates the account |
| Cloud ID | Resolved and stored internally for scoped tokens |
Use the base Atlassian site URL:
https://example.atlassian.netDo not enter a wiki route or REST path:
https://example.atlassian.net/wiki
https://example.atlassian.net/wiki/rest/apiAgent Barn adds the Confluence API paths.
Choose an authentication type
Agent Barn supports scoped and non-scoped Atlassian API tokens. Both use Basic authentication with the account email and token.
Non-scoped token
A standard Atlassian account API token, accessing Confluence through the site.
https://example.atlassian.net/wiki/...Choose this for standard direct-site API access.
Scoped token
Accesses Confluence through Atlassian’s API Gateway using the resolved Cloud ID.
https://api.atlassian.com/ex/confluence/{cloud_id}/wiki/...Choose this when the token must use Atlassian’s API Gateway.
How Cloud ID resolution works
For scoped credentials, Agent Barn requests tenant metadata from the site and uses the returned Cloud ID to build the runtime API gateway URL.
- Confluence site The base Atlassian site URL saved with the credential
- /_edge/tenant_info Agent Barn requests the site’s tenant metadata
- Cloud ID Stored with the encrypted credential
- api.atlassian.com/ex/confluence/{cloud_id} The gateway host used by scoped tokens at runtime
Plan Confluence permissions
Grant only the permissions required by the Agent’s workflow.
| Agent workflow | Common Confluence requirement |
|---|---|
| List spaces | Confluence product access and visibility of the space |
| Read pages | View permission for the space and page |
| Read comments | View access to the page |
| Add comments | Add Comments permission |
| Create pages | Add Pages permission in the space |
| Update pages | Permission to edit the page |
| List or download attachments | View access to the page and attachment |
| Upload attachments | Add Attachments permission |
| Delete content | Corresponding delete permission |
Page-level restrictions can further reduce access inside an otherwise visible space. Start with view access, and add write permissions only for documented workflows.
Create the API token
Using the intended Atlassian account:
- Open the account’s security settings.
- Go to API token management.
- Create the appropriate scoped or non-scoped token.
- Give it a descriptive name, such as
Agent Barn — Knowledge Agent. - Set an expiration or rotation plan when available.
- Copy the token.
- Record which authentication type it uses.
Prepare the Confluence account
Before connecting:
- Confirm that the account can access the Confluence site.
- Confirm that it has Confluence product access.
- Open each intended space.
- Verify page visibility.
- Review space permissions.
- Review page-level restrictions.
- Remove access to unrelated spaces where possible.
- Test one read-only action using the account.
The API token inherits the account’s effective Confluence access.
Connect Confluence in Agent Barn
- Stop the Agent, or begin the web interface’s restart-aware edit flow.
- Open the Agent.
- Go to Configuration.
- Select Keys & integrations.
- Select Edit.
- Add Confluence under Integration credentials.
- Choose Enter credentials.
- Enter the base Atlassian site URL.
- Select Scoped token or Non-scoped token.
- Enter the account email.
- Paste the API token.
- Apply the configuration.
- Restart the Agent if it was running.
- Validate the credential.
- Test space and page access.
The token is hidden after it is saved.
Use a Shared Confluence Credential
Confluence is supported by Organization Shared Credentials. To attach one:
- Open the Agent’s integration configuration.
- Select Confluence.
- Choose Use shared credential.
- Select the named Confluence credential.
- Apply the configuration.
- Restart the Agent.
- Validate and test the connection.
Assign the Confluence Skill
The credential supplies authentication. The Confluence Skill gives the Agent detailed aai-cli instructions.
If the active Template requires Confluence:
- Open the Agent’s Skills configuration.
- Confirm that the Confluence Skill is assigned.
- Confirm its pinned version.
- Save the configuration.
- Start the Agent.
An explicit Template requirement must be satisfied by an explicit Skill assignment.
Validate the credential
- Open Keys & integrations.
- Find Confluence.
- Select Validate.
- Review the returned identity or service-account summary.
- Resolve authentication errors.
- Continue with space-level testing.
Validate a non-scoped credential
For a non-scoped token, Agent Barn requests:
https://example.atlassian.net/wiki/rest/api/user/currentValidation confirms that the site is reachable, the email and token authenticate, the account has Confluence product access, authentication was not treated as anonymous, and the connected identity is available.
{
"validation_status": "valid",
"validation_identity": "Knowledge Agent ([email protected])",
"validation_error": null,
"missing_scopes": []
}Validate a scoped credential
Scoped tokens cannot use the legacy current-user endpoint used for non-scoped identity validation. Agent Barn instead requests:
https://api.atlassian.com/ex/confluence/{cloud_id}/wiki/api/v2/spacesAny successful response confirms that the scoped token can authenticate through the gateway. The identity is reported as a service-account-style site summary:
Service account (example.atlassian.net) · 3 space(s) accessibleThe count reflects the first returned result set, and should be treated as a connectivity summary rather than a complete access audit.
Verify access
Verify space access
List the Confluence spaces available to the connected account.aai-cli confluence spaces list \
--limit 20 \
--profile confluence-workTo check a known space:
aai-cli confluence spaces get DOCS \
--profile confluence-workReview the results for missing intended spaces and unexpected access.
Verify page listing and reads
aai-cli confluence pages list \
--space DOCS \
--status current \
--limit 10 \
--profile confluence-workUsing a specific space key reduces the chance of exposing unrelated content during verification.
Read a known non-sensitive page:
aai-cli confluence pages get 3964929 \
--profile confluence-workConfluence page operations use numeric page IDs. Confirm that the Agent can see the expected body and metadata without accessing restricted pages.
Verify comments
aai-cli confluence pages comments list 3964929 \
--limit 10 \
--profile confluence-workTo test comment creation on a designated page:
aai-cli confluence pages comments create 3964929 \
--body "Agent Barn integration verification." \
--profile confluence-workDo not test writes against production documentation without approval.
Verify attachments
aai-cli confluence pages attachments list 3964929 \
--limit 10 \
--profile confluence-workDownload a known non-sensitive attachment:
aai-cli confluence pages attachments download \
3964929 \
att3997705 \
--output local/logs/confluence-verification.txt \
--profile confluence-workAttachment upload requires separate write permission, and should be tested only on a designated page.
Verify page creation or editing
For an Agent intended to write pages, use a test space.
aai-cli confluence pages create \
--space-key DOCS \
--title "Agent Barn integration verification" \
--body "Temporary verification page." \
--profile confluence-workaai-cli confluence pages update 3964929 \
--title "Agent Barn integration verification — updated" \
--body "Updated verification content." \
--profile confluence-workClean up temporary content after the test.
Runtime behavior
When the Agent starts, Agent Barn:
- Decrypts the Confluence credential.
- Resolves the Cloud ID for scoped tokens when needed.
- Stores the API token in the runtime secret store.
- Creates the
confluence-workprofile. - Mounts eligible Confluence Skill instructions.
- Adds the site URL and account email to the integration context.
For a non-scoped token:
[profiles.confluence-work]
auth_type = "basic_api_token"
site_url = "https://example.atlassian.net"
email = "[email protected]"
api_token_secret = "confluence.api_token"For a scoped token, the profile uses the Atlassian gateway host with the resolved Cloud ID.
Scoped-token save behavior
When a scoped credential is saved, Agent Barn attempts to resolve and store its Cloud ID. If discovery temporarily fails, the credential may be saved without a Cloud ID, and runtime profile generation then skips the Confluence profile.
If validation reports a Cloud ID error:
- Confirm the base site URL.
- Confirm that the site is reachable from Agent Barn.
- Save the complete credential again.
- Validate it.
- Restart the Agent.
Rotate the token
- Create a replacement token in Atlassian.
- Record whether it is scoped or non-scoped.
- Stop the Agent, or begin a restart-aware edit.
- Open Keys & integrations.
- Enter the complete replacement Confluence credential.
- Re-enter the site URL, authentication type, and email.
- Apply and restart.
- Validate the credential.
- Test space and page access.
- Revoke the old token.
Stored credential values cannot be retrieved or partially edited.
Change the Confluence account
- Prepare a token for the replacement Atlassian account.
- Confirm its product, space, and page access.
- Replace the complete credential.
- Apply and restart.
- Validate the identity.
- Test intended spaces and pages.
- Revoke the old token when appropriate.
The replacement account may have different page restrictions, even when it belongs to the same spaces.
Remove Confluence access
- Stop the Agent, or begin a restart-aware edit.
- Identify any assigned Skill requiring
confluence. - Remove or replace the Skill when permitted.
- Open Keys & integrations.
- Select Remove for Confluence.
- Apply the configuration.
- Restart the Agent.
- Confirm that Confluence is unavailable.
- Revoke the token in Atlassian.
Agent Barn rejects removal while a remaining assigned Skill requires Confluence.
API reference
Add a non-scoped Confluence credential
The Agent must be stopped.
PATCH /api/v1/organizations/{organization_id}/agents/{agent_id}
Content-Type: application/json{
"secrets": [
{
"provider": "confluence",
"content": {
"site_url": "https://example.atlassian.net",
"use_scoped_token": false,
"email": "[email protected]",
"api_token": "REDACTED"
}
}
]
}Add a scoped Confluence credential
{
"secrets": [
{
"provider": "confluence",
"content": {
"site_url": "https://example.atlassian.net",
"use_scoped_token": true,
"email": "[email protected]",
"api_token": "REDACTED"
}
}
]
}Do not submit cloud_id. Agent Barn resolves it internally. Every token value in these examples is redacted — supply your own.
Attach a Shared Confluence Credential
{
"shared_credentials": [
{
"shared_credential_id": "3fd08cf5-59c5-494b-9449-a0413109a0ca"
}
]
}Validate Confluence
POST /api/v1/organizations/{organization_id}/agents/{agent_id}/integrations/confluence/validateValidation requires agent.secret.manage.
Remove Confluence
{
"removed_secret_providers": [
"confluence"
]
}Troubleshooting
Validation says “Invalid email or API token”
Check the pair and the token type
Check that:
- The email belongs to the token’s Atlassian account
- The token was copied completely
- The correct authentication type is selected
- The token has not expired or been revoked
- The site URL identifies the correct Atlassian tenant
Validation says the account has no Confluence product access
Product access is separate
Grant Confluence product access to the account, or connect another account.
Validation says authentication was not accepted
The request was treated as anonymous
The non-scoped endpoint treated the request as anonymous.
Check the email, token, authentication type, and site URL.
Agent Barn cannot resolve the Cloud ID
Use the base site URL
Use the base site URL:
https://example.atlassian.netDo not include /wiki or a REST API path. Save and validate the scoped credential again.
Runtime logs say cloud_id missing
Saved before discovery succeeded
Re-enter and save the complete scoped credential, validate it, and restart the Agent.
Validation succeeds, but an intended space is missing
Space visibility is separate
The account likely lacks space visibility or product access to that space.
Review the space permissions and account membership.
A space is visible, but a page returns 404 or 403
Page restrictions override visibility
Page restrictions can override general space visibility.
Grant the account access to that page or its restricted ancestor only when appropriate.
Pages can be read, but comments fail
Add Comments is separate
The account may lack Add Comments permission in that space.
Pages can be read, but creation or updates fail
Add Pages and edit restrictions
Review Add Pages permission, page edit restrictions, and the parent page’s restrictions.
Attachment listing works, but upload fails
Add Attachments is separate
The account may lack Add Attachments permission.
Scoped validation shows fewer spaces than expected
The count is a connectivity summary
The displayed count is a summary of the returned v2 result page, not a full permission audit.
Run spaces list through the Agent and test each intended space.
A Shared Credential conflicts with a manual Confluence token
One source per provider
An Agent can use only one Confluence credential source.
Remove the manual credential before attaching the Shared Credential, or replace the Shared attachment with a manual credential.
Confluence was connected but the Agent cannot use it
Restart, Skill, profile, or permissions
Check that:
- The Agent restarted after saving
- The Confluence Skill is assigned when required
- The expected Skill version is pinned
- The
confluence-workprofile was generated - Validation succeeds
- The account can access the intended spaces and pages
- Startup logs do not report a missing Cloud ID
Recommended practices
- Use a dedicated Atlassian identity for production Agents
- Restrict the account to intended spaces
- Review page-level restrictions
- Begin with view-only access
- Add comment, page, and attachment permissions separately
- Use different credentials for Agents with different knowledge boundaries
- Select the correct scoped-token setting
- Validate every scoped credential
- Test space access before page access
- Test reads before writes
- Use a designated test space for verification
- Rotate tokens on a documented schedule
- Revoke old and unused tokens
- Never place Confluence tokens in Templates, Skills, prompts, or conversations
- Review space permissions when an Agent’s responsibilities change
Next steps
Continue to Connect Bitbucket to configure repository access with an appropriately scoped Bitbucket token.