⚠️Draft Content
Storyblok
Search Storyblok's Documentation
  1. Create and manage folders

Management API

Create and manage folders

Use the Story endpoint to create and manage content folders.

https://mapi.storyblok.com/v1/spaces/:space_id/stories/

You can use a small subset of properties from the Story Object to push new folders into your space or modify their configurations:

  • Use name and slug to identify the folder.
  • Always pass true to the is_folder in the Request Body.
  • Use parent_id to determine where the folder should be created.
  • You can also update existent folders to accept only specific content types.

Check the request examples in this section.

Path Parameters

  • :space_id

    required number

    Numeric ID of a space

Request Body Properties

  • story

    The Story Object

    A single story object

    • name

      required string

      The complete name provided for the story

    • parent_id

      number

      ID of the parent folder

    • group_id

      string

      Group ID (UUID string), shared between stories defined as alternates

    • sort_by_date

      string

      Date defined in the story's entry configuration (Format: YYYY-mm-dd)

    • is_folder

      boolean

      true if the instance constitutes a folder

    • content

      object

      An 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 string

      The slug specific for the story

    • path

      string

      Value of the real path defined in the story's entry configuration (usually, this value is only required for Storyblok's Visual Editor)

    • default_root

      string

      Component name which will be used as default content type for this folders entries

    • disable_fe_editor

      boolean

      Is side by side editor disabled for all entries in folder

    • is_startpage

      boolean

      true if the story is defined as root for the folder

    • meta_data

      object

      Object to store non-editable data that is exclusively maintained with the Management API

    • pinned

      boolean

      To pin the story in the toolbar

    • first_published_at

      string

      First publishing date (Format: yyyy-MM-dd'T'HH:mm:ssZ)

    • translated_slugs_attributes

      object[]

      Array of translated slug attributes objects (if the app Translatable Slugs is installed) to change translated slugs when creating or updating a story

      • id

        number

        The numeric ID

      • lang

        string

        Language code of the current language (can be requested with the language API parameter)

      • slug

        string

        The slug specific for the story

      • name

        string

        The complete name provided for the story

      • published

        boolean

        true if a story has been published at least once (even if it is currently in draft)

    • position

      number

      Numeric representation of the story's position in the folder

