Installation
This package is published with CommonJS and ES Modules (ESM) support.
Quick Start
Authentication
The SDK uses API key authentication. Pass your API key when initializing the client:Available Resources
Posts
- List all posts
- Get a single post
Categories
- List all categories
- Get a single category
Tags
- List all tags
- Get a single tag
Authors
- List all authors
- Get a single author
Fields
- List custom fields
- Create and update field definitions
- Write field values on posts
Filtering Posts
Filter posts by categories, tags, or featured status:Scheduling Posts
Setstatus to scheduled and publishedAt to a future time. Marble publishes the post within about a minute of that time. This needs a private API key:
posts.update to change a scheduled post:
posts.list({ status: "scheduled" }). The default list returns published posts only, and status: "all" leaves scheduled posts out.
The SDK’s publishedAt is a JavaScript Date, so it always sends an exact moment in UTC. The workspace-time form in the REST API isn’t available here. For the full rules, see Scheduling a post.
Pagination
Paginated endpoints return an async iterable. Usefor await...of to iterate through pages:
Error Handling
The SDK provides typed error classes for different error scenarios:Retries
The SDK automatically retries failed requests. You can customize retry behavior:Framework Guides
Astro
Use Content Collections with Astro.
Framer
Sync content to Framer CMS with the Marble plugin.
Next.js
Build static and server-rendered pages.
TanStack Start
Server functions with TanStack Start.
Additional Resources
NPM Package
View the package on npm.
GitHub
View the source code.