How to create spaces with blueprints through the Confluence REST API
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
If you intend to automate the space creation process, using the REST API is one of the best options available. It is possible to use the space blueprints for that end as well, following the steps below:
Solution
Identify the ID of each blueprint with the following endpoint (GET request):
1
/rest/create-dialog/1.0/space-blueprint/list
Sample output below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
{ "id": "09da09e2-fa72-4ca5-9bd2-376b0684b5a9", "moduleCompleteKey": "com.atlassian.confluence.plugins.confluence-software-project:sp-space-blueprint", "i18nNameKey": "confluence.blueprints.space.sp.name", "pluginClone": true, "homePageId": "82844b99-7c5f-453b-a9d8-eb38b4e5ee45", "dialogWizard": { "key": "sp-space-blueprint-wizard", "pages": [ { "id": "spSpaceId", "templateKey": "Confluence.SpaceBlueprints.SoftwareProject.Dialog.dialogForm", "titleKey": "confluence.blueprints.space.sp.dialog.create.title", "descriptionHeaderKey": "confluence.blueprints.space.sp.dialog.create.heading", "descriptionContentKey": "confluence.blueprints.space.sp.dialog.create.description", "last": true } ] }, "promotedBps": [ "com.atlassian.confluence.plugins.confluence-software-blueprints:requirements-blueprint", "com.atlassian.confluence.plugins.confluence-business-blueprints:meeting-notes-blueprint", "com.atlassian.confluence.plugins.confluence-business-blueprints:file-list-blueprint", "com.atlassian.confluence.plugins.confluence-software-blueprints:decisions-blueprint", "com.atlassian.confluence.plugins.confluence-software-blueprints:retrospectives-blueprint", "com.atlassian.confluence.plugins.confluence-software-blueprints:jira-sprints-blueprint" ], "category": "software-project" }, { "id": "2aa2a279-c037-4f7e-9411-8ece0118991f", "moduleCompleteKey": "com.atlassian.confluence.plugins.confluence-knowledge-base:kb-blueprint", "i18nNameKey": "confluence.blueprints.space.kb.name", "pluginClone": true, "homePageId": "3ae99dee-e1bc-4132-bad6-661eef8ec318", "dialogWizard": { "key": "kb-space-wizard", "pages": [ { "id": "kbSpaceId", "templateKey": "Confluence.SpaceBlueprints.KnowledgeBase.dialogForm", "titleKey": "confluence.blueprints.space.kb.dialog.create.title", "descriptionHeaderKey": "confluence.blueprints.space.kb.dialog.create.heading", "descriptionContentKey": "confluence.blueprints.space.kb.dialog.create.description", "last": true } ] }, "promotedBps": [ "com.atlassian.confluence.plugins.confluence-knowledge-base:kb-how-to-article-blueprint", "com.atlassian.confluence.plugins.confluence-knowledge-base:kb-troubleshooting-article-blueprint" ], "category": "knowledge-bases" }, { "id": "fed341f3-271d-438f-9686-d32b114bab21", "moduleCompleteKey": "com.atlassian.confluence.plugins.confluence-space-blueprints:team-space-blueprint", "i18nNameKey": "confluence.blueprints.space.team.name", "pluginClone": true, "homePageId": "7a66ffe4-474f-4875-a3c5-ee79230ec2d6", "dialogWizard": { "key": "team-space-blueprint-wizard", "pages": [ { "id": "teamSpaceId", "templateKey": "Confluence.SpaceBlueprints.Team.dialogForm", "titleKey": "confluence.blueprints.space.team.dialog.create.title", "descriptionHeaderKey": "confluence.blueprints.space.team.dialog.create.heading", "descriptionContentKey": "confluence.blueprints.space.team.dialog.create.description", "last": true } ] }, "promotedBps": [ "com.atlassian.confluence.plugins.confluence-business-blueprints:file-list-blueprint", "com.atlassian.confluence.plugins.confluence-business-blueprints:meeting-notes-blueprint", "com.atlassian.confluence.plugins.confluence-business-blueprints:decisions-blueprint", "com.atlassian.confluence.plugins.confluence-business-blueprints:sharelinks-blueprint", "com.atlassian.confluence.plugins.confluence-create-content-plugin:create-blank-page", "com.atlassian.confluence.plugins.confluence-create-content-plugin:create-blog-post" ], "category": "teams" }, { "id": "75bebe01-dcdb-4641-94c1-1777e81f4cd4", "moduleCompleteKey": "com.atlassian.confluence.plugins.confluence-space-blueprints:documentation-space-blueprint", "i18nNameKey": "confluence.blueprints.space.documentation.name", "pluginClone": true, "homePageId": "1c0743ab-32e5-4347-832b-22c918c74f5e", "dialogWizard": { "key": "documentation-space-blueprint-wizard", "pages": [ { "id": "documentationSpaceId", "templateKey": "Confluence.SpaceBlueprints.Documentation.dialogForm", "titleKey": "confluence.blueprints.space.documentation.dialog.create.title", "descriptionHeaderKey": "confluence.blueprints.space.documentation.dialog.create.heading", "descriptionContentKey": "confluence.blueprints.space.documentation.dialog.create.description", "last": true } ] }, "promotedBps": [ "com.atlassian.confluence.plugins.confluence-create-content-plugin:create-blank-page" ], "category": "documentation" }, { "id": "d80c1ad2-cf23-4f8a-b524-92e9a8badd50", "moduleCompleteKey": "com.atlassian.confluence.plugins.confluence-create-content-plugin:create-blank-space-blueprint", "i18nNameKey": "Blank space Blueprint", "pluginClone": true, "dialogWizard": { "key": "blank-space-blueprint-wizard", "pages": [ { "id": "commonPage", "templateKey": "Confluence.Templates.Blueprints.CreateSpace.createSpaceForm", "titleKey": "create.content.plugin.create.blank.space.title", "descriptionHeaderKey": "create.content.plugin.create.blank.space.desc.header", "descriptionContentKey": "create.content.plugin.create.blank.space.desc.content", "last": true } ] }, "promotedBps": [] }, { "id": "61a7c137-68e5-4de8-8764-354d9506260b", "moduleCompleteKey": "com.atlassian.confluence.plugins.confluence-create-content-plugin:create-personal-space-blueprint", "i18nNameKey": "Personal space Blueprint", "pluginClone": true, "dialogWizard": { "key": "personal-space-blueprint-wizard", "pages": [ { "id": "personal-space", "templateKey": "Confluence.Templates.Blueprints.CreateSpace.createPersonalSpaceForm", "titleKey": "create.content.plugin.create.personal.space.title", "last": true } ] }, "promotedBps": [] }
Review the output of the first call and find the blueprint you would like to use
Take note of the id for that blueprint
Example for Personal space Blueprint based on the output above: 61a7c137-68e5-4de8-8764-354d9506260b
Build the BODY for the post request that will create the space, we need to set the spaceBlueprintId to the id noted on the previous step. Example:
1 2 3 4 5 6 7 8 9 10 11 12 13
{ "spaceKey":"PSPACE", "name":"Personal space from blueprint", "description":"", "spaceBlueprintId":"61a7c137-68e5-4de8-8764-354d9506260b", "context":{ "name":"team", "spaceKey":"TEAM", "members":"admin", "description":"describe the space", "ContentPageTitle":"team" } }
If you need integration with Jira, you can use this JSON to integrate with and Jira project:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
{ "spaceKey": "PSPACE", "name": "Personal space from blueprint", "description": "", "spaceBlueprintId": "61a7c137-68e5-4de8-8764-354d9506260b", "context": { "jira-server": "de8309d4-ca60-3cfe-93b3-af7d2b541ebe", "jira-project": "10100", "name": "Personal space from blueprint", "spaceKey": "PSPACE", "description": "", "noPageTitlePrefix": "true", "atl_token": "undefined", "jira-server-id": "de8309d4-ca60-3cfe-93b3-af7d2b541ebe", "project-key": "Jira project key", "project-name": "Jira project name", "ContentPageTitle": "team" } }
Values for "jira-project" is projectid, which can be retrieved from URL in Project Settings > Description on Jira side, and "jira-server" value can be retrieved from browser URL when editing application link from Confluence.
Run a POST request to the following endpoint and the body from step 4:
1
/rest/create-dialog/1.0/space-blueprint/create-space
The output should look like this:
1 2 3 4 5 6
{ "key": "PSPACE", "name": "Personal space from blueprint", "description": "", "url": "http://localhost:8090/display/PSPACE" }
Notes
Please notice that each instance will have its own IDs for the blueprints. This is why we need to list them before executing the create request.
Was this helpful?