REST API Integration

AI agents & LLMs: read this documentation as Markdown at nextblog.ai/docs/integration-rest-api.md or browse the per-section Markdown index.

REST API Integration

Use our HTTP APIs with an API key. An account key (nb_u_...) covers every project; a project key (nb_...) covers one. The Blog Display API (/api/blog/...) fetches published posts for your website; the optional Post Management API (/api/manage/...) lets you create or edit posts from your own backend. Both remain available as legacy aliases. See Post Management API for details.
Overview
The NextBlog REST APIs allow you to:
  • Fetch all published blog posts for a project (Blog Display API)
  • Get a specific published blog post by slug
  • Integrate content into custom websites and applications
  • Optionally create, update, and change status of posts via the Post Management API
  • Generate posts and videos, manage integrations, billing and analytics (Full REST API)

Step 1: Get Your API Key

1.1 Navigate to Project Settings
  1. Log into your NextBlog dashboard
  2. Click on your project to open it
  3. Click on "Settings"
1.2 Generate API Key
  1. Scroll to the "API Key" section
  2. Click "Generate API Key" if you don't have one yet
  3. Copy your API key and save it securely
  4. Important: Keep this key secret and never expose it in client-side code

Step 2: Get Your Project ID

2.1 Find Project ID
Your Project ID can be found:
  • In your project settings page
  • In the URL when viewing your project: /projects/PROJECT_ID
  • In the API key section of your project settings

Step 3: Make API Requests

Published-content reads use https://nextblog.ai/api/blog. Advanced create/update flows use https://nextblog.ai/api/manage — see Post Management API.
3.1 Base URL (display published posts)
Fetch published posts from:
https://nextblog.ai/api/blog
3.2 Authentication
Include your API key in the Authorization header:
Authorization: Bearer your_api_key_here
3.3 Get All Blog Posts
Endpoint: GET /api/blog/{projectId}
Example:
curl -H "Authorization: Bearer your_api_key_here" \
    https://nextblog.ai/api/blog/project_123
3.4 Get Single Blog Post
Endpoint: GET /api/blog/{projectId}/{slug}
Example:
curl -H "Authorization: Bearer your_api_key_here" \
    https://nextblog.ai/api/blog/project_123/how-to-optimize-website
3.5 Post Management API (optional)
To list drafts, create posts, or update status over HTTP, use the management base URL and endpoints documented on the Post Management API page.
https://nextblog.ai/api/manage/{projectId}/posts

Response Format

All Posts Response
{
  "project": {
    "id": "project_123",
    "name": "My Blog"
  },
  "blogs": [
    {
      "id": "blog_456",
      "title": "How to Optimize Your Website",
      "slug": "how-to-optimize-website",
      "description": "Learn the best practices...",
      "cover_image_url": "https://example.com/image.jpg",
      "published": true,
      "created_at": "2024-01-01T00:00:00Z"
    }
  ]
}
Single Post Response
{
  "project": {
    "id": "project_123",
    "name": "My Blog"
  },
  "blog": {
    "id": "blog_456",
    "title": "How to Optimize Your Website",
    "slug": "how-to-optimize-website",
    "description": "Learn the best practices...",
    "markdown": "# Full markdown content...",
    "cover_image_url": "https://example.com/image.jpg",
    "published": true,
    "created_at": "2024-01-01T00:00:00Z"
  }
}

Integration Examples

See our detailed examples for:

Rate Limits

API requests are limited to 1000 requests per hour per API key. If you exceed this limit, you'll receive a 429 Too Many Requests response.

Security Best Practices

  • Never expose your API key in client-side code
  • Use environment variables to store API keys
  • Rotate your API keys regularly
  • Monitor API usage for suspicious activity