---
title: Create and Manage Folders
description: Use the Story endpoint to create and manage content folders.
url: https://storyblok.com/docs/api/management/stories/create-and-manage-folders
---

# Create and Manage Folders

POST

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

Use the Story endpoint to create and manage content folders.

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](/docs/api/management/stories/the-story-object)
    

## Response properties

-   `story` (The Story Object)
    
    A single [story object](/docs/api/management/stories/the-story-object)
    

## Examples

Create a new folder within your Space.

-   cURL
    
    ```shellscript
    curl "https://mapi.storyblok.com/v1/spaces/288868932106293/stories" \
      -X POST \
      -H "Authorization: YOUR_OAUTH_TOKEN" \
      -H "Content-Type: application/json" \
      -d "{\"story\":{\"is_folder\":true,\"name\":\"A new folder\",\"parent_id\":0,\"slug\":\"a-new-folder\"}}"
    ```
    
-   JS
    
    ```javascript
    // storyblok-js-client@>=7, node@>=18
    import Storyblok from "storyblok-js-client";
    
    const storyblok = new Storyblok({
      oauthToken: "YOUR_PERSONAL_ACCESS_TOKEN",
    });
    
    try {
      const response = await storyblok.post('spaces/288868932106293/stories', {
        "story": {
          "is_folder": true,
          "name": "A new folder",
          "parent_id": 0,
          "slug": "a-new-folder"
        }
      })
      console.log({ response })
    } catch (error) {
      console.log(error)
    }
    ```
    
-   PHP
    
    ```php
    $client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
    
    $payload = ["story" => ["is_folder" => true,"name" => "A new folder","parent_id" => 0,"slug" => "a-new-folder"]];
    
    $client->post('spaces/288868932106293/stories', $payload)->getBody();
    ```
    
-   Java
    
    ```java
    HttpResponse<String> response = Unirest.post("https://mapi.storyblok.com/v1/spaces/288868932106293/stories")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_OAUTH_TOKEN")
      .body({"story":{"is_folder":true,"name":"A new folder","parent_id":0,"slug":"a-new-folder"}})
      .asString();
    ```
    
-   C#
    
    ```csharp
    var client = new RestClient("https://mapi.storyblok.com/v1/spaces/288868932106293/stories");
    var request = new RestRequest(Method.POST);
    
    request.AddHeader("Content-Type", "application/json");
    request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
    request.AddParameter("application/json", "{\"story\":{\"is_folder\":true,\"name\":\"A new folder\",\"parent_id\":0,\"slug\":\"a-new-folder\"}}", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    ```
    
-   Python
    
    ```python
    import requests
    
    url = "https://mapi.storyblok.com/v1/spaces/288868932106293/stories"
    
    querystring = {}
    
    payload = {"story":{"is_folder":true,"name":"A new folder","parent_id":0,"slug":"a-new-folder"}}
    headers = {
      'Content-Type': "application/json",
      'Authorization': "YOUR_OAUTH_TOKEN"
    }
    
    response = requests.request("POST", url, data=payload, headers=headers, params=querystring)
    
    print(response.text)
    ```
    
-   Ruby
    
    ```ruby
    require 'storyblok'
    client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
    
    payload = {"story" => {"is_folder" => true,"name" => "A new folder","parent_id" => 0,"slug" => "a-new-folder"}}
    
    client.post('spaces/288868932106293/stories', payload)
    ```
    
-   Swift
    
    ```swift
    let storyblok = URLSession(storyblok: .mapi(accessToken: .oauth("YOUR_OAUTH_TOKEN")))
    var request = URLRequest(storyblok: storyblok, path: "spaces/288868932106293/stories")
    request.httpMethod = "POST"
    request.httpBody = try JSONSerialization.data(withJSONObject: [
        "story": [
            "is_folder": true,
            "name": "A new folder",
            "parent_id": 0,
            "slug": "a-new-folder",
        ],
    ])
    let (data, _) = try await storyblok.data(for: request)
    print(try JSONSerialization.jsonObject(with: data))
    ```
    
-   Kotlin
    
    ```kotlin
    val client = HttpClient {
        install(Storyblok(MAPI)) {
            accessToken = OAuth("YOUR_OAUTH_TOKEN")
        }
    }
    
    val response = client.post("spaces/288868932106293/stories") {
        setBody(buildJsonObject {
            putJsonObject("story") {
                put("is_folder", true)
                put("name", "A new folder")
                put("parent_id", 0)
                put("slug", "a-new-folder")
            }
        })
    }
    
    println(response.body<JsonElement>())
    ```

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

