Retrieve a Single Story
Returns a single story object for the specified full_slug, id or uuid.
https://api.storyblok.com/v2/cdn/stories/(:full_slug|:id|:uuid)Path parameters
Section titled “Path parameters”- :full_slug string
Story full slug
- :id number
Story ID
- :uuid string
Story UUID
Query parameters
Section titled “Query parameters”- token required string
A preview or public access token
- find_by uuid
Required when using the story UUID as a path parameter.
- version draft | published
Default:
published - cv number
Cached version Unix timestamp (see Cache Invalidation)
- resolve_links story | url | link
Resolve link fields. Resolved links are included in the
linksproperty of the response.link: Provides access to additional information, such as a linked story’spath,parent_id,is_folder,published,is_startpage,position,alternates,real_path, and more.url: If only the path of a linked story is required, this value provides the minimum amount of information.story: Resolves and returns the complete story object of a linked story.
- resolve_links_level 1 | 2
Default:
1. Resolve up to two levels of links. - resolve_relations string
Used to resolve referenced stories. Resolved stories are included in the
relsproperty of the response.A maximum of
50stories can be resolved. If this limit is exceeded, the story UUIDs are included in therel_uuidsproperty of the response and can be resolved in subsequent API requests. Entries can be resolved two levels deep.To resolve the stories selected in one field, provide the technical name of the immediate parent component of the field, followed by a
.and the field name. To resolve the stories selected in multiple fields, provide a comma-separated list.Example:
resolve_relations=page.author,page.categories - resolve_level 2
Used to force resolve second-level relations when the first level reaches a limit of 100 relations.
While resolving relations, if the first level exceeds
100relations, the API, by default, stops looking for the second level. Usingresolve_level=2, second-level relations can be resolved even when the limit of first-level relations is reached. - resolve_assets number
Used to resolve asset metadata, including custom metadata. Resolved assets is included in the
assetsproperty of the response. Only available in higher-tier plans. Refer to Pricing for further information. - fallback_lang string
Define a custom fallback language to handle untranslated fields. Accepts any language code that is configured in the Storyblok space. Note that the language code needs to be provided with underscores, even if it is defined with hyphens. E.g.,
es_coinstead ofes-co. - language string
Retrieve translated story version. Accepts any language code that is configured in the Storyblok space.
Response properties
Section titled “Response properties”- storyThe complete story object
- relsArray of resolved stories
- linksAn array of resolved links
- rel_uuidsAn array of all UUIDS of referenced stories (if the limit of resolvable relations is exceeded)
- link_uuidsAn array of all UUIDS of linked stories (if the limit of resolvable links is exceeded)
Examples
Section titled “Examples”curl "https://api.storyblok.com/v2/cdn/stories/posts/my-third-post?token=ask9soUkv02QqbZgmZdeDAtt"// Using the Universal JavaScript Client:// https://github.com/storyblok/storyblok-js-clientStoryblok.get('cdn/stories/posts/my-third-post', {}) .then(response => { console.log(response) }).catch(error => { console.log(error) })$client = new \Storyblok\Client('YOUR_STORYBLOK_SPACE_ACCESS_TOKEN');
$client->getStoryBySlug('posts/my-third-post')->getBody();HttpResponse<String> response = Unirest.get("https://api.storyblok.com/v2/cdn/stories/posts/my-third-post?token=ask9soUkv02QqbZgmZdeDAtt") .asString();var client = new RestClient("https://api.storyblok.com/v2/cdn/stories/posts/my-third-post?token=ask9soUkv02QqbZgmZdeDAtt");var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);import requests
url = "https://api.storyblok.com/v2/cdn/stories/posts/my-third-post"
querystring = {"token":"ask9soUkv02QqbZgmZdeDAtt"}
payload = ""headers = {}
response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
print(response.text)require 'storyblok'client = Storyblok::Client.new(token: 'YOUR_TOKEN')
client.story('posts/my-third-post')import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "https://api.storyblok.com/v2/cdn/stories/posts/my-third-post?token=ask9soUkv02QqbZgmZdeDAtt")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)request.method = "GET"
let session = URLSession.sharedlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) }})
dataTask.resume(){ "story": { "name": "My third post", "created_at": "2024-02-08T16:26:24.425Z", "published_at": "2024-02-08T16:30:09.300Z", "id": 440448565, "uuid": "e656e146-f4ed-44a2-8017-013e5a9d9395", "content": { "_uid": "cfe0ff0b-3211-4bb7-8128-66e6ad262a56", "component": "page" }, "slug": "my-third-post", "full_slug": "posts/my-third-post", "sort_by_date": null, "position": 0, "tag_list": [], "is_startpage": false, "parent_id": 440448337, "meta_data": null, "group_id": "b913a671-f1e9-436a-bc5d-2795d2740198", "first_published_at": "2024-02-08T16:27:05.705Z", "release_id": null, "lang": "default", "path": null, "alternates": [ { "id": 440452827, "name": "Mein dritter Beitrag", "slug": "mein-dritter-beitrag", "published": true, "full_slug": "beitraege/mein-dritter-beitrag", "is_folder": false, "parent_id": 440452826 } ], "default_full_slug": "posts/my-third-post", "translated_slugs": [ { "path": "posts/my-third-post", "name": null, "lang": "fr", "published": null }, { "path": "posts/mein-dritter-beitrag", "name": "Mein dritter Beitrag", "lang": "de", "published": true } ] }, "cv": 1707409909, "rels": [], "links": []}Get in touch with the Storyblok community