Classes
Class: BlogPostsResource
Blog posts sub-resource
Blog posts sub-resource
Methods
getBySlug()
getBySlug(slug, options?): Promise<BlogPost>;
Get a single blog post by its slug
Parameters
| Parameter | Type | Description |
|---|---|---|
slug | string | The post slug |
options? | PreviewOption & MediaOption | - |
Returns
Promise<BlogPost>
The blog post object
Throws
If the post is not found
Example
const post = await client.blog.posts.getBySlug('my-first-post')
console.log(post.title)
console.log(post.content)
list()
list(options?): Promise<BlogPostListResponse>;
List all published blog posts
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | BlogPostListOptions | Query options for filtering, pagination, and sorting |
Returns
Promise<BlogPostListResponse>
Paginated list of blog posts
Example
// Get latest posts
const result = await client.blog.posts.list({
page: 1,
limit: 10,
sort: '-publishedAt'
})
// Filter by category
const categoryPosts = await client.blog.posts.list({
categoryId: 'cat123'
})
// Search posts
const searchResults = await client.blog.posts.list({
search: 'typescript'
})
// Opt in to full post body — list responses omit `content` unless includeContent is set
const withBodies = await client.blog.posts.list({ includeContent: true })
// With filters
const filtered = await client.blog.posts.list({
filters: [
{ field: 'publishedAt', operator: 'gte', value: '2024-01-01' }
]
})

