---
title: Examples: Export/Import a story (JSON)
description: Examples for exporting and importing stories as JSON.
url: https://storyblok.com/docs/api/management/stories/examples/export-import-json-examples
---

# Examples: Export/Import a story (JSON)

## Basic export

Export a story without any parameters.

-   cURL
    
    ```shellscript
    curl "https://mapi.storyblok.com/v1/spaces/88751/stories/64181051491446/export.json" \
      -H "Authorization: YOUR_OAUTH_TOKEN"
    ```
    
-   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.get('spaces/88751/stories/64181051491446/export.json', {})
      console.log({ response })
    } catch (error) {
      console.log(error)
    }
    ```
    
-   PHP
    
    ```php
    $client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
    
    $client->get('spaces/88751/stories/64181051491446/export.json')->getBody();
    ```
    
-   Java
    
    ```java
    HttpResponse<String> response = Unirest.get("https://mapi.storyblok.com/v1/spaces/88751/stories/64181051491446/export.json")
      .header("Authorization", "YOUR_OAUTH_TOKEN")
      .asString();
    ```
    
-   C#
    
    ```csharp
    var client = new RestClient("https://mapi.storyblok.com/v1/spaces/88751/stories/64181051491446/export.json");
    var request = new RestRequest(Method.GET);
    
    request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
    IRestResponse response = client.Execute(request);
    ```
    
-   Python
    
    ```python
    import requests
    
    url = "https://mapi.storyblok.com/v1/spaces/88751/stories/64181051491446/export.json"
    
    querystring = {}
    
    payload = ""
    headers = {
      'Authorization': "YOUR_OAUTH_TOKEN"
    }
    
    response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
    
    print(response.text)
    ```
    
-   Ruby
    
    ```ruby
    require 'storyblok'
    client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
    
    client.get('spaces/88751/stories/64181051491446/export.json')
    ```
    
-   Swift
    
    ```swift
    let storyblok = URLSession(storyblok: .mapi(accessToken: .oauth("YOUR_OAUTH_TOKEN")))
    let request = URLRequest(storyblok: storyblok, path: "spaces/88751/stories/64181051491446/export.json")
    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.get("spaces/88751/stories/64181051491446/export.json")
    
    println(response.body<JsonElement>())
    ```

Example response

```json
{
  "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 translated content

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
    
    ```shellscript
    curl "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/export.json\
    ?lang_code=sw\
    &export_lang=true" \
      -H "Authorization: YOUR_OAUTH_TOKEN"
    ```
    
-   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.get('spaces/288868932106293/stories/314931981/export.json', {
        "lang_code": "sw",
        "export_lang": "true"
      })
      console.log({ response })
    } catch (error) {
      console.log(error)
    }
    ```
    
-   PHP
    
    ```php
    $client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
    
    $client->get('spaces/288868932106293/stories/314931981/export.json', [
      "lang_code" => "sw",
      "export_lang" => "true"
    ])->getBody();
    ```
    
-   Java
    
    ```java
    HttpResponse<String> response = Unirest.get("https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/export.json?lang_code=sw&export_lang=true")
      .header("Authorization", "YOUR_OAUTH_TOKEN")
      .asString();
    ```
    
-   C#
    
    ```csharp
    var client = new RestClient("https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/export.json?lang_code=sw&export_lang=true");
    var request = new RestRequest(Method.GET);
    
    request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
    IRestResponse response = client.Execute(request);
    ```
    
-   Python
    
    ```python
    import requests
    
    url = "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/export.json"
    
    querystring = {"lang_code":"sw","export_lang":"true"}
    
    payload = ""
    headers = {
      'Authorization': "YOUR_OAUTH_TOKEN"
    }
    
    response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
    
    print(response.text)
    ```
    
-   Ruby
    
    ```ruby
    require 'storyblok'
    client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
    
    client.get('spaces/288868932106293/stories/314931981/export.json', {:params => {
      "lang_code" => "sw",
      "export_lang" => "true"
    }})
    ```
    
-   Swift
    
    ```swift
    let storyblok = URLSession(storyblok: .mapi(accessToken: .oauth("YOUR_OAUTH_TOKEN")))
    var request = URLRequest(storyblok: storyblok, path: "spaces/288868932106293/stories/314931981/export.json")
    request.url!.append(queryItems: [
        URLQueryItem(name: "lang_code", value: "sw"),
        URLQueryItem(name: "export_lang", value: "true")
    ])
    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.get("spaces/288868932106293/stories/314931981/export.json") {
        url {
            parameters.append("lang_code", "sw")
            parameters.append("export_lang", "true")
        }
    }
    
    println(response.body<JsonElement>())
    ```

Example response with translated content

```json
{
  "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

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
    
    ```shellscript
    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"
    ```
    
-   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.get('spaces/288868932106293/stories/314931981/export.json', {
        "lang_code": "pt-br",
        "export_lang": "true",
        "version": "1"
      })
      console.log({ response })
    } catch (error) {
      console.log(error)
    }
    ```
    
-   PHP
    
    ```php
    $client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
    
    $client->get('spaces/288868932106293/stories/314931981/export.json', [
      "lang_code" => "pt-br",
      "export_lang" => "true",
      "version" => "1"
    ])->getBody();
    ```
    
-   Java
    
    ```java
    HttpResponse<String> response = Unirest.get("https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/export.json?lang_code=pt-br&export_lang=true&version=1")
      .header("Authorization", "YOUR_OAUTH_TOKEN")
      .asString();
    ```
    
-   C#
    
    ```csharp
    var client = new RestClient("https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/export.json?lang_code=pt-br&export_lang=true&version=1");
    var request = new RestRequest(Method.GET);
    
    request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
    IRestResponse response = client.Execute(request);
    ```
    
-   Python
    
    ```python
    import requests
    
    url = "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/export.json"
    
    querystring = {"lang_code":"pt-br","export_lang":"true","version":"1"}
    
    payload = ""
    headers = {
      'Authorization': "YOUR_OAUTH_TOKEN"
    }
    
    response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
    
    print(response.text)
    ```
    
-   Ruby
    
    ```ruby
    require 'storyblok'
    client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
    
    client.get('spaces/288868932106293/stories/314931981/export.json', {:params => {
      "lang_code" => "pt-br",
      "export_lang" => "true",
      "version" => "1"
    }})
    ```
    
-   Swift
    
    ```swift
    let storyblok = URLSession(storyblok: .mapi(accessToken: .oauth("YOUR_OAUTH_TOKEN")))
    var request = URLRequest(storyblok: storyblok, path: "spaces/288868932106293/stories/314931981/export.json")
    request.url!.append(queryItems: [
        URLQueryItem(name: "lang_code", value: "pt-br"),
        URLQueryItem(name: "export_lang", value: "true"),
        URLQueryItem(name: "version", value: "1")
    ])
    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.get("spaces/288868932106293/stories/314931981/export.json") {
        url {
            parameters.append("lang_code", "pt-br")
            parameters.append("export_lang", "true")
            parameters.append("version", "1")
        }
    }
    
    println(response.body<JsonElement>())
    ```

Example Version 1 response

```json
{
  "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
}
```

## Basic import

Import a story by sending `data` as a stringified JSON object with the structure documented in the [Export a Story (JSON)](/docs/api/management/stories/export-a-story) endpoint.

-   cURL
    
    ```shellscript
    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\\"}\"}"
    ```
    
-   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/314931981/import.json', {
        "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\"}"
      })
      console.log({ response })
    } catch (error) {
      console.log(error)
    }
    ```
    
