Duplicate a Story
https://mapi.storyblok.com/v1/spaces/:space_id/stories/:story_id/duplicateThis endpoint can be used to duplicate a story into another folder.
Path parameters
Section titled “Path parameters”:space_idrequired numberNumeric ID of a space
:story_idrequired numberID of the story
Request body properties
Section titled “Request body properties”storyThe Story ObjectAny attributes sent here will be copied to the duplicated story. To link duplicated stories as alternates, specify a
group_idin thestoryobject.target_dimensionnumberThe
idof the target folder.same_pathbooleanIf set to
true, the current story’spathattribute will used for the duplicated story.
Response properties
Section titled “Response properties”storyThe Story ObjectA single story object
Examples
Section titled “Examples”curl "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/531458099/duplicate" \ -X PUT \ -H "Authorization: YOUR_PERSONAL_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"same_path\":true,\"story\":{\"group_id\":\"4f77133f-bb1c-4799-a54d-b6217107247f\"},\"target_dimension\":531452775}"// storyblok-js-client@>=7, node@>=18import Storyblok from "storyblok-js-client";
const storyblok = new Storyblok({ oauthToken: "YOUR_PERSONAL_ACCESS_TOKEN",});
try { const response = await storyblok.put('spaces/288868932106293/stories/531458099/duplicate', { "same_path": true, "story": { "group_id": "4f77133f-bb1c-4799-a54d-b6217107247f" }, "target_dimension": 531452775 }) console.log({ response })} catch (error) { console.log(error)}$client = new \Storyblok\ManagementClient('YOUR_PERSONAL_ACCESS_TOKEN');
$payload = ["same_path" => true,"story" => ["group_id" => "4f77133f-bb1c-4799-a54d-b6217107247f"],"target_dimension" => 531452775];
$client->put('spaces/288868932106293/stories/531458099/duplicate', $payload)->getBody();HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/288868932106293/stories/531458099/duplicate") .header("Content-Type", "application/json") .header("Authorization", "YOUR_PERSONAL_ACCESS_TOKEN") .body({"same_path":true,"story":{"group_id":"4f77133f-bb1c-4799-a54d-b6217107247f"},"target_dimension":531452775}) .asString();var client = new RestClient("https://mapi.storyblok.com/v1/spaces/288868932106293/stories/531458099/duplicate");var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");request.AddHeader("Authorization", "YOUR_PERSONAL_ACCESS_TOKEN");request.AddParameter("application/json", "{\"same_path\":true,\"story\":{\"group_id\":\"4f77133f-bb1c-4799-a54d-b6217107247f\"},\"target_dimension\":531452775}", ParameterType.RequestBody);IRestResponse response = client.Execute(request);import requests
url = "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/531458099/duplicate"
querystring = {}
payload = {"same_path":true,"story":{"group_id":"4f77133f-bb1c-4799-a54d-b6217107247f"},"target_dimension":531452775}headers = { 'Content-Type': "application/json", 'Authorization': "YOUR_PERSONAL_ACCESS_TOKEN"}
response = requests.request("PUT", url, data=payload, headers=headers, params=querystring)
print(response.text)require 'storyblok'client = Storyblok::Client.new(oauth_token: 'YOUR_PERSONAL_ACCESS_TOKEN')
payload = {"same_path" => true,"story" => {"group_id" => "4f77133f-bb1c-4799-a54d-b6217107247f"},"target_dimension" => 531452775}
client.put('spaces/288868932106293/stories/531458099/duplicate', payload)let storyblok = URLSession(storyblok: .mapi(accessToken: .personal("YOUR_PERSONAL_ACCESS_TOKEN")))var request = URLRequest(storyblok: storyblok, path: "spaces/288868932106293/stories/531458099/duplicate")request.httpMethod = "PUT"request.httpBody = try JSONSerialization.data(withJSONObject: [ "same_path": true, "story": [ "group_id": "4f77133f-bb1c-4799-a54d-b6217107247f", ], "target_dimension": 531452775,])let (data, _) = try await storyblok.data(for: request)print(try JSONSerialization.jsonObject(with: data))val client = HttpClient { install(Storyblok(MAPI)) { accessToken = Personal("YOUR_PERSONAL_ACCESS_TOKEN") }}
val response = client.put("spaces/288868932106293/stories/531458099/duplicate") { setBody(buildJsonObject { put("same_path", true) putJsonObject("story") { put("group_id", "4f77133f-bb1c-4799-a54d-b6217107247f") } put("target_dimension", 531452775) })}
println(response.body<JsonElement>())Was this page helpful?
This site uses reCAPTCHA and Google's Privacy Policy (opens in a new window).Terms of Service (opens in a new window) apply.
Get in touch with the Storyblok community