Repositories API¶
This controller holds two endpoints, both scoped to one repository: the row itself, and counts over it. Repositories are listed through the organization that holds them, and activity is read from the activity endpoints, so both have their own sections below.
Get Repository¶
Response¶
{
"id": "660e8400-e29b-41d4-a716-446655440001",
"external_id": "123456789",
"name": "awesome-project",
"full_name": "my-org/awesome-project",
"url": "https://github.com/my-org/awesome-project",
"description": "An awesome project",
"default_branch": "main",
"language": "Python",
"is_fork": false,
"is_archived": false,
"stars": 150,
"forks": 25,
"open_issues": 10,
"health_score": 88,
"health_scoring_model": "ospobox-health-0.1",
"last_activity": "2026-02-28T10:00:00Z",
"created_at": "2026-01-10T08:00:00Z",
"updated_at": "2026-02-28T10:05:00Z"
}
health_score is the number the last scoring pass stored, and health_scoring_model names the model that produced it. A score means whatever its arithmetic meant on the day it was written, so the two belong together: when the weights change, the identifier changes with them, and a score computed before the identifier existed reads null. See Health scores for the components behind the number.
stars and forks come from the forge and are 0 where it does not report them, which is every SourceHut repository.
Get Repository Stats¶
Lifetime counts over what has been collected, with no window and no filters.
Response¶
{
"total_commits": 1250,
"total_prs": 85,
"open_prs": 5,
"merged_prs": 70,
"total_issues": 140,
"open_issues": 10,
"total_releases": 12
}
Listing repositories¶
A repository belongs to an organization, and the list lives there:
| Parameter | Type | Default | Description |
|---|---|---|---|
language |
string | - | Exact match on the forge's primary language |
is_fork |
boolean | - | Forks only, or everything but forks |
is_archived |
boolean | - | Archived only, or everything but archived |
limit |
integer | 50 | Page size, capped |
offset |
integer | 0 | Rows to skip |
It answers {"items": [...], "total": n}, where each item is the shape above. There is no endpoint listing every repository an account holds across its organizations: ask each organization in turn, or read repository_count from the organization list.
Activity for one repository¶
Commits, pull requests, issues and releases are read from the activity endpoints, each of which takes a repo_id:
GET /api/v1/activity/commits?repo_id={id}&limit=50
GET /api/v1/activity/pull-requests?repo_id={id}&status=open
GET /api/v1/activity/issues?repo_id={id}&status=open
GET /api/v1/activity/releases?repo_id={id}
Example: find the repositories that scored badly¶
import httpx2 as httpx
client = httpx.Client(
base_url="http://localhost:8000/api/v1",
headers={"Authorization": f"Bearer {token}"},
)
orgs = client.get("/organizations").json()["items"]
for org in orgs:
repos = client.get(f"/organizations/{org['id']}/repositories",
params={"limit": 100}).json()["items"]
for repo in repos:
score = repo["health_score"]
if score is None or score >= 60:
continue
print(f"{repo['full_name']}: {score} ({repo['health_scoring_model']})")
stats = client.get(f"/repositories/{repo['id']}/stats").json()
print(f" {stats['open_prs']} open PRs, {stats['open_issues']} open issues")
A score below the threshold is a question, and on a quiet repository it usually means the forge reported little for the composite to read. The repository page in the dashboard shows which factors had nothing to work with.