Skip to main content

Create Space

createSpace mutation is used to create a new space. It takes CreateSpaceInput as an input.

mutation {
createSpace(input: {
name: "New Space"
}) {
id
}
}

This will create a new space with the name "New Space" inside the default collection.

Create a space inside a collectionโ€‹

You can pass the id of the collection to create the space inside it. Let's first create a collection.

mutation {
createCollection(input: {name: "Get Started"}) {
id
}
}

The response will contain the id of the collection.

{
"data": {
"createCollection": {
"id": "cj9zfkqj"
}
}
}

Then you can use the collectionId to create the space inside the collection.

mutation {
createSpace(input: {
name: "Say Hello"
collectionId: "cj9zfkqj"
}) {
id
}
}

This will create a space with the name "Say Hello" inside the collection "Get Started".

Create a space with an emoji as imageโ€‹

You can also create a space with an emoji as image. You need to create an emoji first and then use the id of the emoji as imageId.

mutation {
createEmojis(input: [{text: "+1"}]) {
id
}
}
mutation {
createSpace(input: {
name: "Say Hello"
collectionId: "cj9zfkqj"
imageId: ":+1:"
}) {
id
}
}

This will create a space with a Thumbs Up emoji (๐Ÿ‘) as image.

Create a space with an imageโ€‹

To create a space with an image first you need to upload an image. And then you can use the id of the image as imageId.

mutation {
createSpace(input: {
name: "Say Hello"
collectionId: "cj9zfkqj"
imageId: "sDJnsABrHAqd"
}) {
id
}
}