curl --request GET \
--url https://api.buttercms.com/v2/feeds/sitemap/ \
--header 'Authorization: <api-key>'import requests
url = "https://api.buttercms.com/v2/feeds/sitemap/"
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/feeds/sitemap/', 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/feeds/sitemap/",
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/feeds/sitemap/"
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/feeds/sitemap/")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buttercms.com/v2/feeds/sitemap/")
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{
"data": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">\n <url>\n <loc>https://example.buttercms.com/blog/api-development-best-practices</loc>\n <lastmod>2024-01-15</lastmod>\n </url>\n <url>\n <loc>https://example.buttercms.com/blog/restful-api-design-principles</loc>\n <lastmod>2024-01-12</lastmod>\n </url>\n</urlset>\n"
}Sitemap
Generate a comprehensive XML sitemap for blog posts optimized for search engine discovery.
curl --request GET \
--url https://api.buttercms.com/v2/feeds/sitemap/ \
--header 'Authorization: <api-key>'import requests
url = "https://api.buttercms.com/v2/feeds/sitemap/"
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/feeds/sitemap/', 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/feeds/sitemap/",
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/feeds/sitemap/"
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/feeds/sitemap/")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buttercms.com/v2/feeds/sitemap/")
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{
"data": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">\n <url>\n <loc>https://example.buttercms.com/blog/api-development-best-practices</loc>\n <lastmod>2024-01-15</lastmod>\n </url>\n <url>\n <loc>https://example.buttercms.com/blog/restful-api-design-principles</loc>\n <lastmod>2024-01-12</lastmod>\n </url>\n</urlset>\n"
}Authorizations
Set the Authorization header to Token your_read_api_token.
Example: Authorization: Token abc123def456
Note: The header value includes the Token prefix. Authorization: Bearer ... is not accepted and returns 401.
You can access your API token from your settings page.
Query Parameters
Your ButterCMS read API token
Filter the sitemap to include only posts from a specific category.
Provide the URL-friendly slug of the category. When specified, only blog posts assigned to this category will be included in the sitemap.
Filter the sitemap to include only posts with a specific tag.
Provide the URL-friendly slug of the tag. When specified, only blog posts tagged with this tag will be included in the sitemap.
Filter the sitemap to include only posts in the given locale (e.g. en, es). When omitted, defaults to your organization's default locale.
Returns 400 if the value is not a locale configured on your organization.
10Response
XML sitemap generated successfully. Note: despite being a sitemap, the response is application/json, and the XML document is returned as a string under data. Requesting Accept: application/xml returns 406 Not Acceptable; there is no XML renderer on this endpoint. Each <url> entry has only <loc> and <lastmod>; there is no <changefreq>.
Complete XML sitemap with blog post URLs, as a string
Was this page helpful?