-   PHP
    
    ```php
    $client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
    
    $payload = ["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\"]"];
    
    $client->put('spaces/288868932106293/stories/314931981/import.json', $payload)->getBody();
    ```
    
-   Java
    
    ```java
    HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/import.json")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_OAUTH_TOKEN")
      .body({"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\"}"})
      .asString();
    ```
    
-   C#
    
    ```csharp
    var client = new RestClient("https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/import.json");
    var request = new RestRequest(Method.PUT);
    
    request.AddHeader("Content-Type", "application/json");
    request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
    request.AddParameter("application/json", "{\"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\\\"}\"}", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    ```
    
-   Python
    
    ```python
    import requests
    
    url = "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/import.json"
    
    querystring = {}
    
    payload = {"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\"}"}
    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 = {"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\"}"}
    
    client.put('spaces/288868932106293/stories/314931981/import.json', payload)
    ```
    
-   Swift
    
    ```swift
    let storyblok = URLSession(storyblok: .mapi(accessToken: .oauth("YOUR_OAUTH_TOKEN")))
    var request = URLRequest(storyblok: storyblok, path: "spaces/288868932106293/stories/314931981/import.json")
    request.httpMethod = "PUT"
    request.httpBody = try JSONSerialization.data(withJSONObject: [
        "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"}",
    ])
    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/314931981/import.json") {
        setBody(buildJsonObject {
            put("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"}")
        })
    }
    
    println(response.body<JsonElement>())
    ```

## Import translated content

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

