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

Response

Body

{
  "stories": [

  ]
}

Get a single story

Endpoint

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

Request

cURL

curl "https://api.storyblok.com/v1/spaces/1127/stories/1937" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMDcyLCJ0aW1lc3RhbXAiOjE1MTU1MzA4NDZ9.pp2R3ZE-QRb87DmGPM7_38sAGv5dwNQTgn9kf-PBHOE" \

Response

Body

{
  "story": {
    "name": "Home",
    "parent_id": 0,
    "group_id": "14b62e3f-ab1d-4b7e-965b-03a195b8cbc9",
    "alternates": [

    ],
    "created_at": "2018-01-02T20:47:26.848Z",
    "sort_by_date": null,
    "tag_list": [

    ],
    "updated_at": "2018-01-02T20:47:26.868Z",
    "published_at": null,
    "id": 1937,
    "uuid": "3e6db288-8af8-4058-b119-48f02b2c8069",
    "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": "1514926046"
    },
    "pinned": false,
    "breadcrumbs": [

    ]
  }
}

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/1129/stories" -d '{"story":{"name":"Story 1","content":{"component":"root","body":[]},"path":"/v1/spaces/1129/stories"}}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMDc4LCJ0aW1lc3RhbXAiOjE1MTU1MzA4NDZ9.qHeLT8OC2aIgkQK-RLIG2cZIAZx4unpm-yvAe7G2nSw" \

Response

Body

{
  "story": {
    "name": "Story 1",
    "parent_id": 0,
    "group_id": "f1256b7f-f07d-4cbe-b8ba-fc3d7f5087da",
    "alternates": [

    ],
    "created_at": "2018-01-02T20:47:26.992Z",
    "sort_by_date": null,
    "tag_list": [

    ],
    "updated_at": "2018-01-02T20:47:26.992Z",
    "published_at": null,
    "id": 1938,
    "uuid": "fef13679-8800-48b9-b08a-7c9b71748c72",
    "is_folder": false,
    "content": {
      "component": "root",
      "body": [

      ],
      "_uid": "ee65b1da-a655-4f02-a643-42d67d68aeb0"
    },
    "published": false,
    "slug": "6950b0d0-bf6f-402b-aff6-cd230300315f",
    "path": "/v1/spaces/1129/stories",
    "full_slug": "6950b0d0-bf6f-402b-aff6-cd230300315f",
    "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": "1514926047"
    },
    "pinned": false,
    "breadcrumbs": [

    ]
  }
}

Deleting a story

Endpoint

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

Request

cURL

curl "https://api.storyblok.com/v1/spaces/1142/stories/1953" -d '' -X DELETE \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMTE3LCJ0aW1lc3RhbXAiOjE1MTU1MzA4NDh9.3f5YaO1CdBW0CkQwKsiQrWXzGO-M_aDv4kr0TQstSkk" \

Response

Body

{
  "story": {
    "name": "Home",
    "parent_id": 0,
    "group_id": "aa59223b-4ab3-4088-a268-276eef1a3dae",
    "alternates": [

    ],
    "created_at": "2018-01-02T20:47:28.154Z",
    "sort_by_date": null,
    "tag_list": [

    ],
    "updated_at": "2018-01-02T20:47:28.154Z",
    "published_at": null,
    "id": 1953,
    "uuid": "c34895e4-1f2d-4db9-8125-b6d206b3cdf0",
    "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": "1514926048"
    },
    "pinned": false,
    "breadcrumbs": [

    ]
  }
}

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/1130/stories/1939" -d '{"story":{"name":"Story 1","content":{"component":"root","body":[]}}}' -X PUT \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMDgxLCJ0aW1lc3RhbXAiOjE1MTU1MzA4NDd9.QfVYX9y0aI8aPfVCVAZ0kVSLRfSqw5nyu42xtZwWHL4" \

Response

Body

{
  "story": {
    "name": "Story 1",
    "parent_id": 0,
    "group_id": "703cad13-3872-4f4a-a347-b1820d8de760",
    "alternates": [

    ],
    "created_at": "2018-01-02T20:47:27.054Z",
    "sort_by_date": null,
    "tag_list": [

    ],
    "updated_at": "2018-01-02T20:47:27.071Z",
    "published_at": null,
    "id": 1939,
    "uuid": "e794b0ba-f467-448e-8ec2-6bafd22600de",
    "is_folder": false,
    "content": {
      "component": "root",
      "body": [

      ],
      "_uid": "0c23bfdb-360a-484a-ae2b-bf0864910f6f"
    },
    "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": "1514926047"
    },
    "pinned": false,
    "breadcrumbs": [

    ]
  }
}

Documentation