API

Interact with Fabrika programmatically

Everything you can do in the dashboard, you can do through the REST API on localhost:7777.

Base URL

http://localhost:7777

Set a convenience variable:

export FABRIKA="http://localhost:7777"

Quick reference

Tasks

# List all tasks
curl -s "$FABRIKA/api/tasks" | jq .

# Filter by status (prefer query params — faster than client-side jq)
curl -s "$FABRIKA/api/tasks?status=review" | jq .

# Create
curl -s -X POST "$FABRIKA/api/tasks" \
  -H "Content-Type: application/json" \
  -d '{"title":"Fix X","spec":"Do Y","touchPaths":["src/"]}' | jq .

# Accept / reject / retry
curl -s -X POST "$FABRIKA/api/tasks/<id>/accept" -d '{}' | jq .
curl -s -X POST "$FABRIKA/api/tasks/<id>/reject" -d '{"reason":"wrong"}' | jq .
curl -s -X POST "$FABRIKA/api/tasks/<id>/retry" | jq .

# Batch accept all tasks in review
curl -s -X POST "$FABRIKA/api/tasks/accept-batch" \
  -H "Content-Type: application/json" \
  -d '{"ids":["<id-1>","<id-2>"]}' | jq .

Big tasks (feature-level work)

# Create — the planner decomposes it into subtasks
curl -s -X POST "$FABRIKA/api/bigtasks" \
  -H "Content-Type: application/json" \
  -d '{"title":"Add dark mode","intent":"OS-level preference, works on all pages"}' | jq .

# Park an idea for later
curl -s -X POST "$FABRIKA/api/bigtasks" \
  -H "Content-Type: application/json" \
  -d '{"title":"Dark mode","status":"backlog"}' | jq .

Plans and decisions

curl -s "$FABRIKA/api/plans" | jq .
curl -s -X POST "$FABRIKA/api/plans/<id>/approve" | jq .
curl -s -X POST "$FABRIKA/api/decisions/<id>/answer" \
  -d '{"answer":"Postgres","promote":true}' | jq .

Attention (one call for everything needing you)

curl -s "$FABRIKA/api/attention" | jq '{reviews:(.reviews|length), decisions:(.decisions|length)}'

Returns counts of reviews, pending decisions, audits, and plans — everything waiting on you.

Agents

curl -s "$FABRIKA/api/agents" | jq .
curl -s -X POST "$FABRIKA/api/agents/<id>/enable" | jq .
curl -s -X POST "$FABRIKA/api/agents/<id>/disable" | jq .

Metrics

curl -s "$FABRIKA/api/metrics" | jq '{touchesPerUnit, changeFailRate, autoMergeShare}'

Pattern: clear your review queue

# Find all tasks in review
ids=$(curl -s "$FABRIKA/api/tasks?status=review" | jq -r '[.[].id] | join(",")')

# Batch accept them (you reviewed them in the dashboard)
[ -n "$ids" ] && curl -s -X POST "$FABRIKA/api/tasks/accept-batch" \
  -H "Content-Type: application/json" \
  -d "{\"ids\":[$(echo \"$ids\" | sed 's/,/\",\"/g;s/^/\"/;s/$/\"/')]}" | jq .

Pattern: retry all failures

ids=$(curl -s "$FABRIKA/api/tasks?status=failed" | jq -r '[.[].id] | join(",")')
[ -n "$ids" ] && curl -s -X POST "$FABRIKA/api/tasks/retry-batch" \
  -H "Content-Type: application/json" \
  -d "{\"ids\":[$(echo \"$ids\" | sed 's/,/\",\"/g;s/^/\"/;s/$/\"/')]}" | jq .