Documentation

API Reference

Everything you need to connect your site and start generating content.

Quick Start

Two ways to connect: the CLI (interactive) or the SDK (programmatic).

Option 1: CLI (recommended for first setup)
$ npx networkr init

# Auto-detects your framework, database, and config
# Asks for domain, email, niche, voice style
# Connects your site and generates first article immediately
Option 2: SDK
npm install networkr

import Networkr from 'networkr'

const nm = new Networkr({ apiKey: 'nk_...' })

const site = await nm.connect({
  domain: 'myblog.com',
  email: 'me@company.com',
  db_type: 'supabase',
  db_url: process.env.SUPABASE_URL,
  db_key: process.env.SUPABASE_KEY,
  niche: 'developer tools'
})

// First article generates immediately
// Daily articles start on configured schedule

SDK Reference

const nm = new Networkr({ apiKey, baseUrl? })

// Connect a site (one-call onboarding)
await nm.connect({ domain, email, db_type, db_url, ... })

// List your sites
await nm.sites()

// Get site detail with stats
await nm.site(siteId)

// Update site config
await nm.update(siteId, { voice_id?, themes?, ... })

// Generate article now
await nm.generate(siteId, { topic?, angle? })

// Get generation history
await nm.history(siteId)

// Disconnect a site
await nm.disconnect(siteId)

// System health (no auth)
await nm.health()

Connect Endpoint

The POST /api/connect endpoint is the one-call onboarding. It auto-creates a network (or joins an existing one by email), creates a voice, creates an author, registers your site, starts the cron, and fires the first article immediately.

POST /api/connect
{
  "domain": "myblog.com",          // required
  "email": "me@company.com",       // required — groups sites into networks
  "db_type": "supabase",           // required — "supabase" or "pocketbase"
  "db_url": "https://xxx.supabase.co",  // required
  "db_key": "eyJ...",              // supabase service role key
  "db_password": "...",            // pocketbase admin password (instead of db_key)
  "name": "My Blog",              // optional — auto-derived from domain
  "niche": "developer tools",     // optional — sets themes
  "topics": ["AI", "DevOps"],     // optional — multiple themes
  "voice_preset": "technical",    // optional — professional|casual|technical|founder
  "author_name": "Jane Dev",      // optional
  "cron_schedule": "0 6 * * *"    // optional — default daily 06:00
}
Response
{
  "success": true,
  "site_id": "myblog-com",
  "network_id": "fe09c250...",
  "voice_id": "a3b1...",
  "author_id": "c4d2...",
  "status": "connected",
  "first_article": "generating now — check history in ~2 minutes",
  "message": "MyBlog is live. First article is generating now...",
  "digest": "Weekly digest will be sent to me@company.com every Monday",
  "endpoints": { ... }
}

REST API

Base URL: https://api.networkr.dev

Sites

POST/api/connect
One-call onboarding
GET/api/sites
List all sites
GET/api/sites/:id
Site detail + stats
PUT/api/sites/:id
Update site config
DELETE/api/sites/:id
Disconnect site

Blog Generation

POST/api/sites/:id/blog/generate
Generate article now
POST/api/sites/:id/blog/start
Enable daily cron
POST/api/sites/:id/blog/stop
Disable daily cron
GET/api/sites/:id/blog/history
Generation history
GET/api/sites/:id/blog/preview
Dry-run topic selection

SEO

GET/api/seo/research?q=...
SERP research
POST/api/seo/keywords
Track keywords
GET/api/seo/keywords/:siteId
Keyword rankings
POST/api/seo/keywords/check
Trigger rank check
POST/api/seo/brain/trigger
Run SEO Brain
GET/api/seo/brain/status
Topic queue status

Content Registry

GET/api/registry
All articles
GET/api/registry/search?tags=...
Search articles
GET/api/registry/links/:siteId
Cross-link suggestions
GET/api/registry/stats
Network stats

Network & Admin

GET/api/networks
List networks
GET/api/orchestrator/latest
Latest health report
POST/api/orchestrator/trigger
Run orchestrator now
POST/api/digest/trigger
Send weekly digest now
GET/api/status
Full system status
GET/health
Health check (no auth)

Authentication

All /api/* endpoints require a bearer token:

Authorization: Bearer nk_your_api_key

The /health endpoint is public (no auth required).

Self-Hosting

The entire engine runs as a single Docker container. Bring your own API keys.

docker-compose.yml
services:
  content-machine:
    build: .
    container_name: content-machine
    restart: unless-stopped
    ports:
      - "3002:3002"
    env_file:
      - .env
    volumes:
      - ./data:/app/data
      - ./assets/logos:/app/assets/logos
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://localhost:3002/health"]
      interval: 30s
      timeout: 5s
      retries: 3
Required environment variables
CONTENT_MACHINE_SECRET=your-bearer-token
ANTHROPIC_API_KEY=sk-ant-...        # or use OpenRouter only
OPENROUTER_API_KEY=sk-or-...
SERPER_API_KEY=...                   # Google search API
MAILJET_API_KEY=...                  # optional — for weekly digest
MAILJET_SECRET_KEY=...