RuleBaseRuleBase
Back to home

API Documentation

REST API for RuleBase. Base URL: https://rulebases.dev

GET /api/rules

List and search rules. Public endpoint, no auth required.

Query params:

  • q — Search query (title, description)
  • category — Category UUID
  • featured — true/false
  • sort — newest | popular | top-rated
  • page — Page number (default: 1)
  • limit — Items per page (default: 12, max: 50)
curl "https://rulebases.dev/api/rules?q=react&sort=popular&limit=5"

GET /api/rules/:id

Get a single rule by ID. Public endpoint.

curl "https://rulebases.dev/api/rules/{rule-id}"

POST /api/rules

Create a new rule. Requires authentication (session cookie).

Body (JSON):

  • title — string (3–255 chars)
  • description — string (10–500 chars)
  • content — string (20–10,000 chars)
  • categoryId — UUID
  • tags — string[] (max 8, each max 30 chars)
  • isPublic — boolean (default: true)
curl -X POST "https://rulebases.dev/api/rules" \
  -H "Content-Type: application/json" \
  -d '{"title":"...","description":"...","content":"...","categoryId":"..."}' \
  --cookie "your-session-cookie"

POST /api/rules/:id/copy

Track a copy event. Optional auth; works anonymously too.

curl -X POST "https://rulebases.dev/api/rules/{rule-id}/copy"

PATCH and DELETE for rules require owner authentication. For full schema, see the source code.