-   cURL
    
    ```shellscript
    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\\"}\"}"
    ```
    
-   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/314931981/import.json?lang_code=es&import_lang=true', {
        "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\"}"
      })
      console.log({ response })
    } catch (error) {
      console.log(error)
    }
    ```
    
-   PHP
    
    ```php
    $client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
    
    $payload = ["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\"]"];
    
    $client->put('spaces/288868932106293/stories/314931981/import.json?lang_code=es&import_lang=true', $payload)->getBody();
    ```
    
-   Java
    
    ```java
    HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/import.json?lang_code=es&import_lang=true")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_OAUTH_TOKEN")
      .body({"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\"}"})
      .asString();
    ```
    
-   C#
    
    ```csharp
    var client = new RestClient("https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/import.json?lang_code=es&import_lang=true");
    var request = new RestRequest(Method.PUT);
    
    request.AddHeader("Content-Type", "application/json");
    request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
    request.AddParameter("application/json", "{\"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\\\"}\"}", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    ```
    
-   Python
    
    ```python
    import requests
    
    url = "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/import.json"
    
    querystring = {"lang_code":"es","import_lang":"true"}
    
    payload = {"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\"}"}
    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 = {"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\"}"}
    
    client.put('spaces/288868932106293/stories/314931981/import.json', {:params => {
      "lang_code" => "es",
      "import_lang" => "true"
    }}, payload)
    ```
    
-   Swift
    
    ```swift
    let storyblok = URLSession(storyblok: .mapi(accessToken: .oauth("YOUR_OAUTH_TOKEN")))
    var request = URLRequest(storyblok: storyblok, path: "spaces/288868932106293/stories/314931981/import.json")
    request.url!.append(queryItems: [
        URLQueryItem(name: "lang_code", value: "es"),
        URLQueryItem(name: "import_lang", value: "true")
    ])
    request.httpMethod = "PUT"
    request.httpBody = try JSONSerialization.data(withJSONObject: [
        "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"}",
    ])
    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/314931981/import.json") {
        url {
            parameters.append("lang_code", "es")
            parameters.append("import_lang", "true")
        }
        setBody(buildJsonObject {
            put("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"}")
        })
    }
    
    println(response.body<JsonElement>())
    ```

> [!WARNING]
> Fields must be enabled as translatable in the block schema for the import to work. Learn more in the [fields](/docs/concepts/fields) and [internationalization](/docs/concepts/internationalization) developer concepts.

## 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
    
    ```shellscript
    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}\"}"
    ```
    
-   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/314931981/import.json?version=1', {
        "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}"
      })
      console.log({ response })
    } catch (error) {
      console.log(error)
    }
    ```
    
-   PHP
    
    ```php
    $client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
    
    $payload = ["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]"];
    
    $client->put('spaces/288868932106293/stories/314931981/import.json?version=1', $payload)->getBody();
    ```
    
-   Java
    
    ```java
    HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/import.json?version=1")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_OAUTH_TOKEN")
      .body({"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}"})
      .asString();
    ```
    
-   C#
    
    ```csharp
    var client = new RestClient("https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/import.json?version=1");
    var request = new RestRequest(Method.PUT);
    
    request.AddHeader("Content-Type", "application/json");
    request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
    request.AddParameter("application/json", "{\"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}\"}", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    ```
    
-   Python
    
    ```python
    import requests
    
    url = "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/314931981/import.json"
    
    querystring = {"version":"1"}
    
    payload = {"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}"}
    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 = {"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}"}
    
    client.put('spaces/288868932106293/stories/314931981/import.json', {:params => {
      "version" => "1"
    }}, payload)
    ```
    
-   Swift
    
    ```swift
    let storyblok = URLSession(storyblok: .mapi(accessToken: .oauth("YOUR_OAUTH_TOKEN")))
    var request = URLRequest(storyblok: storyblok, path: "spaces/288868932106293/stories/314931981/import.json")
    request.url!.append(queryItems: [
        URLQueryItem(name: "version", value: "1")
    ])
    request.httpMethod = "PUT"
    request.httpBody = try JSONSerialization.data(withJSONObject: [
        "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}",
    ])
    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/314931981/import.json") {
        url {
            parameters.append("version", "1")
        }
        setBody(buildJsonObject {
            put("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}")
        })
    }
    
    println(response.body<JsonElement>())
    ```

## Pagination

-   [Previous: The Unpublished Story Object](/docs/api/management/stories/the-unpublished-story-object)
-   [Next: Export/Import a story as XML](/docs/api/management/stories/examples/export-import-xml-examples)
