curl --request GET \
--url https://api.buttercms.com/v2/pages/search/ \
--header 'Authorization: <api-key>'import requests
url = "https://api.buttercms.com/v2/pages/search/"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.buttercms.com/v2/pages/search/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.buttercms.com/v2/pages/search/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.buttercms.com/v2/pages/search/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.buttercms.com/v2/pages/search/")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buttercms.com/v2/pages/search/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"meta": {
"previous_page": null,
"next_page": null,
"count": 2
},
"data": [
{
"slug": "example-news-page",
"name": "Example News Page",
"page_type": "news",
"published": "2019-11-12T17:23:53.109696Z",
"updated": "2020-10-22T20:07:52.965850Z",
"fields": {
"seo": {
"title": "Example News Page",
"description": "SEO Description",
"keywords": "SEO, Keywords"
},
"headline": "This is an example news page",
"sections": [
{
"fields": {
"headline": "...",
"subheadline": "...",
"call_to_action": "..."
},
"type": "hero"
}
]
}
},
{
"slug": "example-news-page-2",
"name": "Example News Page 2",
"page_type": "news",
"published": "2019-11-12T17:23:53.109696Z",
"updated": "2020-10-22T20:07:52.965850Z",
"fields": {
"seo": {
"title": "Example News Page",
"description": "SEO Description",
"keywords": "SEO, Keywords"
},
"headline": "This is another news page",
"sections": [
{
"fields": {
"video_headline": "...",
"video_link": "..."
},
"type": "product_video"
}
]
}
}
]
}Search Pages
Search for pages using a text query. Results are sorted by relevance and can be filtered by page type.
curl --request GET \
--url https://api.buttercms.com/v2/pages/search/ \
--header 'Authorization: <api-key>'import requests
url = "https://api.buttercms.com/v2/pages/search/"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.buttercms.com/v2/pages/search/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.buttercms.com/v2/pages/search/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.buttercms.com/v2/pages/search/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.buttercms.com/v2/pages/search/")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buttercms.com/v2/pages/search/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"meta": {
"previous_page": null,
"next_page": null,
"count": 2
},
"data": [
{
"slug": "example-news-page",
"name": "Example News Page",
"page_type": "news",
"published": "2019-11-12T17:23:53.109696Z",
"updated": "2020-10-22T20:07:52.965850Z",
"fields": {
"seo": {
"title": "Example News Page",
"description": "SEO Description",
"keywords": "SEO, Keywords"
},
"headline": "This is an example news page",
"sections": [
{
"fields": {
"headline": "...",
"subheadline": "...",
"call_to_action": "..."
},
"type": "hero"
}
]
}
},
{
"slug": "example-news-page-2",
"name": "Example News Page 2",
"page_type": "news",
"published": "2019-11-12T17:23:53.109696Z",
"updated": "2020-10-22T20:07:52.965850Z",
"fields": {
"seo": {
"title": "Example News Page",
"description": "SEO Description",
"keywords": "SEO, Keywords"
},
"headline": "This is another news page",
"sections": [
{
"fields": {
"video_headline": "...",
"video_link": "..."
},
"type": "product_video"
}
]
}
}
]
}levels parameter provided. Pages are returned sorted by relevancy to the search query.
Page Type Filtering: You can optionally limit your search to a specific page type, or search only Single Pages using * as the page type parameter.
Empty Results: If no results are found, the API returns an empty array: "data": []
See also: Architecture & Performance for guidance on levels, pagination, and performance best practices.Authorizations
Query Parameters
The slug of the type of pages you want to limit your search to.
- Use
*if you want to search only Single Pages (without a Page Type) - Use a specific page type slug to limit search to that type
- Omit this parameter to search across all page types
Maximum Length: 100 characters
100Depth of relationship serialization.
Controls how many levels of referenced content to include:
- 1: Direct fields only, references as URIs
- 2: Direct fields + one level of references (default)
- 3-5: Deeper relationship traversal
Note: Unlike the Pages list/retrieve endpoints, this parameter is strictly validated on search: a value outside 1-5 is rejected with a 400, not capped.
1 <= x <= 5Response
Success
Returns a hash with a data property that contains an array of pages matching the search query, and a meta property that contains pagination information.
Search Results: Pages are returned sorted by relevancy. If no results are found, returns an empty array: "data": []
Content Searched: Only direct page content is searched. References are excluded from search but included in response based on levels parameter.
Was this page helpful?