How to post a story

For this, because the input is quite large, it is easier to do it in two parts: the query containing the mutation and the variables.

graphql
mutation storyPostExample($input: StoryPostInput!) {
storyPost(input: $input) {
story {
id
version {
title
}
}
}
}
variables
{
"input": {
"publish": true,
"spaceId": "SPACE_ID",
"title": "My awesome content!",
"body": {
"format": "HTML",
"markup": "<h1>Hello World</h1><p>Lorem Ipsum...</p>"
}
}
}

Here spaceId represents a GraphQL id of a Space. If you only have its slug, you can find the graphql ID the same way you get a story in the "How to get a Story" by changing story in the query by space.

Setting spaceId to null will post the story in the user's Personal Content ✨

Expected return:

response
{
"data": {
"story": {
"id": "TWU6MTIz",
"title": "My awesome content!"
}
}
}

Was this page helpful?