-   cURL
    
    ```shellscript
    curl "https://mapi.storyblok.com/v1/spaces/288868932106293/stories" \
      -X POST \
      -H "Authorization: YOUR_OAUTH_TOKEN" \
      -H "Content-Type: application/json" \
      -d "{\"story\":{\"default_root\":\"article\",\"is_folder\":true,\"name\":\"A new folder\",\"parent_id\":0,\"slug\":\"a-new-folder\"}}"
    ```
    
-   JS
    
    ```javascript
    // storyblok-js-client@>=7, node@>=18
    import Storyblok from "storyblok-js-client";
    
    const storyblok = new Storyblok({
      oauthToken: "YOUR_PERSONAL_ACCESS_TOKEN",
    });
    
    try {
      const response = await storyblok.post('spaces/288868932106293/stories', {
        "story": {
          "default_root": "article",
          "is_folder": true,
          "name": "A new folder",
          "parent_id": 0,
          "slug": "a-new-folder"
        }
      })
      console.log({ response })
    } catch (error) {
      console.log(error)
    }
    ```
    
-   PHP
    
    ```php
    $client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
    
    $payload = ["story" => ["default_root" => "article","is_folder" => true,"name" => "A new folder","parent_id" => 0,"slug" => "a-new-folder"]];
    
    $client->post('spaces/288868932106293/stories', $payload)->getBody();
    ```
    
-   Java
    
    ```java
    HttpResponse<String> response = Unirest.post("https://mapi.storyblok.com/v1/spaces/288868932106293/stories")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_OAUTH_TOKEN")
      .body({"story":{"default_root":"article","is_folder":true,"name":"A new folder","parent_id":0,"slug":"a-new-folder"}})
      .asString();
    ```
    
-   C#
    
    ```csharp
    var client = new RestClient("https://mapi.storyblok.com/v1/spaces/288868932106293/stories");
    var request = new RestRequest(Method.POST);
    
    request.AddHeader("Content-Type", "application/json");
    request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
    request.AddParameter("application/json", "{\"story\":{\"default_root\":\"article\",\"is_folder\":true,\"name\":\"A new folder\",\"parent_id\":0,\"slug\":\"a-new-folder\"}}", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    ```
    
-   Python
    
    ```python
    import requests
    
    url = "https://mapi.storyblok.com/v1/spaces/288868932106293/stories"
    
    querystring = {}
    
    payload = {"story":{"default_root":"article","is_folder":true,"name":"A new folder","parent_id":0,"slug":"a-new-folder"}}
    headers = {
      'Content-Type': "application/json",
      'Authorization': "YOUR_OAUTH_TOKEN"
    }
    
    response = requests.request("POST", url, data=payload, headers=headers, params=querystring)
    
    print(response.text)
    ```
    
-   Ruby
    
    ```ruby
    require 'storyblok'
    client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
    
    payload = {"story" => {"default_root" => "article","is_folder" => true,"name" => "A new folder","parent_id" => 0,"slug" => "a-new-folder"}}
    
    client.post('spaces/288868932106293/stories', payload)
    ```
    
-   Swift
    
    ```swift
    let storyblok = URLSession(storyblok: .mapi(accessToken: .oauth("YOUR_OAUTH_TOKEN")))
    var request = URLRequest(storyblok: storyblok, path: "spaces/288868932106293/stories")
    request.httpMethod = "POST"
    request.httpBody = try JSONSerialization.data(withJSONObject: [
        "story": [
            "default_root": "article",
            "is_folder": true,
            "name": "A new folder",
            "parent_id": 0,
            "slug": "a-new-folder",
        ],
    ])
    let (data, _) = try await storyblok.data(for: request)
    print(try JSONSerialization.jsonObject(with: data))
    ```
    
-   Kotlin
    
    ```kotlin
    val client = HttpClient {
        install(Storyblok(MAPI)) {
            accessToken = OAuth("YOUR_OAUTH_TOKEN")
        }
    }
    
    val response = client.post("spaces/288868932106293/stories") {
        setBody(buildJsonObject {
            putJsonObject("story") {
                put("default_root", "article")
                put("is_folder", true)
                put("name", "A new folder")
                put("parent_id", 0)
                put("slug", "a-new-folder")
            }
        })
    }
    
    println(response.body<JsonElement>())
    ```

Update a folder with strict content types.

-   cURL
    
    ```shellscript
    curl "https://mapi.storyblok.com/v1/spaces/288868932106293/stories" \
      -X PUT \
      -H "Authorization: YOUR_OAUTH_TOKEN" \
      -H "Content-Type: application/json" \
      -d "{\"story\":{\"content\":{\"content_types\":[\"category\"],\"lock_subfolders_content_types\":false},\"is_folder\":true,\"name\":\"Categories\",\"parent_id\":0,\"slug\":\"categories\"}}"
    ```
    
