You're visiting the Confluence Knowledge Base. Visit the Confluence Knowledge Base Home for an overview.

Skip to end of metadata
Go to start of metadata

See How to copy or rename a space in Confluence.

Help us improve!

Is this article helpful?
Is it well written?
Is the content complete?


  1. Here is a different approach:

    1. Create a space backup of the space just to have a backup
    2. Create a new space with the new key
    3. Edit and delete the home page that was automatically created in the new space
    4. Edit the old space's home page
    5. Edit the location field to specify the new space
    6. (warning) Make sure the move children box is checked
    7. Save

    This moves the home page and all children to the new space. For us, this is normally all the pages in the space since we always try to have everything as children of the home page. If you have a few pages that are not in the home hierarchy, then follow similar procedures for each one. If you have a lot of these pages or you just need to organize them into your hierarchy better, using TimTam drag and drop might be easier.

    1. (thumbs down) Bad idea. If the space contains pages that the admin cannot see, these pages will be deleted. (sad)

      Please vote for this issue: 

      1. As I don't believe there will ever be a change by Atlassian (it's to easy to work around) I have to comment on this for our descendants (smile):

        If you are Admin you can remove page restrictions -  even from pages not visible to yourself.

        See Page Restrictions#Viewingallrestrictedpagesinaspace


    2. Anonymous

  2. Anonymous

    What if the space key is numeric?

  3. Anonymous

    I think it is really lame one cannot change a space key.

    I wanted to set up a specs-space and spent a day or two trying out the possibilities of Confluence. I'm quite happy with those but now I cannot 'formalize' my space by giving it a meaningful key (instead of TEST). It seems the only way to change the key is to do all the work over again, because moving pages keeps resulting in an error!

    1. Hi,

      Sorry to hear that you are experiencing this issue. And I am afraid that this feature is not currently available. But there is already a feature request here which has not been resolved yet. Please feel free to add yourself as a watcher, vote for this feature and add your own comments to this request. For further details on how we include new features and improvements, you might want to read this page.

      Meanwhile I would suggest you to do the workaround as instructed here


      1. Hello,

        Where is the workaround page? I get page not found.



        1. Hi Chad, the page Husein is referencing is the old version of the one linked on this page (How to Copy or Rename a Space in Confluence).

  4. You can change the space key by using this macro (I call it setspacekey) on any page in the space (even preview works to apply the new key):

    ## no body
    ## generate wiki markup
    ## usage: {setspacekey: newkey}
    #if ($param0)
       ## trim and test for illegal characters
       #set ($newkey = $param0.trim())
       #if ( $newkey.matches("[a-zA-Z0-9]+") )
          Space key set to $newkey
          You should now rebuild the content index.
          Space key not set: {color:red} The new key  "$newkey" has characters other than a-z, A-Z, 0-9. {color}

    Once you've used the macro and changed the space key, remove it from the page.

    1. Does this usermacro take care of reindexing and relinking of whole content?

      A spacekey is a mandatory entry in every single index entry. I wonder if just changing a spacekey forces confluence to reindex and relink all content?


      1. You're quite correct.  This macro does not force a rebuild of the index.  You should rebuild the content index after any key change.



        1. I will use your user-macro if I am able to do an reindex and if I dont care of all the links within all pages and I use the secure way

          1. of creating a new space

          2. changing the home page name of this new space

          3. and just move the old home pagetree to the new space

          4. and by the end delting the whole old space which is now empty.

          I get all reindexed except those links which are inside macro bodies as confluence missed their major/mandatory feature to relink automatically if a page got moved.


    2. This code doesn't work on latest Confluence since they changed some bits. I have updated the Macro. This seems to be extremely helpful, thanks Ed!

      For who may be interested: you can add the macro in your Confluence Admin under User Macros (

      1. Hello Zsolt,

        Will this macro approach work to permanently rename (with a follow up re-indexing of the databases) on Confluence 5.2.5? Are there any concerns if there is a linked JIRA with the same key that is going to be renamed I should know about, or any gotchas?

        1. Tested in 5.5.2, and still works. However, all links into that space become broken, even with a re-index.

      2. Hey Zsolt Kocsmarszky,

        Your macro has been a life saver for us for the past 2 years however we can't seem to get it working since we upgraded to Confluence 5.8.4. Do you have any plans to update the macro?

  5. Anonymous

    Hi, I followed the instructions above to move all pages from one space to another (the method of moving the home page)

    Everything seems to have worked well, all the pages are there, however the navigation tree on the left side does not appear. I see it flash "Loading" very quickly, then it disappears. Otherwise if I go in hierarchy view, all the pages are there and properly ordered in the tree.

    Using Confluence 4.0.4

    Any clues?

  6. Anonymous

    Set your own life time more simple take the loans and everything you require.
  7. Anonymous

    @Ed Bacher


    I don't understand how to use your makro inside the WYSIWYG Editor of Confluence 4.2.

    If i enter it into the Wiki-Markup Box nothing seems to happen.




  8. Hi.

    I'm writing plug-in in Java and i would like to get spaceKey. I use class which extends ConfluenceActionSupport. Can i get spaceKey using class like this one ?


  9. That new macro worked like a charm.  Put it in the User Macros area (default settings/no rendering) then inserted it into the space, supplied the parameter during the insert macro stage (prompts you) and wa la.  New space key.  Thank you!

    We are on Confluence 4.3.7

  10. Confirmed: Zsolt Kocsmarszky's macro seems to have worked like a charm for me (with Confluence 5.5.1).

    Keving Murphy's tutorial only lacks the fact that once that you have validated the new key name in the prompt, it inserts itself in the page (I put it at the top page of the space's hierarchy). Save the page, then re-edit the page to remove the macro: done!


  11. Hi, what happen with the attachments of a space where I changed the Space key. In our Confluence the attachments are stored on a separate file server.


    Best Regards