WrytzeWrytze Docs
SDK

TypeScript SDK

A type-safe TypeScript client for the Wrytze Blog API with automatic error handling and zero runtime dependencies.

The @wrytze/sdk package provides a lightweight, fully typed TypeScript client for the Wrytze Blog API. It wraps the REST API with a clean, intuitive interface so you can fetch blogs, categories, and tags with minimal boilerplate.

Key features

  • Full TypeScript types -- every request and response is strongly typed, with exported interfaces for all API objects.
  • Automatic error handling -- API errors are parsed into structured WrytzeError objects with HTTP status codes.
  • Rate limit handling -- RateLimitError exposes a retryAfter property so you can back off automatically when you hit the 100 req/min limit.
  • Zero runtime dependencies -- built on the native fetch API. Works in Node.js 18+, Bun, Deno, Cloudflare Workers, and any environment with a global fetch.

Quick example

import { WrytzeClient } from "@wrytze/sdk";

const wrytze = new WrytzeClient({
  apiKey: process.env.WRYTZE_API_KEY!,
});

// Fetch the 10 most recent blogs
const { data: blogs, pagination } = await wrytze.blogs.list({ limit: 10 });

for (const blog of blogs) {
  console.log(`${blog.title} (${blog.readingTimeMinutes} min read)`);
}

console.log(`Page ${pagination.page} of ${pagination.pages}`);

Resources

The client exposes three resource namespaces:

ResourceMethodsDescription
wrytze.blogslist, get, getBySlugPublished blog posts with full HTML content
wrytze.categorieslistHierarchical content categories per website
wrytze.tagslistFlat content tags per website

What's next

On this page