Skip to main content
Developer-friendly & type-safe TypeScript SDK for the Marble API. Built with automatic retries, pagination helpers, and full TypeScript support.

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:
Set the MARBLE_API_KEY environment variable and the SDK will automatically use it.

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:
For a complete guide on filtering options and behavior, see the Filtering documentation.

Pagination

Paginated endpoints return an async iterable. Use for await...of to iterate through pages:
For full pagination details and response fields, see the Pagination documentation.

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.