Confluence replacement variables
When you run a sequence of actions using run
, runFromList
, runFromSql
, runFromCsv
, or any client-specific run action, you may need to reference information generated by earlier steps. Replacement variables allow you to dynamically reuse values—such as issue keys, page IDs, or usernames—across actions.
This guide explains how to use these variables, how the reference
parameter helps retain values for later use, and what variables are available for different clients.
How variable replacement works
Before an action runs, the CLI replaces any variable placeholders in the format @<variable>@
with their corresponding values. For example, in a runFromList
action, @entry@
refers to the current list item.
jira --action runFromList --list PROJECTA,PROJECTB --common '--action getProject --project @entry@'
In client-specific scripts, replacement variables are often populated by actions that return specific data. For example:
jira --action runFromProjectList --common '--action getProject --project @project@'
Many create or get actions automatically set variables that you can use in subsequent commands. Some actions also support the reference
parameter, which lets you persist a value and reuse it later—even after another action would otherwise overwrite it. This is useful when linking issues or managing multi-step operations.
Syntax and behavior
Replacement variables use the format:
@<variable>@
Variable names are case-sensitive
The CLI only replaces variables within the scope of the same
run
block or a parentrun
blockEach
runFromList
action maintains its own variable scopeUse
getReplacementVariableList
to view available variables during executionUse
setReplacementVariableList
to define custom replacement variablesDo not confuse replacement variables with substitution variables—they use different syntax and behavior
Confluence variables
The following variables are available when working with Confluence CLI actions:
Variable | Description | Available Since |
---|---|---|
| Last created or referenced page ID (numeric) | — |
| URL of the last created or referenced page | — |
| Last created blog ID (numeric) | — |
| URL of the last created or referenced blog | — |
| Last referenced content ID (numeric) | 5.3 |
| URL of the last referenced content | — |
| ID of the last referenced container (numeric) | 9.2 |
| Last created or referenced space key | — |
| Last created or referenced space name | 5.2 |
| URL of the last created or referenced space | 8.4 |
| Last referenced content title | — |
| Name of the last created or referenced attachment | — |
| ID (numeric) of the last created or referenced attachment | — |
| URL of the last created or referenced attachment | 8.4 |
| ID of the last created or referenced user | 5.7, 9.0 |
| Key of the last created or referenced user | 8.6, 9.0 |
| Display name of the last referenced user | 9.0 |
| Title of the last created or referenced question | — |
| ID (numeric) of the last created or referenced question | — |
| Name of the last created or referenced topic | — |
| ID (numeric) of the last created or referenced topic | — |
| Converted content from the last | — |
| Page source content from the last | 6.3 |
| Comment ID from | 6.6 |
| Last referenced group name | 6.9 |
| Name of the last created or referenced shortcut | 7.0 |
| Numeric ID of the last created or referenced shortcut | 7.0 |
| URL of the last referenced shortcut | 8.4 |
| Name of the last referenced application link | 8.7 |
| ID of the last referenced application link | 7.7 |
| URL of the last referenced application link | 8.7 |
Common client variables
These variables are available across most CLI clients and scripts.
Variable | Description | Available Since |
---|---|---|
| Entry from the | — |
| Entry from the | — |
| Last result from the | — |
| Server URL for the remote Atlassian application | 9.0 |
| Hosting type ( | 9.3 |
| Product version from | 9.3 |
| Timestamp when the | 9.0 |
| File path for the most recent | 9.3 |
| File size (in bytes) from the most recent file-related action | 9.3 |
| File content from the last file-related action (for files < 10MB) | 9.3 |
Example usage
Here’s how you might use replacement variables in a script:
jira --action runFromList --list JIRACLI-101,JIRACLI-102 --common "--action getIssue --issue @entry@"
Or, to create a page and then use its ID:
confluence --action addPage --space DOC --title "Release Notes" --content "Version 9.0 released"
confluence --action addLabel --id @pageId@ --labels "release-9.0"