API Reference

The darkreach coordinator exposes a REST API and WebSocket endpoint for nodes, the dashboard, and third-party integrations. The API is organized into 12 endpoint groups covering all platform functionality.

Base URL: https://api.darkreach.ai

REST Endpoints

Primes

Query, filter, and inspect discovered primes.

GET/api/primes

List discovered primes with pagination and filtering.

json
{
  "primes": [
    {
      "id": 1,
      "form": "factorial",
      "expression": "147855! + 1",
      "digits": 636919,
      "proof_type": "pocklington",
      "certificate": { ... },
      "discovered_at": "2026-02-14T12:00:00Z"
    }
  ],
  "total": 2847,
  "page": 1,
  "per_page": 50
}
GET/api/primes/:id

Get a single prime with full certificate data.

GET/api/stats

Aggregate statistics: total primes, candidates tested, active workers.

json
{
  "total_primes": 2847,
  "candidates_tested": 14200000000,
  "active_workers": 38,
  "compute_hours": 127000,
  "search_forms": 12
}

Verification

Re-verify primes and inspect certificates.

POST/api/verify

Re-verify a prime through the 3-tier pipeline. Returns updated proof status.

json
{
  "prime_id": 42,
  "result": "verified",
  "proof_type": "pocklington",
  "certificate": { ... }
}

Workers & Nodes

Worker registration, heartbeat, and node management.

GET/api/workers

List all registered workers with status and last heartbeat.

POST/api/workers/register

Register a new worker with the coordinator.

POST/api/workers/heartbeat

Worker heartbeat with progress and status update.

GET/api/fleet

Fleet overview: all nodes, active searches, aggregate stats.

Operators

Operator accounts and node management (v1 API).

GET/api/v1/operators

List operators with node counts, compute hours, and prime counts.

json
{
  "operators": [
    {
      "id": "op-abc",
      "name": "alice",
      "contact_email": "alice@example.com",
      "node_count": 4,
      "total_compute_hours": 1200,
      "primes_found": 23
    }
  ]
}
POST/api/v1/operators

Register a new operator account.

GET/api/v1/nodes

List all nodes across all operators with status.

POST/api/v1/nodes/register

Register a new node under an operator.

POST/api/v1/nodes/heartbeat

Node heartbeat with system metrics and progress.

Search Jobs

Job lifecycle, work blocks, and search management.

GET/api/search_jobs

List search jobs with status (running, completed, paused).

POST/api/search_jobs

Create a new search job.

POST/api/search_jobs/claim

Claim the next available work block (FOR UPDATE SKIP LOCKED).

POST/api/search_jobs/:id/complete

Mark a work block as completed with results.

GET/api/searches

List active searches with progress and rate metrics.

POST/api/searches

Start a new search with form and range parameters.

AI Agents

Agent task management, budgets, memory, roles, and schedules.

GET/api/agents/tasks

List agent tasks with status and assigned agent.

json
{
  "tasks": [
    {
      "id": "task-123",
      "title": "Optimize factorial sieve depth",
      "status": "running",
      "agent": "strategy-agent",
      "created_at": "2026-02-20T10:00:00Z"
    }
  ]
}
POST/api/agents/tasks

Create a new agent task.

PUT/api/agents/tasks/:id

Update task status or assignment.

GET/api/agents/budgets

Get agent compute budgets and spend tracking.

POST/api/agents/budgets

Set or update an agent budget.

GET/api/agents/memory

Read agent memory key-value store.

POST/api/agents/memory

Write to agent memory.

GET/api/agents/schedules

List agent automation schedules.

POST/api/agents/schedules

Create or update a schedule.

Projects

Multi-phase campaign management.

GET/api/projects

List all projects with phase status and progress.

POST/api/projects

Create a new project campaign.

GET/api/projects/:id

Get project details with phases, events, and cost breakdown.

PUT/api/projects/:id

Update project configuration or budget.

