Skip to content

Repositories API

Access repository data and activity.

List Repositories

Get all repositories across all monitored organizations.

GET /api/repositories/

Query Parameters

Parameter Type Default Description
organization_id UUID - Filter by organization
platform string - Filter by platform
limit integer 50 Max results (1-100)
offset integer 0 Pagination offset

Response

{
  "items": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440001",
      "name": "awesome-project",
      "full_name": "my-org/awesome-project",
      "description": "An awesome project",
      "platform": "github",
      "organization_id": "550e8400-e29b-41d4-a716-446655440000",
      "default_branch": "main",
      "stars": 150,
      "forks": 25,
      "open_issues": 10,
      "language": "Python",
      "health_score": 88,
      "last_activity": "2026-02-28T10:00:00Z"
    }
  ],
  "total": 42,
  "limit": 50,
  "offset": 0
}

Get Repository

Get details for a specific repository.

GET /api/repositories/{id}

Parameters

Parameter Type Description
id UUID Repository ID

Response

{
  "id": "550e8400-e29b-41d4-a716-446655440001",
  "name": "awesome-project",
  "full_name": "my-org/awesome-project",
  "description": "An awesome project",
  "platform": "github",
  "organization_id": "550e8400-e29b-41d4-a716-446655440000",
  "default_branch": "main",
  "url": "https://github.com/my-org/awesome-project",
  "stars": 150,
  "forks": 25,
  "open_issues": 10,
  "language": "Python",
  "health_score": 88,
  "last_activity": "2026-02-28T10:00:00Z",
  "stats": {
    "commits_7d": 25,
    "commits_30d": 100,
    "prs_7d": 5,
    "prs_30d": 20,
    "contributors_30d": 8
  }
}

Get Repository Activity

Get recent activity for a repository.

GET /api/repositories/{id}/activity

Query Parameters

Parameter Type Default Description
days integer 30 Number of days of activity
type string - Filter by type: commit, pr, issue
limit integer 100 Max results

Response

{
  "commits": [
    {
      "sha": "abc123",
      "message": "Fix critical bug",
      "author_name": "Jane Doe",
      "author_email": "jane@example.com",
      "authored_at": "2026-02-28T09:00:00Z"
    }
  ],
  "pull_requests": [
    {
      "number": 42,
      "title": "Add new feature",
      "state": "open",
      "author": "johndoe",
      "created_at": "2026-02-27T14:00:00Z"
    }
  ],
  "issues": [
    {
      "number": 100,
      "title": "Bug report",
      "state": "open",
      "author": "reporter",
      "created_at": "2026-02-26T10:00:00Z"
    }
  ]
}

Get Repository Health

Get detailed health metrics for a repository.

GET /api/repositories/{id}/health

Response

{
  "score": 88,
  "grade": "B+",
  "metrics": {
    "activity": {
      "score": 90,
      "commits_30d": 100,
      "prs_30d": 20
    },
    "community": {
      "score": 85,
      "contributors_30d": 8,
      "new_contributors_30d": 2
    },
    "maintenance": {
      "score": 80,
      "pr_merge_time_avg_hours": 24,
      "issue_response_time_avg_hours": 12
    },
    "documentation": {
      "score": 95,
      "has_readme": true,
      "has_contributing": true,
      "has_license": true
    }
  },
  "updated_at": "2026-02-28T10:00:00Z"
}

Get Repository Contributors

Get contributor statistics for a repository.

GET /api/repositories/{id}/contributors

Query Parameters

Parameter Type Default Description
days integer 30 Period to analyze
limit integer 50 Max results

Response

{
  "contributors": [
    {
      "name": "Jane Doe",
      "email": "jane@example.com",
      "commits": 50,
      "lines_added": 2000,
      "lines_removed": 500,
      "classification": "internal",
      "first_contribution": "2025-01-15T10:00:00Z",
      "last_contribution": "2026-02-28T09:00:00Z"
    }
  ],
  "summary": {
    "total_contributors": 8,
    "internal_contributors": 5,
    "external_contributors": 2,
    "bot_contributors": 1
  }
}

Example: Analyze Repository Health

import httpx

client = httpx.Client(
    base_url="http://localhost:8000/api",
    headers={"Authorization": f"Bearer {token}"}
)

# Get repositories with low health scores
response = client.get("/repositories/", params={"limit": 100})
repos = response.json()["items"]

low_health_repos = [r for r in repos if r["health_score"] and r["health_score"] < 60]

for repo in low_health_repos:
    print(f"Repository: {repo['full_name']}")
    print(f"  Health Score: {repo['health_score']}")

    # Get detailed health breakdown
    health = client.get(f"/repositories/{repo['id']}/health").json()
    for metric, data in health["metrics"].items():
        print(f"  {metric}: {data['score']}")