curl --request GET \
--url https://api.buttercms.com/v2/posts/{slug}/ \
--header 'Authorization: <api-key>'import requests
url = "https://api.buttercms.com/v2/posts/{slug}/"
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/posts/{slug}/', 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/posts/{slug}/",
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/posts/{slug}/"
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/posts/{slug}/")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buttercms.com/v2/posts/{slug}/")
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": {
"next_post": null,
"previous_post": {
"slug": "google-analytics-is-now-integrated-with-your-butter-blog",
"title": "Google Analytics is now integrated with your Butter blog",
"featured_image": "https://d2devwt40at1e2.cloudfront.net/api/file/etSDYJUIFDADGEEAQ/"
}
},
"data": {
"url": "http://www.example.com/blog/hello-world",
"created": "2015-06-12T13:59:32.441289Z",
"published": "2015-06-12T00:00:00Z",
"author": {
"first_name": "API",
"last_name": "Test",
"email": "apitest@buttercms.com",
"slug": "api-test",
"bio": "This is my bio.",
"title": "API",
"linkedin_url": "https://www.linkedin.com/in/API",
"facebook_url": "https://www.facebook.com/API",
"twitter_handle": "buttercmsapi",
"profile_image": "https://buttercms.com/api.png"
},
"categories": [
{
"name": "test category",
"slug": "test-category"
}
],
"tags": [
{
"name": "test tag",
"slug": "test-tag"
}
],
"featured_image": null,
"featured_image_alt": "",
"slug": "hello-world",
"title": "This is a blog post",
"body": "<p class=\"\">This is a blog post to test the API.</p>",
"summary": "This is a blog post to test the API.",
"seo_title": "This is a blog post",
"meta_description": "This is a blog post to test the API.",
"status": "published"
}
}Retrieve Single Post
Retrieve a specific blog post by slug with complete content, metadata, and next/previous post navigation.
curl --request GET \
--url https://api.buttercms.com/v2/posts/{slug}/ \
--header 'Authorization: <api-key>'import requests
url = "https://api.buttercms.com/v2/posts/{slug}/"
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/posts/{slug}/', 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/posts/{slug}/",
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/posts/{slug}/"
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/posts/{slug}/")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buttercms.com/v2/posts/{slug}/")
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": {
"next_post": null,
"previous_post": {
"slug": "google-analytics-is-now-integrated-with-your-butter-blog",
"title": "Google Analytics is now integrated with your Butter blog",
"featured_image": "https://d2devwt40at1e2.cloudfront.net/api/file/etSDYJUIFDADGEEAQ/"
}
},
"data": {
"url": "http://www.example.com/blog/hello-world",
"created": "2015-06-12T13:59:32.441289Z",
"published": "2015-06-12T00:00:00Z",
"author": {
"first_name": "API",
"last_name": "Test",
"email": "apitest@buttercms.com",
"slug": "api-test",
"bio": "This is my bio.",
"title": "API",
"linkedin_url": "https://www.linkedin.com/in/API",
"facebook_url": "https://www.facebook.com/API",
"twitter_handle": "buttercmsapi",
"profile_image": "https://buttercms.com/api.png"
},
"categories": [
{
"name": "test category",
"slug": "test-category"
}
],
"tags": [
{
"name": "test tag",
"slug": "test-tag"
}
],
"featured_image": null,
"featured_image_alt": "",
"slug": "hello-world",
"title": "This is a blog post",
"body": "<p class=\"\">This is a blog post to test the API.</p>",
"summary": "This is a blog post to test the API.",
"seo_title": "This is a blog post",
"meta_description": "This is a blog post to test the API.",
"status": "published"
}
}meta object containing next_post and previous_post navigation links, allowing you to easily implement “Previous/Next” navigation on your blog post pages without additional API calls.
Tip: Use a trailing slash (/v2/posts/your-post-slug/). Without it the request is redirected (301) to the slashed URL, which counts as an extra API call.
Authorizations
Path Parameters
Query Parameters
Return the locale variant of this post (e.g. en, es). Slugs are unique within a blog, so the slug identifies a specific post; this parameter follows the post's locale group to return its sibling translation. Sibling translations may have different slugs from the post identified in the URL path. When omitted, defaults to the locale the post itself was created in.
Returns 404 if no sibling exists in the requested locale (or the post has no locale group). Returns 400 if the value is not a locale configured on your organization.
10Response
Success - Blog Post Retrieved
Returns the complete blog post object along with navigation metadata for browsing between posts.
Was this page helpful?