For Developers
API

API-Based Approach

Integrate Lightweight blog content directly into your existing website or application. Write content in our editor, fetch it via API, and display it your way.

Perfect For
  • Developers who want to integrate blog content into an existing website
  • Teams who need full control over styling and layout
  • Applications that need programmatic access to blog data
  • Projects using any JavaScript framework (Next.js, React, Vue, etc.)

Why Use the API?

Full Control

Fetch blog data and render it exactly how you want in your own application.

Your Stack

Works with any framework—Next.js, React, Vue, Svelte, or vanilla JavaScript.

High Performance

Content delivered via global CDN with intelligent caching.

Secure

API key authentication keeps your content secure.

How It Works

1

Create Content in Lightweight

Use our powerful editor to write and manage your blog posts. Content is automatically synced and optimized for delivery.

2

Get Your API Key

Each project has a unique API key. Find it in your project settings and add it to your environment variables.

3

Fetch & Display

Use our npm package to fetch posts, categories, and more. Render the content however you like in your application.

The Lightweight Client

lightweight-client

Our official npm package provides a type-safe client for fetching blog data. It handles authentication, caching, and error handling for you.

npm install lightweight-client

Quick Example

import { LightweightClient } from 'lightweight-client';

// Initialize the client with your API key
const client = new LightweightClient(process.env.LIGHTWEIGHT_API_KEY);

// Fetch all posts
const posts = await client.getPosts(0, 10);

// Fetch a single post by slug
const post = await client.getPost('my-first-post');

// Fetch categories
const categories = await client.getCategories();
API Key Security
  • Store your API key in environment variables, never in client-side code
  • Use LIGHTWEIGHT_API_KEY as your environment variable name
  • Make API calls from server-side code (API routes, server components, etc.)
  • You can regenerate your API key anytime from your project settings

Prefer a Simpler Setup?

If you don't need to integrate with an existing site, our No-Code Approach gives you a fully-hosted blog with themes, custom domains, and zero development required.