Duplicate a Story
PUT
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_id required number
Numeric ID of a space
- :story_id required number
ID of the story
Request body properties
Section titled “Request body properties”- story The Story Object
Any attributes sent here will be copied to the duplicated story. To link duplicated stories as alternates, specify a
group_idin thestoryobject. - target_dimension number
The
idof the target folder. - same_path boolean
If set to
true, the current story’spathattribute will used for the duplicated story.
Response properties
Section titled “Response properties”- story The Story Object
A single story object
Examples
Section titled “Examples”curl "https://mapi.storyblok.com/v1/spaces/288868932106293/stories/531458099/duplicate" \ -X PUT \ -H "Authorization: YOUR_OAUTH_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_OAUTH_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_OAUTH_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_OAUTH_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_OAUTH_TOKEN"}
response = requests.request("PUT", url, data=payload, headers=headers, params=querystring)
print(response.text)require 'storyblok'client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_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: .oauth("YOUR_OAUTH_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 = OAuth("YOUR_OAUTH_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>())
Thanks! We received your feedback.
An error occurred. Please try again.
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