-   JS
    
    ```javascript
    // storyblok-js-client@>=7, node@>=18
    import Storyblok from "storyblok-js-client";
    
    const storyblok = new Storyblok({
      oauthToken: "YOUR_PERSONAL_ACCESS_TOKEN",
    });
    
    try {
      const response = await storyblok.put('spaces/288868932106293/stories', {
        "story": {
          "content": {
            "content_types": [
              "category"
            ],
            "lock_subfolders_content_types": false
          },
          "is_folder": true,
          "name": "Categories",
          "parent_id": 0,
          "slug": "categories"
        }
      })
      console.log({ response })
    } catch (error) {
      console.log(error)
    }
    ```
    
-   PHP
    
    ```php
    $client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
    
    $payload = ["story" => ["content" => ["content_types" => ["category"],"lock_subfolders_content_types" => false],"is_folder" => true,"name" => "Categories","parent_id" => 0,"slug" => "categories"]];
    
    $client->put('spaces/288868932106293/stories', $payload)->getBody();
    ```
    
-   Java
    
    ```java
    HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/288868932106293/stories")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_OAUTH_TOKEN")
      .body({"story":{"content":{"content_types":["category"],"lock_subfolders_content_types":false},"is_folder":true,"name":"Categories","parent_id":0,"slug":"categories"}})
      .asString();
    ```
    
-   C#
    
    ```csharp
    var client = new RestClient("https://mapi.storyblok.com/v1/spaces/288868932106293/stories");
    var request = new RestRequest(Method.PUT);
    
    request.AddHeader("Content-Type", "application/json");
    request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
    request.AddParameter("application/json", "{\"story\":{\"content\":{\"content_types\":[\"category\"],\"lock_subfolders_content_types\":false},\"is_folder\":true,\"name\":\"Categories\",\"parent_id\":0,\"slug\":\"categories\"}}", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    ```
    
-   Python
    
    ```python
    import requests
    
    url = "https://mapi.storyblok.com/v1/spaces/288868932106293/stories"
    
    querystring = {}
    
    payload = {"story":{"content":{"content_types":["category"],"lock_subfolders_content_types":false},"is_folder":true,"name":"Categories","parent_id":0,"slug":"categories"}}
    headers = {
      'Content-Type': "application/json",
      'Authorization': "YOUR_OAUTH_TOKEN"
    }
    
    response = requests.request("PUT", url, data=payload, headers=headers, params=querystring)
    
    print(response.text)
    ```
    
-   Ruby
    
    ```ruby
    require 'storyblok'
    client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
    
    payload = {"story" => {"content" => {"content_types" => ["category"],"lock_subfolders_content_types" => false},"is_folder" => true,"name" => "Categories","parent_id" => 0,"slug" => "categories"}}
    
    client.put('spaces/288868932106293/stories', payload)
    ```
    
-   Swift
    
    ```swift
    let storyblok = URLSession(storyblok: .mapi(accessToken: .oauth("YOUR_OAUTH_TOKEN")))
    var request = URLRequest(storyblok: storyblok, path: "spaces/288868932106293/stories")
    request.httpMethod = "PUT"
    request.httpBody = try JSONSerialization.data(withJSONObject: [
        "story": [
            "content": [
                "content_types": [
                    "category",
                ],
                "lock_subfolders_content_types": false,
            ],
            "is_folder": true,
            "name": "Categories",
            "parent_id": 0,
            "slug": "categories",
        ],
    ])
    let (data, _) = try await storyblok.data(for: request)
    print(try JSONSerialization.jsonObject(with: data))
    ```
    
-   Kotlin
    
    ```kotlin
    val client = HttpClient {
        install(Storyblok(MAPI)) {
            accessToken = OAuth("YOUR_OAUTH_TOKEN")
        }
    }
    
    val response = client.put("spaces/288868932106293/stories") {
        setBody(buildJsonObject {
            putJsonObject("story") {
                putJsonObject("content") {
                    putJsonArray("content_types") {
                        add("category")
                    }
                    put("lock_subfolders_content_types", false)
                }
                put("is_folder", true)
                put("name", "Categories")
                put("parent_id", 0)
                put("slug", "categories")
            }
        })
    }
    
    println(response.body<JsonElement>())
    ```

## Pagination

-   [Previous: Create a Story](/docs/api/management/stories/create-a-story)
-   [Next: Duplicate a Story](/docs/api/management/stories/duplicate-a-story)