POST/api/projects/:id/advance

Manually advance to the next phase.

Observability

Metrics, logs, and performance monitoring.

GET/api/observability/metrics

System metrics: CPU, memory, disk, and worker rates.

GET/api/observability/logs

Recent system logs with filtering and pagination.

GET/api/observability/charts

Time-series data for performance charts.

Releases

Worker release channels and canary rollout control.

GET/api/releases/worker/latest?channel=stable

Get latest worker release metadata for a channel.

json
{
  "channel": "stable",
  "version": "0.1.0",
  "published_at": "2026-02-20T00:00:00Z",
  "notes": "Initial public release",
  "artifacts": [
    {
      "os": "linux",
      "arch": "x86_64",
      "url": "https://downloads.darkreach.ai/...",
      "sha256": "..."
    }
  ]
}
POST/api/releases/worker

Upsert a worker release record.

POST/api/releases/rollout

Set channel target version and rollout percentage.

POST/api/releases/rollback

Rollback a channel to the previous version.

GET/api/releases/events?channel=stable&limit=100

Audit trail of rollout and rollback events.

GET/api/releases/health?active_hours=24

Release adoption summary by worker version.

Documentation

Documentation search and content serving.

GET/api/docs

List all documentation files with titles and categories.

GET/api/docs/:slug

Get a documentation file by slug.

GET/api/docs/search?q=query

Multi-word search across all docs with relevance ranking.

json
{
  "results": [
    {
      "slug": "sophie-germain",
      "title": "Sophie Germain Primes",
      "snippets": [
        { "text": "...matching line...", "line": 42 }
      ],
      "category": "roadmaps",
      "score": 35
    }
  ]
}
GET/api/docs/roadmaps/:slug

Get a roadmap document.

GET/api/docs/agent/:slug

Get a CLAUDE.md agent file.

Notifications

Push notification management.

GET/api/notifications

List notification subscriptions.

POST/api/notifications/subscribe

Subscribe to push notifications for prime discoveries.

Health & Status

Service health checks and coordinator status.

GET/api/health

Health check and readiness probe.

GET/api/status

Coordinator status with uptime, version, and worker count.

json
{
  "status": "healthy",
  "version": "0.1.0",
  "uptime_seconds": 86400,
  "database": "connected",
  "workers_online": 38,
  "active_searches": 5,
  "ai_engine": "running"
}

WebSocket

Connect to wss://api.darkreach.ai/ws for real-time updates. Messages are JSON-encoded with an event field. The server pushes updates every 2 seconds.

server → clientprime_discovered

Broadcast when a new prime is found by any node.

json
{ "form": "factorial", "expression": "147855! + 1", "digits": 636919, "proof_type": "pocklington" }
server → clientworker_status

Fleet status update pushed every 2 seconds.

json
{ "workers": [...], "active_searches": [...], "total_rate": 150000 }
server → clientsearch_progress

Search progress update with candidates tested and rate.

json
{ "job_id": 1, "progress": 0.42, "candidates_per_second": 15000 }
server → clientai_decision

AI engine decision notification with reasoning.

json
{ "action": "start_search", "form": "kbn", "confidence": 0.87, "reasoning": "..." }
server → clientproject_event

Project phase transition or milestone.

json
{ "project_id": "proj-1", "event": "phase_advance", "from": "scout", "to": "search" }
client → serversubscribe

Subscribe to specific event channels.

json
{ "channels": ["primes", "fleet", "searches", "ai", "projects"] }

Authentication

The dashboard uses Supabase Auth (email/password) for login. API endpoints for read operations are currently unauthenticated. Write operations on the operator and agent APIs require an operator ID for identity. Node registration uses coordinator-assigned worker IDs.

Rate Limits

The API does not currently enforce rate limits. However, heartbeat endpoints are designed for 10-second intervals, and the WebSocket connection pushes at 2-second intervals. Excessive polling is discouraged.