Blogs API

Create, read, update and manage blog posts.

List Blogs

GET /api/v1/blogs

Query params:
  status   DRAFT | PUBLISHED | SCHEDULED | ARCHIVED
  q        Search term
  cursor   Cursor for pagination
  limit    Results per page (max 100, default 20)
  categoryId  Filter by category ID
  tagId       Filter by tag ID

Create Blog

POST /api/v1/blogs
Content-Type: application/json

{
  "title": "My Blog Post",
  "content": { "type": "doc", "content": [...] },
  "categoryIds": ["clxxx"],
  "tagIds": ["clyyy"],
  "scheduledAt": "2024-06-01T09:00:00Z",
  "seo": {
    "metaTitle": "My Blog Post | BlogSaaS",
    "metaDescription": "A short description under 160 chars",
    "focusKeyword": "blog post"
  }
}

Update Blog

PATCH /api/v1/blogs/:id
// Same fields as create — all optional

Blog Actions

POST /api/v1/blogs/:id
{ "action": "publish" }
{ "action": "archive" }
{ "action": "delete" }
{ "action": "duplicate" }
{ "action": "rollback", "versionId": "clxxx" }

Public API (no auth required — just API key)

GET /api/v1/public/blogs
X-API-Key: bsk_your_key

// Returns only PUBLISHED blogs
// Supports same query params as above

Blog Object

{
  "id": "clxxx",
  "title": "Post Title",
  "slug": "post-title",
  "excerpt": "Short preview...",
  "content": { ... },         // TipTap JSON AST
  "readingTime": 5,           // minutes
  "wordCount": 1050,
  "status": "PUBLISHED",
  "publishedAt": "2024-01-01T00:00:00Z",
  "scheduledAt": null,
  "metaTitle": "...",
  "metaDescription": "...",
  "seoScore": 82,
  "aeoScore": 75,
  "geoScore": 68,
  "author": { "id": "...", "name": "Jane", "avatarUrl": "..." },
  "categories": [{ "category": { "name": "Tech", "slug": "tech" } }],
  "tags": [{ "tag": { "name": "AI", "slug": "ai" } }]
}