Get a blog post by slug
const url = 'https://apibase.ecomweb.app/api/v1/public/stores/example/blog/posts/slug/example?status=draft&sort_by=created_at&sort_order=asc&include_seo_metadata=false';const options = { method: 'GET', headers: {'x-store-preview': 'example', 'x-storefront-api-key': '<x-storefront-api-key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://apibase.ecomweb.app/api/v1/public/stores/example/blog/posts/slug/example?status=draft&sort_by=created_at&sort_order=asc&include_seo_metadata=false' \ --header 'x-store-preview: example' \ --header 'x-storefront-api-key: <x-storefront-api-key>'Returns one published or unlisted post by its URL slug, with its categories, tags, recommended product IDs and metafields. The body is empty when no such post exists. Each request counts as a view of the post, except previews. A valid preview_token shows a post whatever its status and does not count a view. The response currently includes merchant-side fields such as author_id, view_count and deleted_at.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The post’s URL slug.
The store’s ref, as returned by GET /stores.
Query Parameters
Section titled “Query Parameters”Return only the post with this ID.
Return only posts with this status.
Return only posts in the category with this ID.
Return only posts in the category with this slug.
Return only posts with the tag with this ID.
Return only posts with the tag with this slug.
Return only featured (or only non-featured) posts.
Free-text search over title, content and excerpt.
Filter posts with any relevant date >= this value (ISO 8601)
Filter posts with any relevant date < this value (ISO 8601)
Field to sort by. The store list also accepts updated_at. Defaults to published_at.
Sort direction. Defaults to desc.
Maximum number of posts to return. Defaults to 10.
Number of posts to skip. Defaults to 0.
Include author details if available
Example
trueInclude SEO metadata in the response
Signed preview token to bypass status filter for draft/scheduled posts
Header Parameters
Section titled “Header Parameters”Responses
Section titled “Responses”The post, or an empty body when no post matches.
object
Post body as HTML, or null when empty.
Table of contents generated from the headings in content.
object
Anchor ID of the heading.
Heading level, from 1 to 6.
Text of the heading.
Position of the heading in the post content.
Short summary shown in listings, or null.
URL of the featured image, or null.
SEO title and description. Present only when requested with include_seo_metadata.
object
Page title for search engines, or null.
Page description for search engines, or null.
Publication status. Only published posts are visible on the storefront list; unlisted posts are reachable by their link.
Categories of the post.
object
ID.
Display name.
URL slug, unique within the store.
Description. Present on categories only; null when none is set.
Hex colour such as #ff6600. Present on categories only; null when none is set.
Manual position in the category list. Present on categories only.
When it was created, as an ISO 8601 timestamp.
When it was last updated, as an ISO 8601 timestamp. Present on categories only.
Tags of the post.
object
ID.
Display name.
URL slug, unique within the store.
Description. Present on categories only; null when none is set.
Hex colour such as #ff6600. Present on categories only; null when none is set.
Manual position in the category list. Present on categories only.
When it was created, as an ISO 8601 timestamp.
When it was last updated, as an ISO 8601 timestamp. Present on categories only.
IDs of the products recommended in the post, in display order. Present on single-post responses.
The post’s metafields that are visible to the storefront, keyed by namespace.key.
object
object
The metafield’s type, such as single_line_text_field or list.number_integer.
Post ID.
Title.
URL slug, unique within the store.
Whether the post is marked as featured.
When a scheduled post will be published, as an ISO 8601 timestamp, or null.
When the post was published, as an ISO 8601 timestamp, or null while unpublished.
ID of the user who created the post, or null (for example when created with an API key).
Name or email of the author. Present when the author is known and, on lists, when include_author is set.
Number of storefront views.
Estimated reading time in minutes.
When the post was created, as an ISO 8601 timestamp.
When the post was last updated, as an ISO 8601 timestamp.
When the post was deleted, or null. Deleted posts are not returned.
Example
{ "status": "draft"}The request is malformed or failed validation.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}