Import a Story
Importing a story can be done using a PUT request for each story you want to import.
https://mapi.storyblok.com/v1/spaces/:space_id/stories/:story_id/import.json
Importing stories is available exclusively on the Business plan and higher. Please refer to Storyblok's Pricing for further information.
Path Parameters
-
:space_id
required numberNumeric ID of a space
-
:story_id
required numberThe numeric id of story
Query Parameters
-
lang_code
stringA language code
-
import_lang
booleanIt shows to import language code or not.
Request Body Properties
-
story
The Story ObjectA single story object
-
name
required stringThe complete name provided for the story
-
parent_id
numberID of the parent folder
-
group_id
stringGroup ID (UUID string), shared between stories defined as alternates
-
sort_by_date
stringDate defined in the story's entry configuration (Format:
YYYY-mm-dd
) -
tag_list
string[]Array of tag names
-
is_folder
booleantrue
if the instance constitutes a folder -
content
objectAn object containing the field data associated with the specific story type's specific content structure. Also includes a
component
property with the story type's technical name. -
slug
required stringThe slug specific for the story
-
path
stringValue of the real path defined in the story's entry configuration (usually, this value is only required for Storyblok's Visual Editor)
-
default_root
stringComponent name which will be used as default content type for this folders entries
-
disable_fe_editor
booleanIs side by side editor disabled for all entries in folder
-
is_startpage
booleantrue
if the story is defined as root for the folder -
meta_data
objectObject to store non-editable data that is exclusively maintained with the Management API
-
pinned
booleanTo pin the story in the toolbar
-
first_published_at
stringFirst publishing date (Format:
yyyy-MM-dd'T'HH:mm:ssZ
) -
position
numberNumeric representation of the story's position in the folder
-
Response Properties
-
story
The Story ObjectA single story object
-
id
numberNumeric id of the story
-
name
stringThe complete name provided for the story
-
parent_id
numberID of the parent folder
-
group_id
stringGroup ID (UUID string), shared between stories defined as alternates
-
alternates
object[]An array containing objects that provide basic data of the stories defined as alternates of the current story
-
id
numberThe numeric ID
-
name
stringThe complete name provided for the story
-
slug
stringThe slug specific for the story
-
published
booleantrue
if a story has been published at least once (even if it is currently in draft) -
full_slug
stringThe full slug of the story, combining the parent folder(s) and the designated story slug
-
is_folder
booleantrue
if the instance constitutes a folder
-
-
created_at
stringCreation date (Format:
yyyy-MM-dd'T'HH:mm:ssZ
) -
deleted_at
stringDeleted date (Format: YYYY-mm-dd HH:MM)
-
sort_by_date
stringDate defined in the story's entry configuration (Format:
YYYY-mm-dd
) -
tag_list
string[]Array of tag names
-
updated_at
stringLatest update date (Format:
yyyy-MM-dd'T'HH:mm:ssZ
) -
published_at
stringLatest publishing date (Format:
yyyy-MM-dd'T'HH:mm:ssZ
) -
uuid
stringGenerated UUID string
-
is_folder
booleantrue
if the instance constitutes a folder -
content
objectAn object containing the field data associated with the specific story type's specific content structure. Also includes a
component
property with the story type's technical name. -
published
booleantrue
if a story has been published at least once (even if it is currently in draft) -
slug
stringThe slug specific for the story
-
path
stringValue of the real path defined in the story's entry configuration (usually, this value is only required for Storyblok's Visual Editor)
-
full_slug
stringThe full slug of the story, combining the parent folder(s) and the designated story slug
-
default_root
stringComponent name which will be used as default content type for this folders entries
-
disable_fe_editor
booleanIs side by side editor disabled for all entries in folder
-
parent
objectEssential parent information as object (resolved from
parent_id
) -
is_startpage
booleantrue
if the story is defined as root for the folder -
unpublished_changes
booleanStory has unpublished changes; saved but not published
-
meta_data
objectObject to store non-editable data that is exclusively maintained with the Management API
-
imported_at
stringLatest import date (Format: YYYY-mm-dd HH:MM)
-
preview_token
objectPreview token
-
token
stringThe token passed to the editor as preview parameter to allow edit mode verification
-
timestamp
stringTimestamp passed to the editor as preview parameter to allow edit mode verification
-
-
pinned
booleanTo pin the story in the toolbar
-
breadcrumbs
object[]Array of resolved subset of link objects (one per path segment / parent)
-
id
numberStory ID
-
name
stringThe complete name provided for the story
-
parent_id
numberID of the parent folder
-
disable_fe_editor
booleanIs side by side editor disabled for all entries in folder
-
path
stringValue of the real path defined in the story's entry configuration (usually, this value is only required for Storyblok's Visual Editor)
-
slug
stringThe slug specific for the story
-
translated_slugs
object[]Array of translated slug objects (if the app Translatable Slugs is installed)
-
-
first_published_at
stringFirst publishing date (Format:
yyyy-MM-dd'T'HH:mm:ssZ
) -
last_author
objectLast author
-
id
numberLast author user object numeric id
-
userid
stringLast author userid/username
-
friendly_name
stringFriendly name of last author
-
-
last_author_id
numberId of the last Author
-
translated_slugs
object[]Array of translated slug objects (if the app Translatable Slugs is installed)
-
story_id
numberID of the story
-
lang
stringLanguage code of the current language (can be requested with the
language
API parameter) -
slug
stringThe slug specific for the story
-
name
stringThe complete name provided for the story
-
published
booleantrue
if a story has been published at least once (even if it is currently in draft)
-
-
localized_paths
object[]An array of translated path objects
-
path
stringValue of the real path defined in the story's entry configuration (usually, this value is only required for Storyblok's Visual Editor)
-
name
stringThe complete name provided for the story
-
lang
stringLanguage code of the current language (can be requested with the
language
API parameter) -
published
booleantrue
if a story has been published at least once (even if it is currently in draft)
-
-
position
numberNumeric representation of the story's position in the folder
-
release_id
numberID of the current release (can be requested with the
from_release
API parameter) -
scheduled_dates
stringScheduled publishing date (Format: YYYY-mm-dd HH:MM)
-
favourite_for_user_ids
number[]Array of user IDs who have added the story in their favorites
-
Example Request with lang_code
and import_lang
curl "https://mapi.storyblok.com/v1/spaces/233027/stories/314931981/import.json?lang_code=pt-br&import_lang=true" \
-X PUT \
-H "Authorization: YOUR_OAUTH_TOKEN" \
-H "Content-Type: multipart/form-data" \
-d "{story: {\"name\": \"Home\",\"parent_id\": 0,\"group_id\": \"fb33b858-277f-4690-81fb-e0a080bd39ac\",\"alternates\": [],\"created_at\": \"2023-05-29T09:53:40.231Z\",\"deleted_at\": null,\"sort_by_date\": null,\"tag_list\": [],\"updated_at\": \"2024-02-08T11:26:42.514Z\",\"published_at\": \"2023-08-30T09:16:42.066Z\",\"id\": 314931981,\"uuid\": \"2497c493-168a-443f-bbb1-ccfd6340d319\",\"is_folder\": false,\"content\": {\"_uid\": \"98cccd01-f807-4494-996d-c6b0de2045a5\",\"component\": \"your_content_type\"// and fields you define yourself are in here},\"published\": true,\"slug\": \"home\",\"path\": null,\"full_slug\": \"home\",\"default_root\": null,\"disble_fe_editor\": false,\"parent\": null,\"is_startpage\": false,\"unpublished_changes\": true,\"meta_data\": null,\"imported_at\": \"2024-02-08T11:26:42.505Z\",\"preview_token\": {token: \"279395174a25be38b702f9ec90d08a960e1a5a84\",timestamp: \"1545530576\"},\"pinned\": false,\"breadcrumbs\": [],\"publish_at\": null,\"expire_at\": null,\"first_published_at\": \"2023-06-06T08:47:05.426Z\",\"last_author\": {\"id\": 39821,\"userid\": \"storyblok\",\"friendly_name\": \"Storyblok\"},\"user_ids\": [12345],\"space_role_ids\": [],\"translated_slugs\": [{}],\"localized_paths\": [{}],\"position\": 0,\"translated_stories\": [],\"can_not_view\": null,\"is_scheduled\": null,\"scheduled_dates\": null,\"favourite_for_user_ids\": []}}"
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.put('/spaces/233027/stories/314931981/import.json', {
story: {
"name": "Home",
"parent_id": 0,
"group_id": "fb33b858-277f-4690-81fb-e0a080bd39ac",
"alternates": [],
"created_at": "2023-05-29T09:53:40.231Z",
"deleted_at": null,
"sort_by_date": null,
"tag_list": [],
"updated_at": "2024-02-08T11:26:42.514Z",
"published_at": "2023-08-30T09:16:42.066Z",
"id": 314931981,
"uuid": "2497c493-168a-443f-bbb1-ccfd6340d319",
"is_folder": false,
"content": {
"_uid": "98cccd01-f807-4494-996d-c6b0de2045a5",
"component": "your_content_type"
// and fields you define yourself are in here
},
"published": true,
"slug": "home",
"path": null,
"full_slug": "home",
"default_root": null,
"disble_fe_editor": false,
"parent": null,
"is_startpage": false,
"unpublished_changes": true,
"meta_data": null,
"imported_at": "2024-02-08T11:26:42.505Z",
"preview_token": {
token: "279395174a25be38b702f9ec90d08a960e1a5a84",
timestamp: "1545530576"
},
"pinned": false,
"breadcrumbs": [],
"publish_at": null,
"expire_at": null,
"first_published_at": "2023-06-06T08:47:05.426Z",
"last_author": {
"id": 39821,
"userid": "storyblok",
"friendly_name": "Storyblok"
},
"user_ids": [
12345
],
"space_role_ids": [],
"translated_slugs": [{}],
"localized_paths": [{}],
"position": 0,
"translated_stories": [],
"can_not_view": null,
"is_scheduled": null,
"scheduled_dates": null,
"favourite_for_user_ids": []
}
})
.then(response => {
console.log(response)
}).catch(error => {
console.log(error)
})
$client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
$payload = [
story => [
"name" => "Home",
"parent_id" => 0,
"group_id" => "fb33b858-277f-4690-81fb-e0a080bd39ac",
"alternates" => [],
"created_at" => "2023-05-29T09 => 53 => 40.231Z",
"deleted_at" => null,
"sort_by_date" => null,
"tag_list" => [],
"updated_at" => "2024-02-08T11 => 26 => 42.514Z",
"published_at" => "2023-08-30T09 => 16 => 42.066Z",
"id" => 314931981,
"uuid" => "2497c493-168a-443f-bbb1-ccfd6340d319",
"is_folder" => false,
"content" => [
"_uid" => "98cccd01-f807-4494-996d-c6b0de2045a5",
"component" => "your_content_type"
// and fields you define yourself are in here
],
"published" => true,
"slug" => "home",
"path" => null,
"full_slug" => "home",
"default_root" => null,
"disble_fe_editor" => false,
"parent" => null,
"is_startpage" => false,
"unpublished_changes" => true,
"meta_data" => null,
"imported_at" => "2024-02-08T11 => 26 => 42.505Z",
"preview_token" => [
token => "279395174a25be38b702f9ec90d08a960e1a5a84",
timestamp => "1545530576"
],
"pinned" => false,
"breadcrumbs" => [],
"publish_at" => null,
"expire_at" => null,
"first_published_at" => "2023-06-06T08 => 47 => 05.426Z",
"last_author" => [
"id" => 39821,
"userid" => "storyblok",
"friendly_name" => "Storyblok"
],
"user_ids" => [
12345
],
"space_role_ids" => [],
"translated_slugs" => [[]],
"localized_paths" => [[]],
"position" => 0,
"translated_stories" => [],
"can_not_view" => null,
"is_scheduled" => null,
"scheduled_dates" => null,
"favourite_for_user_ids" => []
]
];
$client->put('/spaces/233027/stories/314931981/import.json', $payload)->getBody();
require 'storyblok'
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
payload = {
story => {
"name" => "Home",
"parent_id" => 0,
"group_id" => "fb33b858-277f-4690-81fb-e0a080bd39ac",
"alternates" => [],
"created_at" => "2023-05-29T09 => 53 => 40.231Z",
"deleted_at" => null,
"sort_by_date" => null,
"tag_list" => [],
"updated_at" => "2024-02-08T11 => 26 => 42.514Z",
"published_at" => "2023-08-30T09 => 16 => 42.066Z",
"id" => 314931981,
"uuid" => "2497c493-168a-443f-bbb1-ccfd6340d319",
"is_folder" => false,
"content" => {
"_uid" => "98cccd01-f807-4494-996d-c6b0de2045a5",
"component" => "your_content_type"
// and fields you define yourself are in here
},
"published" => true,
"slug" => "home",
"path" => null,
"full_slug" => "home",
"default_root" => null,
"disble_fe_editor" => false,
"parent" => null,
"is_startpage" => false,
"unpublished_changes" => true,
"meta_data" => null,
"imported_at" => "2024-02-08T11 => 26 => 42.505Z",
"preview_token" => {
token => "279395174a25be38b702f9ec90d08a960e1a5a84",
timestamp => "1545530576"
},
"pinned" => false,
"breadcrumbs" => [],
"publish_at" => null,
"expire_at" => null,
"first_published_at" => "2023-06-06T08 => 47 => 05.426Z",
"last_author" => {
"id" => 39821,
"userid" => "storyblok",
"friendly_name" => "Storyblok"
},
"user_ids" => [
12345
],
"space_role_ids" => [],
"translated_slugs" => [{}],
"localized_paths" => [{}],
"position" => 0,
"translated_stories" => [],
"can_not_view" => null,
"is_scheduled" => null,
"scheduled_dates" => null,
"favourite_for_user_ids" => []
}
}
client.put('/spaces/233027/stories/314931981/import.json', payload)
HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/233027/stories/314931981/import.json?lang_code=pt-br&import_lang=true")
.header("Content-Type", "multipart/form-data")
.header("Authorization", "YOUR_OAUTH_TOKEN")
.body("{story: {\"name\": \"Home\",\"parent_id\": 0,\"group_id\": \"fb33b858-277f-4690-81fb-e0a080bd39ac\",\"alternates\": [],\"created_at\": \"2023-05-29T09:53:40.231Z\",\"deleted_at\": null,\"sort_by_date\": null,\"tag_list\": [],\"updated_at\": \"2024-02-08T11:26:42.514Z\",\"published_at\": \"2023-08-30T09:16:42.066Z\",\"id\": 314931981,\"uuid\": \"2497c493-168a-443f-bbb1-ccfd6340d319\",\"is_folder\": false,\"content\": {\"_uid\": \"98cccd01-f807-4494-996d-c6b0de2045a5\",\"component\": \"your_content_type\"// and fields you define yourself are in here},\"published\": true,\"slug\": \"home\",\"path\": null,\"full_slug\": \"home\",\"default_root\": null,\"disble_fe_editor\": false,\"parent\": null,\"is_startpage\": false,\"unpublished_changes\": true,\"meta_data\": null,\"imported_at\": \"2024-02-08T11:26:42.505Z\",\"preview_token\": {token: \"279395174a25be38b702f9ec90d08a960e1a5a84\",timestamp: \"1545530576\"},\"pinned\": false,\"breadcrumbs\": [],\"publish_at\": null,\"expire_at\": null,\"first_published_at\": \"2023-06-06T08:47:05.426Z\",\"last_author\": {\"id\": 39821,\"userid\": \"storyblok\",\"friendly_name\": \"Storyblok\"},\"user_ids\": [12345],\"space_role_ids\": [],\"translated_slugs\": [{}],\"localized_paths\": [{}],\"position\": 0,\"translated_stories\": [],\"can_not_view\": null,\"is_scheduled\": null,\"scheduled_dates\": null,\"favourite_for_user_ids\": []}}")
.asString();
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/233027/stories/314931981/import.json?lang_code=pt-br&import_lang=true");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "multipart/form-data");
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
request.AddParameter("multipart/form-data", "{story: {\"name\": \"Home\",\"parent_id\": 0,\"group_id\": \"fb33b858-277f-4690-81fb-e0a080bd39ac\",\"alternates\": [],\"created_at\": \"2023-05-29T09:53:40.231Z\",\"deleted_at\": null,\"sort_by_date\": null,\"tag_list\": [],\"updated_at\": \"2024-02-08T11:26:42.514Z\",\"published_at\": \"2023-08-30T09:16:42.066Z\",\"id\": 314931981,\"uuid\": \"2497c493-168a-443f-bbb1-ccfd6340d319\",\"is_folder\": false,\"content\": {\"_uid\": \"98cccd01-f807-4494-996d-c6b0de2045a5\",\"component\": \"your_content_type\"// and fields you define yourself are in here},\"published\": true,\"slug\": \"home\",\"path\": null,\"full_slug\": \"home\",\"default_root\": null,\"disble_fe_editor\": false,\"parent\": null,\"is_startpage\": false,\"unpublished_changes\": true,\"meta_data\": null,\"imported_at\": \"2024-02-08T11:26:42.505Z\",\"preview_token\": {token: \"279395174a25be38b702f9ec90d08a960e1a5a84\",timestamp: \"1545530576\"},\"pinned\": false,\"breadcrumbs\": [],\"publish_at\": null,\"expire_at\": null,\"first_published_at\": \"2023-06-06T08:47:05.426Z\",\"last_author\": {\"id\": 39821,\"userid\": \"storyblok\",\"friendly_name\": \"Storyblok\"},\"user_ids\": [12345],\"space_role_ids\": [],\"translated_slugs\": [{}],\"localized_paths\": [{}],\"position\": 0,\"translated_stories\": [],\"can_not_view\": null,\"is_scheduled\": null,\"scheduled_dates\": null,\"favourite_for_user_ids\": []}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import Foundation
let headers = [
"Content-Type": "multipart/form-data",
"Authorization": "YOUR_OAUTH_TOKEN"
]
let postData = NSData(data: "{story: {\"name\": \"Home\",\"parent_id\": 0,\"group_id\": \"fb33b858-277f-4690-81fb-e0a080bd39ac\",\"alternates\": [],\"created_at\": \"2023-05-29T09:53:40.231Z\",\"deleted_at\": null,\"sort_by_date\": null,\"tag_list\": [],\"updated_at\": \"2024-02-08T11:26:42.514Z\",\"published_at\": \"2023-08-30T09:16:42.066Z\",\"id\": 314931981,\"uuid\": \"2497c493-168a-443f-bbb1-ccfd6340d319\",\"is_folder\": false,\"content\": {\"_uid\": \"98cccd01-f807-4494-996d-c6b0de2045a5\",\"component\": \"your_content_type\"// and fields you define yourself are in here},\"published\": true,\"slug\": \"home\",\"path\": null,\"full_slug\": \"home\",\"default_root\": null,\"disble_fe_editor\": false,\"parent\": null,\"is_startpage\": false,\"unpublished_changes\": true,\"meta_data\": null,\"imported_at\": \"2024-02-08T11:26:42.505Z\",\"preview_token\": {token: \"279395174a25be38b702f9ec90d08a960e1a5a84\",timestamp: \"1545530576\"},\"pinned\": false,\"breadcrumbs\": [],\"publish_at\": null,\"expire_at\": null,\"first_published_at\": \"2023-06-06T08:47:05.426Z\",\"last_author\": {\"id\": 39821,\"userid\": \"storyblok\",\"friendly_name\": \"Storyblok\"},\"user_ids\": [12345],\"space_role_ids\": [],\"translated_slugs\": [{}],\"localized_paths\": [{}],\"position\": 0,\"translated_stories\": [],\"can_not_view\": null,\"is_scheduled\": null,\"scheduled_dates\": null,\"favourite_for_user_ids\": []}}".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/233027/stories/314931981/import.json?lang_code=pt-br&import_lang=true")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)
request.method = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
import requests
url = "https://mapi.storyblok.com/v1/spaces/233027/stories/314931981/import.json"
querystring = {"lang_code":"pt-br","import_lang":"true"}
payload = "{story: {\"name\": \"Home\",\"parent_id\": 0,\"group_id\": \"fb33b858-277f-4690-81fb-e0a080bd39ac\",\"alternates\": [],\"created_at\": \"2023-05-29T09:53:40.231Z\",\"deleted_at\": null,\"sort_by_date\": null,\"tag_list\": [],\"updated_at\": \"2024-02-08T11:26:42.514Z\",\"published_at\": \"2023-08-30T09:16:42.066Z\",\"id\": 314931981,\"uuid\": \"2497c493-168a-443f-bbb1-ccfd6340d319\",\"is_folder\": false,\"content\": {\"_uid\": \"98cccd01-f807-4494-996d-c6b0de2045a5\",\"component\": \"your_content_type\"// and fields you define yourself are in here},\"published\": true,\"slug\": \"home\",\"path\": null,\"full_slug\": \"home\",\"default_root\": null,\"disble_fe_editor\": false,\"parent\": null,\"is_startpage\": false,\"unpublished_changes\": true,\"meta_data\": null,\"imported_at\": \"2024-02-08T11:26:42.505Z\",\"preview_token\": {token: \"279395174a25be38b702f9ec90d08a960e1a5a84\",timestamp: \"1545530576\"},\"pinned\": false,\"breadcrumbs\": [],\"publish_at\": null,\"expire_at\": null,\"first_published_at\": \"2023-06-06T08:47:05.426Z\",\"last_author\": {\"id\": 39821,\"userid\": \"storyblok\",\"friendly_name\": \"Storyblok\"},\"user_ids\": [12345],\"space_role_ids\": [],\"translated_slugs\": [{}],\"localized_paths\": [{}],\"position\": 0,\"translated_stories\": [],\"can_not_view\": null,\"is_scheduled\": null,\"scheduled_dates\": null,\"favourite_for_user_ids\": []}}"
headers = {
'Content-Type': "multipart/form-data",
'Authorization': "YOUR_OAUTH_TOKEN"
}
response = requests.request("PUT", url, data=payload, headers=headers, params=querystring)
print(response.text)