Repository navigation
Description
There is no way to script Orbit. The roadmap lists a public API under "Later", and the schema is further along than that suggests.
api_key in packages/db/src/schema/comms.ts already has everything a key needs: organisation, user, name, a hashed key, a display prefix, last used, expiry and revocation. Nothing reads it or writes it. The only match for apiKey anywhere else in the repository is a local variable in the Resend email transport, which is unrelated.
Why this is not covered by MCP
The MCP server is excellent for agents and wrong for scripts. It speaks a protocol designed for language models, it requires an OAuth dance with a consent screen and a passkey re-verification, and it exposes tools rather than resources. Nobody is going to run that from a cron job or a CI step.
The two should coexist. MCP for agents, keys and REST for scripts.
What to build
This is deliberately one issue because the pieces are useless separately, but it should land as several pull requests.
1. Key management.
- Create a key in personal settings, scoped to one workspace, with a name and an optional expiry
- Show the key exactly once, on creation, and never again. Store only the hash.
@node-rs/argon2is already a dependency and is what hashes passwords, so use the same thing rather than adding another hasher - A
prefixcolumn exists so a key can be identified in a list without revealing it. Use it, and design the prefix so a leaked key is greppable in logs and in public repositories - Revoke, and show last used, which is what tells somebody whether a key is safe to revoke
2. Authentication.
- A bearer token on the API routes, resolving to a principal
last_used_atupdated on use, but not on every single request, or a busy key becomes a write hotspot- Expired and revoked keys refused with a clear error
- Rate limiting per key
3. The API itself.
- Read and write for issues, comments, projects, sprints, docs, labels and states
- Every route parses input with a Zod schema from
packages/shared, like every existing route - Every route goes through
packages/shared/src/policy. A key never grants more than its owner has. This is the single most important property. A member's key must not be able to read a team they are not on - Every mutation goes through
packages/core, so it bumpssync_id, publishes to Redis and fans out to open tabs. An API write that does not appear in somebody's browser immediately is a bug - Pagination, filtering and a stable ordering
- Consistent errors, using the typed domain errors in
packages/shared/src/errors
4. Documentation.
- An OpenAPI description, generated from the Zod schemas if that is practical rather than hand written and immediately stale
- A page in
docs/, alongsidedocs/mcp.md - Examples with curl
Decisions worth making on this thread first
- Scopes. Should a key be read only, read write, or finer grained? The MCP grants already have
orbit.readandorbit.write, so there is a precedent to follow and reusing it would be consistent. - Personal keys or workspace keys. The table has both
organization_idanduser_id, implying a personal key scoped to one workspace. That is the right default. Service accounts are a separate and larger question. - REST or GraphQL. REST, unless somebody makes a strong case. It matches the existing route handlers and the audience is scripts.
Files
packages/db/src/schema/comms.tsapps/web/src/app/api/for the routes, likely under a versioned prefixpackages/shared/src/policypackages/core/apps/web/src/app/(app)/settings/account/for key managementdocs/
This is a large piece of work
It is a good one to split across several people. Say which part you are taking.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog
Activity
imshashank commentedon Sep 6, 2026
Split for whoever picks it up: the first PR is key creation, argon2 hashing, the greppable prefix, revoke, last-used, and bearer auth resolving to a principal with the owner's permissions; the second PR is the routes. Scopes reuse
orbit.readandorbit.writefrom the MCP grants rather than inventing a third set.