Response Properties

  • story

    The Story Object

    A single story object

    • id

      number

      Numeric id of the story

    • name

      string

      The complete name provided for the story

    • parent_id

      number

      ID of the parent folder

    • group_id

      string

      Group 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

        number

        The numeric ID

      • name

        string

        The complete name provided for the story

      • slug

        string

        The slug specific for the story

      • published

        boolean

        true if a story has been published at least once (even if it is currently in draft)

      • full_slug

        string

        The full slug of the story, combining the parent folder(s) and the designated story slug

      • is_folder

        boolean

        true if the instance constitutes a folder

    • created_at

      string

      Creation date (Format: yyyy-MM-dd'T'HH:mm:ssZ)

    • deleted_at

      string

      Deleted date (Format: YYYY-mm-dd HH:MM)

    • sort_by_date

      string

      Date defined in the story's entry configuration (Format: YYYY-mm-dd)

    • tag_list

      string[]

      Array of tag names

    • updated_at

      string

      Latest update date (Format: yyyy-MM-dd'T'HH:mm:ssZ)

    • published_at

      string

      Latest publishing date (Format: yyyy-MM-dd'T'HH:mm:ssZ)

    • uuid

      string

      Generated UUID string

    • is_folder

      boolean

      true if the instance constitutes a folder

    • content

      object

      An 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

      boolean

      true if a story has been published at least once (even if it is currently in draft)

    • slug

      string

      The slug specific for the story

    • path

      string

      Value of the real path defined in the story's entry configuration (usually, this value is only required for Storyblok's Visual Editor)

    • full_slug

      string

      The full slug of the story, combining the parent folder(s) and the designated story slug

    • default_root

      string

      Component name which will be used as default content type for this folders entries

    • disable_fe_editor

      boolean

      Is side by side editor disabled for all entries in folder

    • parent

      object

      Essential parent information as object (resolved from parent_id)

    • is_startpage

      boolean

      true if the story is defined as root for the folder

    • unpublished_changes

      boolean

      Story has unpublished changes; saved but not published

    • meta_data

      object

      Object to store non-editable data that is exclusively maintained with the Management API

    • imported_at

      string

      Latest import date (Format: YYYY-mm-dd HH:MM)

    • preview_token

      object

      Preview token

      • token

        string

        The token passed to the editor as preview parameter to allow edit mode verification

      • timestamp

        string

        Timestamp passed to the editor as preview parameter to allow edit mode verification

    • pinned

      boolean

      To pin the story in the toolbar

    • breadcrumbs

      object[]

      Array of resolved subset of link objects (one per path segment / parent)

      • id

        number

        Story ID

      • name

        string

        The complete name provided for the story

      • parent_id

        number

        ID of the parent folder

      • disable_fe_editor

        boolean

        Is side by side editor disabled for all entries in folder

      • path

        string

        Value of the real path defined in the story's entry configuration (usually, this value is only required for Storyblok's Visual Editor)

      • slug

        string

        The slug specific for the story

      • translated_slugs

        object[]

        Array of translated slug objects (if the app Translatable Slugs is installed)

    • first_published_at

      string

      First publishing date (Format: yyyy-MM-dd'T'HH:mm:ssZ)

    • last_author

      object

      Last author

      • id

        number

        Last author user object numeric id

      • userid

        string

        Last author userid/username

      • friendly_name

        string

        Friendly name of last author

    • last_author_id

      number

      Id of the last Author

    • translated_slugs

      object[]

      Array of translated slug objects (if the app Translatable Slugs is installed)

      • story_id

        number

        ID of the story

      • lang

        string

        Language code of the current language (can be requested with the language API parameter)

      • slug

        string

        The slug specific for the story

      • name

        string

        The complete name provided for the story

      • published

        boolean

        true if a story has been published at least once (even if it is currently in draft)

      • _destroy

        number

        Pass this property with the value 1 to delete the slug in a PUT request.

    • translated_slugs_attributes

      object[]

      Array of translated slug attributes objects (if the app Translatable Slugs is installed) to change translated slugs when creating or updating a story

      • id

        number

        The numeric ID

      • lang

        string

        Language code of the current language (can be requested with the language API parameter)

      • slug

        string

        The slug specific for the story

      • name

        string

        The complete name provided for the story

      • published

        boolean

        true 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

        string

        Value of the real path defined in the story's entry configuration (usually, this value is only required for Storyblok's Visual Editor)

      • name

        string

        The complete name provided for the story

      • lang

        string

        Language code of the current language (can be requested with the language API parameter)

      • published

        boolean

        true if a story has been published at least once (even if it is currently in draft)

    • position

      number

      Numeric representation of the story's position in the folder

    • release_id

      number

      ID of the current release (can be requested with the from_release API parameter)

    • scheduled_dates

      string

      Scheduled 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

Create a new folder within your Space.

