Managing Stories

Getting a list of stories

Endpoint

GET /v1/spaces/:space_id/stories

Parameters

Name Description
page Current page of stories

Request

Query Parameters

page=1

cURL

curl "https://api.storyblok.com/v1/spaces/1047/stories?page=1" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNjE1LCJ0aW1lc3RhbXAiOjE1MTEwNzk1MjB9.RQXezpUdEBi-B7L8lTdpnGQwEOQLFNPu1goyrgo_uww" \
	-H "Host: example.org" \
	-H "Cookie: "

Response

Body

{
  "stories": [

  ]
}

Get a single story

Endpoint

GET /v1/spaces/:space_id/stories/:id

Request

cURL

curl "https://api.storyblok.com/v1/spaces/1046/stories/1451" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNjEyLCJ0aW1lc3RhbXAiOjE1MTEwNzk1MjB9.3NYYSoZZaDY5GUeHweP7TVWC0HZejfbSgwEnAsxdpNE" \
	-H "Host: example.org" \
	-H "Cookie: "

Response

Body

{
  "story": {
    "name": "Home",
    "parent_id": 0,
    "group_id": "439e649b-61bd-42ba-92ff-f0aa4cfda918",
    "alternates": [

    ],
    "created_at": "2017-11-12T08:18:40.489Z",
    "sort_by_date": null,
    "tag_list": [

    ],
    "updated_at": "2017-11-12T08:18:40.515Z",
    "published_at": null,
    "id": 1451,
    "uuid": "241516c5-058e-46aa-bc3d-67e464eb95bc",
    "is_folder": false,
    "content": {
      "_uid": "xyz",
      "body": [
        {
          "_uid": "a9e16ab8-887f-4001-9548-313a09daeb2a",
          "text": "test1",
          "component": "headline"
        },
        {
          "_uid": "89a3cd23-8fd1-4ddc-abfe-a6396d012d14",
          "text": "test2",
          "component": "headline"
        }
      ],
      "component": "root"
    },
    "published": false,
    "slug": "home",
    "path": null,
    "full_slug": "home",
    "default_root": null,
    "disble_fe_editor": false,
    "parent": null,
    "is_startpage": false,
    "unpublished_changes": null,
    "meta_data": null,
    "imported_at": null,
    "preview_token": {
      "token": "",
      "timestamp": "1510474720"
    },
    "pinned": false,
    "breadcrumbs": [

    ]
  }
}

Creating an story

Endpoint

POST /v1/spaces/:space_id/stories

Parameters

Name Description
name required Name of story
slug required Slug to be used to receive the story from the api
content JSON tree of the content
disble_fe_editor Wether to disable the visual editor
default_root Defaul root component. (Required if a folder story)
is_folder Wether the story acts as a folder
group_id Group ID. For example to make linkages between language versions
path Url path the editor is opening the story
is_startpage Wether the story is a startpage for this folder
parent_id Id of the parent folder
sort_by_date Sort by date
meta_data Key value pairs to add meta data that is not setting the story status to unpublished changes. Example: User ratings.
pinned To pin the story in the toolbar

Request

cURL

curl "https://api.storyblok.com/v1/spaces/1048/stories" -d '{"story":{"name":"Story 1","content":{"component":"root","body":[]},"path":"/v1/spaces/1048/stories"}}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNjE4LCJ0aW1lc3RhbXAiOjE1MTEwNzk1MjB9.WXN7MSV_5WPGlehjjjCAvRt8bjQ6yHA5cFSUcb9kCf4" \
	-H "Host: example.org" \
	-H "Cookie: "

Response

Body

{
  "story": {
    "name": "Story 1",
    "parent_id": 0,
    "group_id": "a6469325-833a-40f7-8fa6-277e0eb17077",
    "alternates": [

    ],
    "created_at": "2017-11-12T08:18:40.664Z",
    "sort_by_date": null,
    "tag_list": [

    ],
    "updated_at": "2017-11-12T08:18:40.664Z",
    "published_at": null,
    "id": 1452,
    "uuid": "219ec6e9-b8c5-4d4a-b9b6-670858e511e2",
    "is_folder": false,
    "content": {
      "component": "root",
      "body": [

      ],
      "_uid": "0dd9b932-bf7c-410b-b037-eaebba550572"
    },
    "published": false,
    "slug": "ad89c243-bc77-4fbe-a08e-4693416f7192",
    "path": "/v1/spaces/1048/stories",
    "full_slug": "ad89c243-bc77-4fbe-a08e-4693416f7192",
    "default_root": null,
    "disble_fe_editor": false,
    "parent": null,
    "is_startpage": false,
    "unpublished_changes": null,
    "meta_data": null,
    "imported_at": null,
    "preview_token": {
      "token": "",
      "timestamp": "1510474720"
    },
    "pinned": false,
    "breadcrumbs": [

    ]
  }
}

