Skip to Content
We are live but in Staging 🎉
API ReferenceRepositories

Repositories

All paths relative to the base URL; {repo_id} is the opaque UUID.

Lifecycle

Method & pathWhat it does
GET /api/v1/reposList the org’s repos → {"repos": […]}
POST /api/v1/reposCreate → the new repo object
GET /api/v1/repos/{repo_id}Fetch one repo
GET /api/v1/orgs/{org_slug}/repos/{name}Resolve an address to the repo (id + metadata)
DELETE /api/v1/repos/{repo_id}Delete → {"deleted": true}

Create body: {"name": "my-service", "description": "…", "default_branch": "main"}name required, the rest optional (default_branch defaults to main; description is echoed on the create response only, not persisted).

The repo object carries repo_id, org_id, org_slug, name, state, visibility, default_branch, http_url, plus size accounting (size_bytes, pack_count, lfs_bytes) and quotas (size_limit_bytes, pack_count_limit).

Settings (git.admin)

Method & pathBody
PUT /api/v1/repos/{repo_id}/visibility{"visibility": "private" | "public"}
PUT /api/v1/repos/{repo_id}/default-branch{"default_branch": "develop"} (must exist)

Both return the updated repo object.

Branches and refs

Method & pathReturns
GET /api/v1/repos/{repo_id}/branches{"branches": [{name, sha, is_default}]}
GET /api/v1/repos/{repo_id}/refs/{ref}{ref, sha} — resolve a fully-qualified ref (e.g. refs/heads/main)

Code browsing

Method & pathQueryReturns
GET …/{repo_id}/treeref?, path?directory listing: {ref, sha, path, entries: [{name, kind, size?}]}kind is dir / file / symlink / submodule
GET …/{repo_id}/blobpath (required), ref?file content: {encoding: "utf8"|"base64", content, size, binary, truncated, …} — size-capped
GET …/{repo_id}/commitsref?, limit?history newest-first: {ref, sha, commits: [{sha, author, email, time, subject, message}]}

ref defaults to the repo’s default branch when omitted.

Diff

GET /api/v1/repos/{repo_id}/diff?from=main&to=feature/hello&stats_only=false

from/to are SHAs or ref names. Returns {base_sha, head_sha, files, total_additions, total_deletions, truncated}; each file has path, old_path?, status (added/deleted/modified/renamed), additions, deletions, patch?, binary. stats_only=true drops patch text; truncated: true means patches exceeded the size cap.

Branch protection

Method & pathWhat it does
GET /api/v1/repos/{repo_id}/protection{"rules": […]}
PUT /api/v1/repos/{repo_id}/protectionUpsert the rule for a branch_pattern

Rule body (branch_pattern required, the rest optional booleans/ints):

{ "branch_pattern": "main", "required_approvals": 1, "require_green_checks": true, "block_force_push": true, "block_deletion": true, "block_self_approval": false, "dismiss_stale_approvals": true }

See Core Concepts — Branch protection for what each setting enforces.

SSH keys (per user)

Method & pathWhat it does
GET /api/v1/user/keys{"keys": […]} — type, fingerprint, last-used
POST /api/v1/user/keysAdd: {"name", "public_key", "read_only"?} — key in authorized_keys form
DELETE /api/v1/user/keys/{key_id}Remove → {"deleted": true}

See also