Request
curl "https://mapi.storyblok.com/v1/spaces/606/stories" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: YOUR_OAUTH_TOKEN" \
  -d "{\"story\": {\"name\": \"A new folder\",\"slug\": \"a-new-folder\",\"is_folder\": true,\"parent_id\": 0,}}"
Request
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.post('/spaces/606/stories', {
  "story": {
    "name": "A new folder",
    "slug": "a-new-folder",
    "is_folder": true,
    "parent_id": 0,
  }
})
  .then(response => {
    console.log(response)
  }).catch(error => { 
    console.log(error)
  })
Request
$client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');

$payload = [
  "story" =>  [
    "name" =>  "A new folder",
    "slug" =>  "a-new-folder",
    "is_folder" =>  true,
    "parent_id" =>  0,
  ]
];

$client->post('/spaces/606/stories', $payload)->getBody();
Request
require 'storyblok'
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')

payload = {
  "story" =>  {
    "name" =>  "A new folder",
    "slug" =>  "a-new-folder",
    "is_folder" =>  true,
    "parent_id" =>  0,
  }
}

client.post('/spaces/606/stories', payload)
Request
HttpResponse<String> response = Unirest.post("https://mapi.storyblok.com/v1/spaces/606/stories")
  .header("Content-Type", "application/json")
  .header("Authorization", "YOUR_OAUTH_TOKEN")
  .body("{\"story\": {\"name\": \"A new folder\",\"slug\": \"a-new-folder\",\"is_folder\": true,\"parent_id\": 0,}}")
  .asString();
Request
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/606/stories");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
request.AddParameter("application/json", "{\"story\": {\"name\": \"A new folder\",\"slug\": \"a-new-folder\",\"is_folder\": true,\"parent_id\": 0,}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Request
import Foundation

let headers = [
  "Content-Type": "application/json",
  "Authorization": "YOUR_OAUTH_TOKEN"
]

let postData = NSData(data: "{\"story\": {\"name\": \"A new folder\",\"slug\": \"a-new-folder\",\"is_folder\": true,\"parent_id\": 0,}}".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/606/stories")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)

request.method = "POST"
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()
Request
import requests

url = "https://mapi.storyblok.com/v1/spaces/606/stories"

querystring = {}

payload = "{\"story\": {\"name\": \"A new folder\",\"slug\": \"a-new-folder\",\"is_folder\": true,\"parent_id\": 0,}}"
headers = {
  'Content-Type': "application/json",
  'Authorization': "YOUR_OAUTH_TOKEN"
}

response = requests.request("POST", url, data=payload, headers=headers, params=querystring)

print(response.text)

Create a folder to accept only a certain content type using the default_root property.

Request
curl "https://mapi.storyblok.com/v1/spaces/606/stories" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: YOUR_OAUTH_TOKEN" \
  -d "{\"story\": {\"name\": \"A new folder\",\"slug\": \"a-new-folder\",\"is_folder\": true,\"parent_id\": 0,\"default_root\": \"article\"}}"
Request
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.post('/spaces/606/stories', {
  "story": {
    "name": "A new folder",
    "slug": "a-new-folder",
    "is_folder": true,
    "parent_id": 0,
    "default_root": "article"
  }
})
  .then(response => {
    console.log(response)
  }).catch(error => { 
    console.log(error)
  })
Request
$client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');

$payload = [
  "story" =>  [
    "name" =>  "A new folder",
    "slug" =>  "a-new-folder",
    "is_folder" =>  true,
    "parent_id" =>  0,
    "default_root" =>  "article"
  ]
];

$client->post('/spaces/606/stories', $payload)->getBody();
Request
require 'storyblok'
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')

payload = {
  "story" =>  {
    "name" =>  "A new folder",
    "slug" =>  "a-new-folder",
    "is_folder" =>  true,
    "parent_id" =>  0,
    "default_root" =>  "article"
  }
}

client.post('/spaces/606/stories', payload)
Request
HttpResponse<String> response = Unirest.post("https://mapi.storyblok.com/v1/spaces/606/stories")
  .header("Content-Type", "application/json")
  .header("Authorization", "YOUR_OAUTH_TOKEN")
  .body("{\"story\": {\"name\": \"A new folder\",\"slug\": \"a-new-folder\",\"is_folder\": true,\"parent_id\": 0,\"default_root\": \"article\"}}")
  .asString();
Request
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/606/stories");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
request.AddParameter("application/json", "{\"story\": {\"name\": \"A new folder\",\"slug\": \"a-new-folder\",\"is_folder\": true,\"parent_id\": 0,\"default_root\": \"article\"}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Request
import Foundation

let headers = [
  "Content-Type": "application/json",
  "Authorization": "YOUR_OAUTH_TOKEN"
]

let postData = NSData(data: "{\"story\": {\"name\": \"A new folder\",\"slug\": \"a-new-folder\",\"is_folder\": true,\"parent_id\": 0,\"default_root\": \"article\"}}".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/606/stories")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)

request.method = "POST"
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()
Request
import requests

url = "https://mapi.storyblok.com/v1/spaces/606/stories"

querystring = {}

payload = "{\"story\": {\"name\": \"A new folder\",\"slug\": \"a-new-folder\",\"is_folder\": true,\"parent_id\": 0,\"default_root\": \"article\"}}"
headers = {
  'Content-Type': "application/json",
  'Authorization': "YOUR_OAUTH_TOKEN"
}

response = requests.request("POST", url, data=payload, headers=headers, params=querystring)

print(response.text)

Update a folder with strict content types.

Request
curl "https://mapi.storyblok.com/v1/spaces/606/stories" \ 
  -X PUT \
  -H "Authorization: YOUR_OAUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"story\": {\"name\": \"Categories\",\"slug\": \"categories\",\"is_folder\": true,\"parent_id\": 0,\"content\": {\"content_types\": [\"category\"],\"lock_subfolders_content_types\": false}}}"
Request
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.put('/spaces/606/stories', {
  "story": {
    "name": "Categories",
    "slug": "categories",
    "is_folder": true,
    "parent_id": 0,
    "content": {
      "content_types": [
        "category"
      ],    
      "lock_subfolders_content_types": false
    }
  }
})
  .then(response => {
    console.log(response)
  }).catch(error => { 
    console.log(error)
  })
Request
$client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');

$payload = [
  "story" =>  [
    "name" =>  "Categories",
    "slug" =>  "categories",
    "is_folder" =>  true,
    "parent_id" =>  0,
    "content" =>  [
      "content_types" =>  [
        "category"
      ],    
      "lock_subfolders_content_types" =>  false
    ]
  ]
];

$client->put('/spaces/606/stories', $payload)->getBody();
Request
require 'storyblok'
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')

payload = {
  "story" =>  {
    "name" =>  "Categories",
    "slug" =>  "categories",
    "is_folder" =>  true,
    "parent_id" =>  0,
    "content" =>  {
      "content_types" =>  [
        "category"
      ],    
      "lock_subfolders_content_types" =>  false
    }
  }
}

client.put('/spaces/606/stories', payload)
Request
HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/606/stories")
  .header("Content-Type", "application/json")
  .header("Authorization", "YOUR_OAUTH_TOKEN")
  .body("{\"story\": {\"name\": \"Categories\",\"slug\": \"categories\",\"is_folder\": true,\"parent_id\": 0,\"content\": {\"content_types\": [\"category\"],\"lock_subfolders_content_types\": false}}}")
  .asString();
Request
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/606/stories");
var request = new RestRequest(Method.PUT);

request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
request.AddParameter("application/json", "{\"story\": {\"name\": \"Categories\",\"slug\": \"categories\",\"is_folder\": true,\"parent_id\": 0,\"content\": {\"content_types\": [\"category\"],\"lock_subfolders_content_types\": false}}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Request
import Foundation

let headers = [
  "Content-Type": "application/json",
  "Authorization": "YOUR_OAUTH_TOKEN"
]

let postData = NSData(data: "{\"story\": {\"name\": \"Categories\",\"slug\": \"categories\",\"is_folder\": true,\"parent_id\": 0,\"content\": {\"content_types\": [\"category\"],\"lock_subfolders_content_types\": false}}}".data(using: String.Encoding.utf8)!)

let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/606/stories")! 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()
Request
import requests

url = "https://mapi.storyblok.com/v1/spaces/606/stories"

querystring = {}

payload = "{\"story\": {\"name\": \"Categories\",\"slug\": \"categories\",\"is_folder\": true,\"parent_id\": 0,\"content\": {\"content_types\": [\"category\"],\"lock_subfolders_content_types\": false}}}"
headers = {
  'Content-Type': "application/json",
  'Authorization': "YOUR_OAUTH_TOKEN"
}

response = requests.request("PUT", url, data=payload, headers=headers, params=querystring)

print(response.text)