Search
Retrieve stories by meaning through a natural-language query.
https://api.storyblok.com/v2/cdn/strata/searchQuery parameters
Section titled “Query parameters”qstringThe search term. Write it as a natural-language question or phrase.
versionstringThe content version to retrieve:
draftorpublished. Default ispublished. Retrievingdraftrequires a preview access token.limitintegerThe maximum number of results to return. Default is
25. Maximum is100, or50whenstarts_withorcontent_typeis set.starts_withstringFilter by the story’s
full_slugto return items starting with the given value. Matches only the default-language slug, so language prefixes (for example,de/) and translated slugs return no results.content_typestringRetrieve stories of a specific content type block. For example,
content_type=page.tokenrequired stringA preview or public access token configured in a space.
Response properties
Section titled “Response properties”resultsStrataSearchResultsAn array of search result objects, ranked by
scorewith the best match first. A story can appear more than once if it has multiple matching passages.Show child properties
excerptstringThe passage of story content that matches the search term.
scorenumberHow closely the result matches the search term. A higher value means a closer match.
storyobjectThe story that contains the matching passage.
Show child properties
idintegerNumeric ID of the story.
slugstringFull slug of the story.
namestringName of the story.
Examples
Section titled “Examples”curl "https://api.storyblok.com/v2/cdn/strata/search\?q=can+I+send+my+order+back%3F\&token=YOUR_ACCESS_TOKEN"// storyblok-js-client@>=7, node@>=18import Storyblok from "storyblok-js-client";
const storyblok = new Storyblok({ accessToken: "krcV6QGxWORpYLUWt12xKQtt",});
try { const response = await storyblok.get('cdn/strata/search', { "q": "can I send my order back?" }) console.log({ response })} catch (error) { console.log(error)}$client = new \Storyblok\Client('YOUR_STORYBLOK_SPACE_ACCESS_TOKEN');
$client->get('strata/search', [ "q" => "can I send my order back?"])->getBody();HttpResponse<String> response = Unirest.get("https://api.storyblok.com/v2/cdn/strata/search?q=can+I+send+my+order+back%3F&token=YOUR_ACCESS_TOKEN") .asString();var client = new RestClient("https://api.storyblok.com/v2/cdn/strata/search?q=can+I+send+my+order+back%3F&token=YOUR_ACCESS_TOKEN");var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);import requests
url = "https://api.storyblok.com/v2/cdn/strata/search"
querystring = {"q":"can I send my order back?","token":"YOUR_ACCESS_TOKEN"}
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.get('strata/search', {:params => { "q" => "can I send my order back?"}})let storyblok = URLSession(storyblok: .cdn(accessToken: "YOUR_ACCESS_TOKEN"))var request = URLRequest(storyblok: storyblok, path: "strata/search")request.url!.append(queryItems: [ URLQueryItem(name: "q", value: "can I send my order back?")])let (data, _) = try await storyblok.data(for: request)print(try JSONSerialization.jsonObject(with: data))val client = HttpClient { install(Storyblok(CDN)) { accessToken = "YOUR_ACCESS_TOKEN" }}
val response = client.get("strata/search") { url { parameters.append("q", "can I send my order back?") }}
println(response.body<JsonElement>())Was this page helpful?
This site uses reCAPTCHA and Google's Privacy Policy (opens in a new window).Terms of Service (opens in a new window) apply.
Get in touch with the Storyblok community