Skip to content

Examples: Export/Import a story (JSON)

Export a story without any parameters.

curl "https://mapi.storyblok.com/v1/spaces/88751/stories/64181051491446/export.json" \
-H "Authorization: YOUR_OAUTH_TOKEN"
Example response
{
"a5a68c3e-876d-4d5e-b08f-e000efafe41d:feature:name": "Hallo!",
"ffa153ea-8f63-467f-b370-65d5dd3d710f:paragraph:@richtext:richtext/content[0:paragraph].content[0].text": "\"Hark, what light through yonder editor breaks?\" Just our AI generating your next very epic storyline. ",
"ffa153ea-8f63-467f-b370-65d5dd3d710f:paragraph:@richtext:richtext/content[0:paragraph].content[2].text": " Speed up asset creation and balance gameplay, all with a few clicks. Give your small studio big-story power. #indiegamedev #ai #gamedevelopment",
"d31919a3-a807-4274-9820-0bf87f7ba03c:page:text": "Blog Posts",
"page": "623949938",
"language": "default",
"url": "home",
"text_nodes": 0
}

Export a specific language version of a story. Use export_lang=true to export the translated values for the specified lang_code. If export_lang is false or omitted, the default language values will be exported.

curl "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/export.json\
?lang_code=sw\
&export_lang=true" \
-H "Authorization: YOUR_OAUTH_TOKEN"
Example response with translated content
{
"ffa153ea-8f63-467f-b370-65d5dd3d710f:paragraph:@richtext:richtext/content[0:paragraph].content[0].text": "Kaj se sveti v tvojem editorju? Naša UI, ki ti generira naslednjo epsko zgodbo. Pospeši izdelavo assetov in zbalansiraj gameplay z le nekaj kliki. Daj svojemu malemu studiu moč velike zgodbe. #indiegamedev #ai #gamedevelopment",
"d31919a3-a807-4274-9820-0bf87f7ba03c:page:text": "swahili text",
"page": "623949938",
"language": "sw",
"url": "home",
"text_nodes": 0
}

Previous version of the export API endpoint

Section titled “Previous version of the export API endpoint”

In the current version (version 2), rich text is flattened into path-based keys with plain-text values. Set version=1 to use the previous version of this API endpoint, which returns rich text as a stringified JSON string.

curl "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/export.json\
?lang_code=pt-br\
&export_lang=true\
&version=1" \
-H "Authorization: YOUR_OAUTH_TOKEN"
Example Version 1 response
{
"ffa153ea-8f63-467f-b370-65d5dd3d710f:paragraph:@richtext:richtext": "{\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"text\":\"Kaj se sveti v tvojem editorju? Naša UI, ki ti generira naslednjo epsko zgodbo. Pospeši izdelavo assetov in zbalansiraj gameplay z le nekaj kliki. Daj svojemu malemu studiu moč velike zgodbe. #indiegamedev #ai #gamedevelopment\",\"type\":\"text\"}]}]}",
"d31919a3-a807-4274-9820-0bf87f7ba03c:page:text": "swahili text",
"page": "623949938",
"language": "sw",
"url": "home",
"text_nodes": 0
}

Import a story by sending data as a stringified JSON object with the structure documented in the Export a Story (JSON) endpoint.

curl "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/import.json" \
-X PUT \
-H "Authorization: YOUR_OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"data\":\"{\\"a5a68c3e-876d-4d5e-b08f-e000efafe41d:feature:name\\":\\"HiHallo\\",\\"d31919a3-a807-4274-9820-0bf87f7ba03c:page:text\\":\\"Blog Posts\\",\\"ffa153ea-8f63-467f-b370-65d5dd3d710f:paragraph:@richtext:richtext/content[0:paragraph].content[0].text\\":\\"\\\\"Hark, what light through yonder editor breaks?\\\\" Just our AI generating your next very epic storyline. \\",\\"ffa153ea-8f63-467f-b370-65d5dd3d710f:paragraph:@richtext:richtext/content[0:paragraph].content[2].text\\":\\"Speed up asset creation and balance gameplay, all with a few clicks. Give your small studio big-story power. #indiegamedev #ai #gamedevelopment\\",\\"language\\":\\"default\\",\\"page\\":\\"314931981\\",\\"text_nodes\\":0,\\"url\\":\\"home\\"}\"}"

Import translated content for a specific language using the lang_code and import_lang parameters.

curl "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/import.json\
?lang_code=es\
&import_lang=true" \
-X PUT \
-H "Authorization: YOUR_OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"data\":\"{\\"59ea90a7-c548-4d96-ae11-3d4ed40a5176:dp_richtext:richtext:content/content[0].content[0].text\\":\\"Translated content\\",\\"language\\":\\"es\\",\\"page\\":\\"314931981\\",\\"text_nodes\\":1,\\"url\\":\\"home\\"}\"}"

Previous version of the import API endpoint

Section titled “Previous version of the import API endpoint”

With version=1, the request body must be valid JSON with a single key data. The value of data must be a stringified v1 exported object.

curl "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/import.json\
?version=1" \
-X PUT \
-H "Authorization: YOUR_OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"data\":\"{\\"a5a68c3e-876d-4d5e-b08f-e000efafe41d:feature:name\\":\\"Hallo! Release\\",\\"ffa153ea-8f63-467f-b370-65d5dd3d710f:paragraph:@richtext:richtext\\":\\"{\\\\"type\\\\":\\\\"doc\\\\",\\\\"content\\\\":[{\\\\"type\\\\":\\\\"paragraph\\\\",\\\\"attrs\\\\":{\\\\"textAlign\\\\":null},\\\\"content\\\\":[{\\\\"text\\\\":\\\\"\\\\\\\\"Hark, what light through yonder editor breaks?\\\\\\\\" Just our AI generating your next very epic storyline. \\\\",\\\\"type\\\\":\\\\"text\\\\"},{\\\\"type\\\\":\\\\"emoji\\\\",\\\\"attrs\\\\":{\\\\"name\\\\":\\\\"wink\\\\",\\\\"emoji\\\\":\\\\"😉\\\\",\\\\"fallbackImage\\\\":\\\\"https://cdn.jsdelivr.net/npm/emoji-datasource-apple/img/apple/64/1f609.png\\\\"}},{\\\\"text\\\\":\\\\" Speed up asset creation and balance gameplay, all with a few clicks. Give your small studio big-story power. #indiegamedev #ai #gamedevelopment2\\\\",\\\\"type\\\\":\\\\"text\\\\"}]}]}\\",\\"d31919a3-a807-4274-9820-0bf87f7ba03c:page:text\\":\\"Blog Posts\\",\\"page\\":\\"623949938\\",\\"language\\":\\"default\\",\\"url\\":\\"home\\",\\"text_nodes\\":0}\"}"

Was this page helpful?

What went wrong?

This site uses reCAPTCHA and Google's Privacy Policy (opens in a new window) . Terms of Service (opens in a new window) apply.