Bulk add labels to Confluence cloud via REST API

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

When to use this article

This article may be used any time there is a need to bulk add labels to the Confluence Cloud site.

Prepare data

  1. Postman installed on your computer Download Postman | Get Started for Free

  2. Confluence Cloud instance

  3. Site admin user

  4. API Token generated on https://id.atlassian.com/manage-profile/security/api-tokens for the site admin user in the step above

  5. Space list CSV file generated on Governator by using the query below.

DB query to pull contentids

1 select contentid from content where content_type = 'page' and prevver is not null

Set up Postman

This section may be skipped if:

  • Download the files below on your computer.

Add labels to space.postman_environment.json

Bulk Add label.json

Bulk Add label.json

Postman Collection Run

  • Import them to Postman.

  • Select environment variables.

    • Click on the environment drop-down button on the top right corner of Postman.

    • Select Add labels to space from the list.

  • Set environment variables.

    1. Click on the Environment quick look button on the top right corner of Postman

    2. Click on the Edit button

    3. Fill out the Current Value column with the information below.

      1. site-name → If your site address is mysite.atlassian.com type mysite

      2. username → Email address that you created API Token with.

      3. api-token Token that you created on https://id.atlassian.com/manage-profile/security/api-tokens

      4. limit Do not change this value.

      5. subject-type If you would like to grant a user on all spaces type user, or type group if you would like to grant a group.

      6. subject-identifier If you would like to grant a user type their email address or the name of the group.

    4. Click on the Save button.

  • Click on the View More Actions button next to the Bulk add labels project and select Run collection

  • Make sure the Add label script is checked.

  • Optional: In order to view logs generated during the run, you can click on the Console button on the left bottom side of the Postman.

  • Select the contentid list file generated as explained in the Requirements.

    1. Click on the Select File button.

    2. Select the CSV file that includes the space list.

    3. Click on the Run Add labels to space in Bulk button.

    4. Once it completes running, the Stop Run button should disappear.

Please find the attached video for reference:

References

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.