Search (Management API)
https://mapi.storyblok.com/v1/spaces/:space_id/strata/searchReturns a ranked list of stories whose content matches the search term by meaning. Instead of matching exact keywords, Strata compares the meaning of the search term with the meaning of the indexed content.
For public, high-volume search, use the Content Delivery API search endpoint. This Management API endpoint is best for private queries scoped to the user’s permissions, and it’s rate-limited.
Path parameters
Section titled “Path parameters”:space_idrequired numberNumeric ID of a space.
Query parameters
Section titled “Query parameters”qstringThe search term.
versionstringThe content version to search:
draftorpublished. Default ispublished.limitnumberMaximum number of results to return, between
1and1000. Default is25. Whenstarts_withorcontent_typeis set, the maximum is50.starts_withstringFilter by the story’s
full_slugto return stories starting with the given value, for exampledocs/. 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.
Response properties
Section titled “Response properties”resultsobject[]A ranked array of matches, 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
idnumberNumeric ID of the story.
slugstringFull slug of the story.
namestringName of the story.
{ "results": [ { "excerpt": "You can return any item within 30 days of delivery for a full refund", "score": 0.89, "story": { "id": 1001, "slug": "help/returns", "name": "How to return an order" } }, { "excerpt": "Refunds reach your original payment method within 5 business days", "score": 0.81, "story": { "id": 1044, "slug": "help/faq", "name": "FAQ" } } ]}Examples
Section titled “Examples”curl "https://mapi.storyblok.com/v1/spaces/288868932106293/strata/search\?q=how+do+I+return+an+order\&version=published\&limit=5" \ -H "Authorization: YOUR_PERSONAL_ACCESS_TOKEN"// storyblok-js-client@>=7, node@>=18import Storyblok from "storyblok-js-client";
const storyblok = new Storyblok({ oauthToken: "YOUR_PERSONAL_ACCESS_TOKEN",});
try { const response = await storyblok.get('spaces/288868932106293/strata/search', { "q": "how do I return an order", "version": "published", "limit": "5" }) console.log({ response })} catch (error) { console.log(error)}$client = new \Storyblok\ManagementClient('YOUR_PERSONAL_ACCESS_TOKEN');
$client->get('spaces/288868932106293/strata/search', [ "q" => "how do I return an order", "version" => "published", "limit" => "5"])->getBody();HttpResponse<String> response = Unirest.get("https://mapi.storyblok.com/v1/spaces/288868932106293/strata/search?q=how+do+I+return+an+order&version=published&limit=5") .header("Authorization", "YOUR_PERSONAL_ACCESS_TOKEN") .asString();var client = new RestClient("https://mapi.storyblok.com/v1/spaces/288868932106293/strata/search?q=how+do+I+return+an+order&version=published&limit=5");var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "YOUR_PERSONAL_ACCESS_TOKEN");IRestResponse response = client.Execute(request);import requests
url = "https://mapi.storyblok.com/v1/spaces/288868932106293/strata/search"
querystring = {"q":"how do I return an order","version":"published","limit":"5"}
payload = ""headers = { 'Authorization': "YOUR_PERSONAL_ACCESS_TOKEN"}
response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
print(response.text)require 'storyblok'client = Storyblok::Client.new(oauth_token: 'YOUR_PERSONAL_ACCESS_TOKEN')
client.get('spaces/288868932106293/strata/search', {:params => { "q" => "how do I return an order", "version" => "published", "limit" => "5"}})let storyblok = URLSession(storyblok: .mapi(accessToken: .personal("YOUR_PERSONAL_ACCESS_TOKEN")))var request = URLRequest(storyblok: storyblok, path: "spaces/288868932106293/strata/search")request.url!.append(queryItems: [ URLQueryItem(name: "q", value: "how do I return an order"), URLQueryItem(name: "version", value: "published"), URLQueryItem(name: "limit", value: "5")])let (data, _) = try await storyblok.data(for: request)print(try JSONSerialization.jsonObject(with: data))val client = HttpClient { install(Storyblok(MAPI)) { accessToken = Personal("YOUR_PERSONAL_ACCESS_TOKEN") }}
val response = client.get("spaces/288868932106293/strata/search") { url { parameters.append("q", "how do I return an order") parameters.append("version", "published") parameters.append("limit", "5") }}
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