Organizations API¶
An organization is the unit you add, and everything else hangs off it. These endpoints add one, read it, list what it holds, trigger a sync and remove it.
Every response below is the same OrganizationResponse shape:
| Field | Type | Description |
|---|---|---|
id |
UUID | |
platform |
string | github, gitlab, codeberg or sourcehut |
external_id |
string | The forge's own identifier |
name |
string | The owner's name on that platform |
url |
string | |
avatar_url |
string or null | |
is_owned |
boolean | True for an organization you own, false for one you watch |
sync_status |
string | pending, syncing, synced or error |
last_sync |
timestamp or null | |
sync_error |
string or null | The last failure's message, kept until the next success |
repository_count |
integer | Repositories collected so far |
No health score appears here, because a score belongs to a repository and an organization is a collection of them.
List Organizations¶
Query Parameters¶
| Parameter | Type | Description |
|---|---|---|
platform |
string | Only this platform |
is_owned |
boolean | Owned only, or watched only |
Response¶
{
"items": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"platform": "github",
"external_id": "1342004",
"name": "my-org",
"url": "https://github.com/my-org",
"avatar_url": "https://avatars.githubusercontent.com/u/1342004",
"is_owned": true,
"sync_status": "synced",
"last_sync": "2026-02-28T10:30:00Z",
"sync_error": null,
"repository_count": 42
}
],
"total": 1
}
This endpoint pages over nothing: it answers with every organization the account holds, and total is the length of items.
Add Organization¶
Request Body¶
| Field | Type | Required | Description |
|---|---|---|---|
platform |
string | Yes | github, gitlab, codeberg or sourcehut |
name |
string | Yes | Letters, numbers, hyphens, underscores and dots, up to 100 characters |
is_owned |
boolean | No | Defaults to false, which means watching |
connection_id |
UUID | No | Which stored credential to use; the account's connection for that platform by default |
The call validates the name against the platform before storing anything, and queues the first sync itself. A SourceHut organization needs a token on the connection, because git.sr.ht answers 401 to every unauthenticated query.
Response¶
The organization, in the shape above, with sync_status at pending and repository_count at 0. Status: 201 Created.
Errors¶
| Status | Description |
|---|---|
400 |
Invalid platform or name, already monitored, or the platform does not have it |
402 |
The account's plan does not cover another organization, or does not cover watching one you do not own |
503 |
The forge would not answer. The request was fine; try it again |
Get Organization¶
Answers the shape above, with repository_count filled in. Activity counts live on the activity endpoints.
Delete Organization¶
Status: 204 No Content.
Warning
This also removes every repository under it and all the activity collected for them.
Trigger Sync¶
Request Body¶
Optional:
force restarts a sync that is already running, which is what to send when one has stalled. Without it, a request against an organization already syncing is accepted and changes nothing.
Response¶
{
"message": "Sync queued for my-org",
"org_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "queued"
}
status is queued, or already_syncing when a pass was already running and force was absent. The HTTP status is 201, which is what Litestar returns for a POST that does not say otherwise; nothing is created, so read status and ignore the code.
The sync itself runs in the background. Poll the organization and read its sync_status.
Rate Limiting¶
An organization accepts five sync triggers a minute.
Get Organization Repositories¶
Query Parameters¶
| 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 |
The answer is {"items": [...], "total": n}, where each item is the repository shape documented under Repositories.
Example: add an organization and watch it sync¶
import time
import httpx2 as httpx
client = httpx.Client(
base_url="http://localhost:8000/api/v1",
headers={"Authorization": f"Bearer {token}"},
)
org = client.post("/organizations/", json={
"platform": "github",
"name": "python",
"is_owned": False, # watching somebody else's
}).raise_for_status().json()
print(f"Added {org['name']} ({org['id']})")
while True:
org = client.get(f"/organizations/{org['id']}").json()
if org["sync_status"] in {"synced", "error"}:
break
time.sleep(5)
print(org["sync_status"], org["sync_error"] or "", org["repository_count"])