SPB Git

Repository Public

API_INVENTORY.md 6.6 KB

# API inventory

Every HTTP route of SPB Git that matters to the iOS client, read from the server code (src/server.mjs, src/api/v1.mjs, src/web/routes.mjs, src/git/smart-http.mjs) at version 3.2.0, then the routes added in 3.3.0. The precise shapes of the 3.3.0 routes are in API_CONTRACT.md; the machine-readable description is GET /api/v1/openapi.json once 3.3.0 is deployed.

Legend for "Shield": open/api are never refused by the shield (the general limit of 200 requests per minute per address still applies); deep goes through the visitor-pass and global budgets.

# 1. Present in 3.2.0

# Public reads

Method and path Parameters Response Shield Used by the app
GET /healthz status, version, repository count, cache, memory, git semaphore, shield mode, features open capability fallback, admin
GET /api/v1/repos {repos: [Overview]} api repository list, dashboard, collections
GET /api/v1/repos/:name Overview api repository detail
GET /api/v1/repos/:name/languages {languages, totalBytes} api detail
GET /api/v1/repos/:name/commits ref, page 30 commits per page, hasNext deep commit list
GET /api/v1/repos/:name/tree ref, path entries {name, path, type, size} deep (weight 0.25) file explorer
GET /api/v1/repos/:name/releases tags with assets api releases
GET /api/v1/stats totals, streaks, active days api dashboard
GET /api/v1/search q (120 chars), scope, repo, limit (max 50) grouped results deep search
GET /api/v1/ai/status AI feature status (disabled in production) api not used in 1.0
GET /raw/:repo/<ref>/<path> bytes, text/plain for text, sandboxing CSP deep, or embed for branch images file viewers, images
GET /archive/:repo/<ref>.zip or .tar.gz archive archive (6 per minute per address) explicit download only
GET /releases/:repo/:tag/:asset asset bytes release release downloads
GET /feed.atom Atom feed of recent pushes open superseded by /api/v1/activity
GET /badge/:repo/:metric.svg SVG badge open not used
GET /pass/challenge {challenge, bits, expiresIn} pass visitor pass
POST /pass/redeem {challenge, nonce} 204 and cookies pass visitor pass

HTML pages (/, /:repo, /:repo/tree/*, /:repo/blob/*, /:repo/commits/*, /:repo/commit/:sha, /:repo/blame/*, /:repo/branches, /:repo/tags, /:repo/releases, /:repo/insights, /:repo/research, /search, /about/metrics, /about/api) are not consumed by the application. Their URL shapes are the ones the application accepts as Universal Links and produces when sharing.

# Authenticated (personal access token, Authorization: Bearer or HTTP Basic)

Method and path Body Effect
GET /api/v1/whoami owner name, token label and id
POST /api/v1/repos name, description, topics, homepage, pinned, defaultBranch creates a bare repository and its hooks
PATCH /api/v1/repos/:name description, topics, homepage, pinned, research, defaultBranch updates metadata
DELETE /api/v1/repos/:name soft delete, recoverable for 30 days
GET /api/v1/tokens, POST /api/v1/tokens, DELETE /api/v1/tokens/:id label token management
PUT /api/v1/repos/:name/releases/:tag/assets/:asset octet stream, up to 4 GiB uploads an asset to an existing tag
DELETE /api/v1/repos/:name/releases/:tag/assets/:asset deletes an asset
GET /api/v1/admin/shield, POST /api/v1/admin/shield mode: on, off, auto shield counters and mode
POST /api/v1/repos/:name/ask, POST /api/v1/repos/:name/commits/:sha/summary AI routes, 404 while AI is disabled

# Git transport

GET /:repo(.git)/info/refs, POST /:repo(.git)/git-upload-pack (public clone and fetch), POST /:repo(.git)/git-receive-pack (push, token required). The application does not speak the Git protocol in 1.0; see the local engine evaluation in IOS_ARCHITECTURE.md.

# Formats and conventions observed

  • Errors: {"error": {"code", "message"}}; codes seen: not_found, ref_not_found, invalid_path, validation_failed, invalid_name, already_exists, unknown_branch, unauthorized, invalid_tag, invalid_asset, unknown_tag, no_body, upload_failed, ai_disabled.
  • Shield refusals are text/plain or HTML, not JSON, with X-Spbgit-Shield, Retry-After, status 403, 429 or 503.
  • Compression: brotli and gzip above 1 KB. ETags exist only on the tree API and on HTML pages pinned to a commit.
  • Dates: ISO 8601 with offset for git dates, UTC Z for server timestamps.
  • Repository names: ^[a-z0-9][a-z0-9._-]{0,63}$. Topics: ^[a-z0-9][a-z0-9-]{0,34}$, 10 at most. Description: 350 characters at most.

# 2. Missing in 3.2.0, added in 3.3.0

Need of the application Route added
Capabilities and limits GET /api/v1/meta, GET /api/v1/openapi.json
Lighter and filterable list, collections GET /api/v1/repos?compact&q&language&topic&collection&sort&order&page&perPage, GET /api/v1/collections
README source GET /api/v1/repos/:name/readme
File metadata and content, paged for large files GET /api/v1/repos/:name/blob, GET /api/v1/repos/:name/blob/lines, Range on /raw
Branches, tags GET /api/v1/repos/:name/branches, GET /api/v1/repos/:name/tags
Filtered history commits?perPage&path&author&since&until&q, parents on each commit
Commit detail, structured diff, comparison, graph GET …/commits/:sha, …/commits/:sha/diff, …/compare, …/graph
Analytics GET /api/v1/metrics, GET /api/v1/repos/:name/metrics, GET /api/v1/metrics/compare
Activity GET /api/v1/activity
Code search, tags, suggestions `GET /api/v1/search?scope=code
Scoped, expiring tokens; audit scopes, expiresAt on tokens; GET /api/v1/admin/overview, GET /api/v1/admin/audit
Commits from the editor POST /api/v1/repos/:name/commits
Branch and tag management POST/DELETE …/branches, POST/DELETE …/tags
Notifications POST /api/v1/devices, DELETE /api/v1/devices/:deviceToken
Universal Links, store pages /.well-known/apple-app-site-association, /about/ios, /about/ios/privacy, /about/ios/support

The application reads GET /api/v1/meta at launch. Against a server older than 3.3.0 (the route answers 404) it keeps working with the routes of section 1 and hides the features that need the new ones.

Files main
Menu

Theme