Save a story draft
const url = 'https://example.com/api/stories/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/draft';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"revision":1,"document":{"version":1,"chapters":[{"id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","title":"example","scene":{"map_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","camera":{"center":["example"],"zoom":1,"bearing":0,"pitch":0},"layer_visibility":{"additionalProperty":true},"transition":"fly"},"scene_hidden":false,"blocks":[{"id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","title":"example","type":"markdown","v":1,"config":{"text":"example"}}]}],"settings":{"navigation":false,"layout":"side","panel_position":"left","theme":"follow","transition":"fly"}}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://example.com/api/stories/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/draft \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "revision": 1, "document": { "version": 1, "chapters": [ { "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "title": "example", "scene": { "map_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "camera": { "center": [ "example" ], "zoom": 1, "bearing": 0, "pitch": 0 }, "layer_visibility": { "additionalProperty": true }, "transition": "fly" }, "scene_hidden": false, "blocks": [ { "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "title": "example", "type": "markdown", "v": 1, "config": { "text": "example" } } ] } ], "settings": { "navigation": false, "layout": "side", "panel_position": "left", "theme": "follow", "transition": "fly" } } }'Replace the whole draft (owner or admin). Readers keep the published document until Publish.
revision must match the stored draft’s, or 409 stale_revision. 422
for an unknown or invalid block, for a scene on a map you can’t read
(detail.code story_maps_not_found), for an image block naming an
image this story doesn’t have (story_assets_not_found), or for an
embed or video block whose host isn’t approved
(story_frame_host_not_allowed, the blocks under detail.blocks). Blocks
you can’t see and scenes sent back with scene_hidden are kept as stored.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Request Bodyrequired
Section titled “ Request Bodyrequired ”object
The draft revision this save replaces.
object
object
Made by the client and stable across saves.
object
object
Longitude, latitude.
Visibility by map layer id. Layers the map no longer has are ignored, and a layer left out keeps its saved visibility.
object
Send back as read to keep a scene on a map you can’t read; with it false, a chapter without a scene loses its stored one.
object
Made by the client and stable across saves.
An image uploaded to the host story.
object
Made by the client and stable across saves.
object
object
Made by the client and stable across saves.
object
object
Made by the client and stable across saves.
object
An http or https address; any other scheme is refused.
Open the link in a new tab.
object
Made by the client and stable across saves.
object
An https address on a host an admin approved for stories. Stored as given and never fetched by the server.
Names the frame for screen readers.
object
Made by the client and stable across saves.
object
An https address on a host an admin approved for stories. Stored as given and never fetched by the server.
Names the frame for screen readers.
object
Show the chapter navigation bar.
Chapter panel beside the map or floating over it.
Where a floating panel sits.
Reader page theme; follow uses the reader’s.
How the map moves into a chapter whose scene sets no transition.
Responses
Section titled “ Responses ”Successful Response
object
A story’s visibility as stored. A private story shared with groups is
restricted: its groups’ members read it too.
object
object
object
object
Longitude, latitude.
Visibility by map layer id. Layers the map no longer has are ignored, and a layer left out keeps its saved visibility.
object
The chapter has a scene on a map you can’t read, so it’s shown without one.
object
Made by the client and stable across saves.
An image uploaded to the host story.
object
Made by the client and stable across saves.
object
object
Made by the client and stable across saves.
object
object
Made by the client and stable across saves.
object
An http or https address; any other scheme is refused.
Open the link in a new tab.
object
Made by the client and stable across saves.
object
An https address on a host an admin approved for stories. Stored as given and never fetched by the server.
Names the frame for screen readers.
object
Made by the client and stable across saves.
object
An https address on a host an admin approved for stories. Stored as given and never fetched by the server.
Names the frame for screen readers.
object
Show the chapter navigation bar.
Chapter panel beside the map or floating over it.
Where a floating panel sits.
Reader page theme; follow uses the reader’s.
How the map moves into a chapter whose scene sets no transition.
The sharing groups the story is shared with, by name.
object
Unique group identifier.
Group name.
Example
{ "visibility": "private", "document": { "chapters": [ { "scene": { "camera": { "bearing": 0, "pitch": 0 }, "transition": "fly" }, "scene_hidden": false, "blocks": [ { "type": "markdown", "v": 1 } ] } ], "settings": { "navigation": false, "layout": "side", "panel_position": "left", "theme": "follow", "transition": "fly" } }}Bad request — invalid payload
Unauthorized — missing or invalid credentials
Forbidden — caller lacks write access
Not found
Maps the story uses are narrower than its visibility (detail.code maps_narrower_than_story, the maps under detail.maps), a stale draft revision (stale_revision), or another change holding the story’s lock (no detail.code).
Validation error
Too many requests — retry after the advertised interval
Headers
Section titled “ Headers ”Seconds until the request may be retried
Internal server error
Service unavailable — the database could not serve the request