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/198/stories?page=1" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyODUsInRpbWVzdGFtcCI6MTUyMzk2MzQ0Nn0.1uG_RzahHRHYBW7eRAk74BECO776AlSWtbWvZNr3GTI" \

Response

Body

{
  "stories": [

  ]
}

Get a single story

Endpoint

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

Request

cURL

curl "https://api.storyblok.com/v1/spaces/197/stories/270" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyODIsInRpbWVzdGFtcCI6MTUyMzk2MzQ0Nn0.IUR-e7oXM2D5i9P0Oz4SE3BRaINm0Vf7h_uquQ75wgw" \

Response

Body

{
  "story": {
    "name": "Home",
    "parent_id": 0,
    "group_id": "ce04d248-cf9c-4cfc-98a6-991758a98cd7",
    "alternates": [

    ],
    "created_at": "2018-04-10T11:10:46.846Z",
    "sort_by_date": null,
    "tag_list": [

    ],
    "updated_at": "2018-04-10T11:10:46.870Z",
    "published_at": null,
    "id": 270,
    "uuid": "2b394ae9-cabd-49b8-baae-1027062c8ac2",
    "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": "1523358646"
    },
    "pinned": false,
    "breadcrumbs": [

    ],
    "publish_at": null,
    "expire_at": null
  }
}

Creating an story

Endpoint

POST /v1/spaces/:space_id/stories

Parameters

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

Request

cURL

curl "https://api.storyblok.com/v1/spaces/199/stories" -d '{"story":{"name":"Story 1","content":{"component":"root","body":[]},"path":"/v1/spaces/199/stories"}}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyODgsInRpbWVzdGFtcCI6MTUyMzk2MzQ0Nn0.9ddRrsVpfjfw13jFQkIS9skCbiT9UFP4YMBkO-2vIXg" \

Response

Body

{
  "story": {
    "name": "Story 1",
    "parent_id": 0,
    "group_id": "4576de84-f247-4458-8bad-39a620d5353a",
    "alternates": [

    ],
    "created_at": "2018-04-10T11:10:47.005Z",
    "sort_by_date": null,
    "tag_list": [

    ],
    "updated_at": "2018-04-10T11:10:47.005Z",
    "published_at": null,
    "id": 271,
    "uuid": "32d59ce1-5eb1-48ab-bdb2-2b2f8f8910e4",
    "is_folder": false,
    "content": {
      "component": "root",
      "body": [

      ],
      "_uid": "f561c76d-3c0b-4460-92bc-e39d50153285"
    },
    "published": false,
    "slug": "6095139e-a0e7-43ca-bdca-6a64bdbb9b84",
    "path": "/v1/spaces/199/stories",
    "full_slug": "6095139e-a0e7-43ca-bdca-6a64bdbb9b84",
    "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": "1523358647"
    },
    "pinned": false,
    "breadcrumbs": [

    ],
    "publish_at": null,
    "expire_at": null
  }
}

Deleting a story

Endpoint

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

Request

cURL

curl "https://api.storyblok.com/v1/spaces/212/stories/286" -d '' -X DELETE \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozMjcsInRpbWVzdGFtcCI6MTUyMzk2MzQ0OH0.EA4OEAtRlm-RcGoseFhLL1g2o1ZWs3nQCT3S-57tIQI" \

Response

Body

{
  "story": {
    "name": "Home",
    "parent_id": 0,
    "group_id": "b9870ff9-2574-4cc2-bfff-4af9857074ce",
    "alternates": [

    ],
    "created_at": "2018-04-10T11:10:48.182Z",
    "sort_by_date": null,
    "tag_list": [

    ],
    "updated_at": "2018-04-10T11:10:48.182Z",
    "published_at": null,
    "id": 286,
    "uuid": "6dbf26a3-7c17-43ba-be1b-5decb0643015",
    "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": "1523358648"
    },
    "pinned": false,
    "breadcrumbs": [

    ],
    "publish_at": null,
    "expire_at": null
  }
}

Updating a story

Endpoint

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

Parameters

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

Request

cURL

curl "https://api.storyblok.com/v1/spaces/200/stories/272" -d '{"story":{"name":"Story 1","content":{"component":"root","body":[]}}}' -X PUT \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOTEsInRpbWVzdGFtcCI6MTUyMzk2MzQ0N30.ru-px2ZBRJCtF3z1yLbD_knZnY3EH670XIK1_7gV5Ho" \

Response

Body

{
  "story": {
    "name": "Story 1",
    "parent_id": 0,
    "group_id": "a1f67186-fb34-4f0d-8006-4ab0f9d13750",
    "alternates": [

    ],
    "created_at": "2018-04-10T11:10:47.071Z",
    "sort_by_date": null,
    "tag_list": [

    ],
    "updated_at": "2018-04-10T11:10:47.087Z",
    "published_at": null,
    "id": 272,
    "uuid": "c193537f-2c0a-4de3-9eff-831bf8d9cb7b",
    "is_folder": false,
    "content": {
      "component": "root",
      "body": [

      ],
      "_uid": "6e83a3b3-61ff-4a3e-bfb5-f2f958514066"
    },
    "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": "1523358647"
    },
    "pinned": false,
    "breadcrumbs": [

    ],
    "publish_at": null,
    "expire_at": null
  }
}

Documentation