# How can I create a confluence space using an api?

**URL:** <https://community.developer.atlassian.com/t/how-can-i-create-a-confluence-space-using-an-api/45076>\
**Category:** Confluence Cloud\
**Created:** [February 8, 2021, 10:18pm UTC](https://community.developer.atlassian.com/t/how-can-i-create-a-confluence-space-using-an-api/45076 "2021-02-08T22:18:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanielTobon](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@DanielTobon](https://community.developer.atlassian.com/u/DanielTobon)\
**Post date:** [February 8, 2021, 10:18pm UTC](https://community.developer.atlassian.com/t/how-can-i-create-a-confluence-space-using-an-api/45076/1 "2021-02-08T22:18:35Z")

</div>

and tried to create a confluence space using an Api: [https://orosreto.atlassian.net/wiki/rest/api/space](https://orosreto.atlassian.net/wiki/rest/api/space)  
but I always get an error this is the json body

‘{  
“key”: “”,  
“name”: “”,  
“description”: {  
“plain”: {  
“value”: “”,  
“representation”: “”  
}  
},  
“permissions”: [  
{  
“subjects”: {  
“user”: {  
“results”: [  
{  
“type”: “known”,  
“username”: “”,  
“userKey”: “”,  
“accountId”: “”,  
“accountType”: “atlassian”,  
“email”: “”,  
“publicName”: “”,  
“profilePicture”: {  
“path”: “”,  
“width”: 2154,  
“height”: 2154,  
“isDefault”: true  
},  
“displayName”: “”,  
“operations”: [  
{  
“operation”: “administer”,  
“targetType”: “application”  
}  
],  
“details”: {},  
“personalSpace”: {  
“id”: 2154,  
“key”: “”,  
“name”: “”,  
“type”: “”,  
“status”: “”,  
“\_expandable”: {},  
“\_links”: {}  
},  
“\_expandable”: {  
“operations”: “”,  
“details”: “”,  
“personalSpace”: “”  
},  
“\_links”: {}  
}  
],  
“size”: 2154  
},  
“group”: {  
“results”: [  
{  
“type”: “group”,  
“name”: “”,  
“id”: “”,  
“\_links”: {}  
}  
],  
“size”: 2154  
},  
“\_expandable”: {  
“user”: “”,  
“group”: “”  
}  
},  
“operation”: {  
“operation”: “administer”,  
“targetType”: “application”  
},  
“anonymousAccess”: true,  
“unlicensedAccess”: true  
}  
]  
}’

---

<div class="post-metadata">

**Author:** ![mpaisley](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/mpaisley/32/54538_2.png) [@mpaisley](https://community.developer.atlassian.com/u/mpaisley)\
**Post date:** [February 9, 2021, 3:42am UTC](https://community.developer.atlassian.com/t/how-can-i-create-a-confluence-space-using-an-api/45076/2 "2021-02-09T03:42:21Z")

</div>

Hi @DanielTobon ,  
Can you share the error you’re getting - it’ll help to understand the problem.  
Cheers,  
Melissa

---

<div class="post-metadata">

**Author:** ![DanielTobon](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@DanielTobon](https://community.developer.atlassian.com/u/DanielTobon)\
**Post date:** [February 9, 2021, 7:12pm UTC](https://community.developer.atlassian.com/t/how-can-i-create-a-confluence-space-using-an-api/45076/3 "2021-02-09T19:12:14Z")

</div>

Hello @mpaisley  
I was checking the body and it is using a curl format, and I’m looking for the body in JSON format to create a confluence space, could you help me with it since I can’t find it anywhere.

---

<div class="post-metadata">

**Author:** ![mpaisley](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/mpaisley/32/54538_2.png) [@mpaisley](https://community.developer.atlassian.com/u/mpaisley)\
**Post date:** [February 10, 2021, 6:29am UTC](https://community.developer.atlassian.com/t/how-can-i-create-a-confluence-space-using-an-api/45076/4 "2021-02-10T06:29:41Z")

</div>

Hey @DanielTobon,  
The Rest API docs have examples of the body in a range of different formats - see [https://developer.atlassian.com/cloud/confluence/rest/api-group-space/#api-api-space-post](https://developer.atlassian.com/cloud/confluence/rest/api-group-space/#api-api-space-post)  
In the cURL example, the JSON body is sent as **–data**  
hope that helps.  
Mel

---

<div class="post-metadata">

**Author:** ![mpaisley](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/mpaisley/32/54538_2.png) [@mpaisley](https://community.developer.atlassian.com/u/mpaisley)\
**Post date:** [February 10, 2021, 6:53am UTC](https://community.developer.atlassian.com/t/how-can-i-create-a-confluence-space-using-an-api/45076/5 "2021-02-10T06:53:00Z")

</div>

So for me, I created this one using POSTMAN:

```auto
POST /wiki/rest/api/space HTTP/1.1
Host: <MYURL>.atlassian.net
Authorization: Basic <OMITTED> 
Accept: application/json
Content-Type: application/json
Cache-Control: no-cache

{ "key": "APITEST3", "name": "Test Space 3", "description": { "plain": { "value": "a test space", "representation": "plain" } } }

```

In my example, the permissions are set based on the default ones specified in my Confluence instance. The rest docs i linked above go into much more detail about how to set the permissions for the space you’re creating.
