API Reference
All API endpoints are hosted at https://cloud.sweny.ai.
Authentication
Section titled “Authentication”Two authentication methods are supported:
Project Token (legacy)
Section titled “Project Token (legacy)”Authorization: Bearer <project-token>GitHub App Installation
Section titled “GitHub App Installation”X-GitHub-Installation-Id: <installation-id>The installation ID is available in the GitHub Actions runtime context.
POST /api/report
Section titled “POST /api/report”Report Action run results to the cloud.
Request body:
{ "owner": "swenyai", "repo": "sweny", "status": "completed", "workflow": "triage", "trigger": "schedule", "branch": "main", "commit_sha": "abc1234", "duration_ms": 45000, "issues_found": true, "recommendation": "implement", "issue_url": "https://github.com/swenyai/sweny/issues/42", "pr_url": "https://github.com/swenyai/sweny/pull/10", "nodes": [ { "id": "prepare", "name": "Prepare", "status": "success" }, { "id": "investigate", "name": "Investigate", "status": "success" } ]}Response: { "ok": true, "run_id": "uuid", "run_url": "...", "comment": "..." }
POST /api/report/stream
Section titled “POST /api/report/stream”Stream real-time execution events for live DAG visualization.
Start event
Section titled “Start event”{ "event": "start", "owner": "swenyai", "repo": "sweny", "workflow": "triage" }Response: { "ok": true, "run_id": "uuid" }
Node event
Section titled “Node event”{ "event": "node", "run_id": "uuid", "node_id": "investigate", "name": "Investigate", "status": "running" }Complete event
Section titled “Complete event”{ "event": "complete", "run_id": "uuid", "status": "completed", "duration_ms": 45000 }GET /api/stats
Section titled “GET /api/stats”Returns time-series run data and enriched totals.
Query params: ?project_id=uuid&days=30
Response: { "daily": [...], "totals": { "runs": 150, "issues_found": 89, ... } }
GET /api/activity
Section titled “GET /api/activity”Returns a rich activity feed from GitHub events and Action runs.
Query params: ?project_id=uuid&limit=30
Response: { "events": [{ "type": "pr.merged", "message": "...", "actor": "...", ... }] }
GET /api/events/stats
Section titled “GET /api/events/stats”Returns aggregated GitHub event data (issue velocity, PR merge rate, contributors).
Query params: ?project_id=uuid&days=30
GET /api/insights
Section titled “GET /api/insights”Returns an AI-synthesized summary of recent activity (Individual+ plans).
Query params: ?days=7
Response: { "insight": "...", "days": 7, "generated_at": "..." }
POST /api/mcp
Section titled “POST /api/mcp”JSON-RPC 2.0 endpoint for MCP (Model Context Protocol). Team+ plans only.
Tools:
sweny_list_projects— list all projectssweny_get_runs— get recent runs for a projectsweny_get_stats— get aggregated statssweny_get_run_detail— get full details for a specific run
GET /api/badge/:owner/:repo
Section titled “GET /api/badge/:owner/:repo”Returns a dynamic SVG badge for README files.
