---
title: Create a Story
description: You can set most of the fields that are available in the story object, below we only list the properties in the example and the possible required fields. Stories are not published by default. If you want to create a published story add the parameter publish with the value true.
url: https://storyblok.com/docs/api/management/stories/create-a-story
---

# Create a Story

POST

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

You can set most of the fields that are available in the story object, below we only list the properties in the example and the possible required fields. Stories are not published by default. If you want to create a published story add the parameter `publish` with the value `true`.

You can save any data in the `story[content]` attribute, and use it in the editor, as long as you follow these rules:

-   The `story[content]` property needs to be an object at the root level
-   Every object inside needs to have the property `"component":"your_components_name"`
-   Only nest components using arrays, except if you want to build a [custom field type](https://www.storyblok.com/plugins).
-   Every nested object which is a `component` or [custom field type](https://www.storyblok.com/plugins) needs a `_uid` property.

This lets you import data and define the schema of your components afterwards in the interface where necessary.

## 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)
    
-   `publish` (boolean)
    
    To publish the story, set the parameter to `true`. To create a draft story, set it to `false`.
    
-   `release_id` (number)
    
    ID of the current release (can be requested with the `from_release` API parameter)
    

## Response properties

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

## Examples

-   cURL
    
    ```shellscript
    curl "https://mapi.storyblok.com/v1/spaces/288868932106293/stories" \
      -X POST \
      -H "Authorization: YOUR_OAUTH_TOKEN" \
      -H "Content-Type: application/json" \
      -d "{\"publish\":true,\"story\":{\"content\":{\"body\":[],\"component\":\"page\"},\"name\":\"Story Name\",\"slug\":\"story-name\"}}"
    ```
    
-   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', {
        "publish": true,
        "story": {
          "content": {
            "body": [],
            "component": "page"
          },
          "name": "Story Name",
          "slug": "story-name"
        }
      })
      console.log({ response })
    } catch (error) {
      console.log(error)
    }
    ```
    
-   PHP
    
    ```php
    $client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
    
    $payload = ["publish" => true,"story" => ["content" => ["body" => [],"component" => "page"],"name" => "Story Name","slug" => "story-name"]];
    
    $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({"publish":true,"story":{"content":{"body":[],"component":"page"},"name":"Story Name","slug":"story-name"}})
      .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", "{\"publish\":true,\"story\":{\"content\":{\"body\":[],\"component\":\"page\"},\"name\":\"Story Name\",\"slug\":\"story-name\"}}", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    ```
    
-   Python
    
    ```python
    import requests
    
    url = "https://mapi.storyblok.com/v1/spaces/288868932106293/stories"
    
    querystring = {}
    
    payload = {"publish":true,"story":{"content":{"body":[],"component":"page"},"name":"Story Name","slug":"story-name"}}
    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 = {"publish" => true,"story" => {"content" => {"body" => [],"component" => "page"},"name" => "Story Name","slug" => "story-name"}}
    
    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: [
        "publish": true,
        "story": [
            "content": [
                "body": [ ],
                "component": "page",
            ],
            "name": "Story Name",
            "slug": "story-name",
        ],
    ])
    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 {
            put("publish", true)
            putJsonObject("story") {
                putJsonObject("content") {
                    putJsonArray("body") { }
                    put("component", "page")
                }
                put("name", "Story Name")
                put("slug", "story-name")
            }
        })
    }
    
    println(response.body<JsonElement>())
    ```

## Pagination

-   [Previous: Retrieve Multiple Stories](/docs/api/management/stories/retrieve-multiple-stories)
-   [Next: Create and Manage Folders](/docs/api/management/stories/create-and-manage-folders)