Deleting a story

Endpoint

DELETE /v1/spaces/:space_id/stories/:id

Request

cURL

curl "https://api.storyblok.com/v1/spaces/1061/stories/1467" -d '' -X DELETE \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNjU3LCJ0aW1lc3RhbXAiOjE1MTEwNzk1MjF9.KsXNwT4Qwt6ZANpc7u71IYHx7sAXNHTCmL3kOzRzjNE" \
	-H "Host: example.org" \
	-H "Cookie: "

Response

Body

{
  "story": {
    "name": "Home",
    "parent_id": 0,
    "group_id": "e6643ead-bfce-40db-b2cd-83857276ebdd",
    "alternates": [

    ],
    "created_at": "2017-11-12T08:18:41.981Z",
    "sort_by_date": null,
    "tag_list": [

    ],
    "updated_at": "2017-11-12T08:18:41.981Z",
    "published_at": null,
    "id": 1467,
    "uuid": "2a205552-8b98-48e5-9825-3ef87b339456",
    "is_folder": false,
    "content": {
      "_uid": "xyz",
      "body": [
        {
          "_uid": "a9e16ab8-887f-4001-9548-313a09daeb2a",
          "text": "test1",
          "component": "headline"
        },
        {
          "_uid": "89a3cd23-8fd1-4ddc-abfe-a6396d012d14",
          "text": "test2",
          "component": "headline"
        }
      ],
      "component": "root"
    },
    "published": false,
    "slug": "home",
    "path": null,
    "full_slug": "home",
    "default_root": null,
    "disble_fe_editor": false,
    "parent": null,
    "is_startpage": false,
    "unpublished_changes": null,
    "meta_data": null,
    "imported_at": null,
    "preview_token": {
      "token": "",
      "timestamp": "1510474722"
    },
    "pinned": false,
    "breadcrumbs": [

    ]
  }
}

Updating a story

Endpoint

PUT /v1/spaces/:space_id/stories/:id

Parameters

Name Description
name required Name of story
content JSON tree of the content

Request

cURL

curl "https://api.storyblok.com/v1/spaces/1049/stories/1453" -d '{"story":{"name":"Story 1","content":{"component":"root","body":[]}}}' -X PUT \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNjIxLCJ0aW1lc3RhbXAiOjE1MTEwNzk1MjB9.b0Jo7okytK4eRoQG8Th4sjzsqZX4W-PqbBpfXdBrs6s" \
	-H "Host: example.org" \
	-H "Cookie: "

Response

Body

{
  "story": {
    "name": "Story 1",
    "parent_id": 0,
    "group_id": "6b649429-e47e-4e41-ac42-f5578bdb8bed",
    "alternates": [

    ],
    "created_at": "2017-11-12T08:18:40.739Z",
    "sort_by_date": null,
    "tag_list": [

    ],
    "updated_at": "2017-11-12T08:18:40.756Z",
    "published_at": null,
    "id": 1453,
    "uuid": "643e3296-8d5e-4a4e-958c-0b5c2bd1f140",
    "is_folder": false,
    "content": {
      "component": "root",
      "body": [

      ],
      "_uid": "c646a313-9735-4ddc-99ff-522dec41e43d"
    },
    "published": false,
    "slug": "home",
    "path": null,
    "full_slug": "home",
    "default_root": null,
    "disble_fe_editor": false,
    "parent": null,
    "is_startpage": false,
    "unpublished_changes": true,
    "meta_data": null,
    "imported_at": null,
    "preview_token": {
      "token": "",
      "timestamp": "1510474720"
    },
    "pinned": false,
    "breadcrumbs": [

    ]
  }
}

Documentation