$ cli-blog docs
Quickstarts by surface

Build with the Node SDK

Create and deliver posts with typed methods from Node.js 20+.

Use the first-party Node SDK for typed publishing workflows in servers, scripts, continuous integration, and trusted agents.

Install the package

npm install @cli-blog/node

Create and publish a draft

Keep the private key in trusted code:

import { CliBlog } from "@cli-blog/node";

const publishing = new CliBlog({
  apiKey: process.env.CLI_BLOG_PRIVATE_API_KEY!,
});

const draft = await publishing.posts.create({
  title: "Shipping an API-first blog",
  body_markdown: "## What shipped\n\nA reviewed product update.",
  locale: "en-US",
  status: "draft",
});

const published = await publishing.posts.publish(draft.id, {
  expected_version: draft.version,
});

Read with a public client

Use a separate public key for published delivery reads:

const delivery = new CliBlog({
  apiKey: process.env.CLI_BLOG_PUBLIC_API_KEY!,
});

const posts = await delivery.posts.list({
  status: "published",
  fields: ["summary", "seo"],
  limit: 20,
});

Continue with the complete Node SDK reference.

On this page