Skip to content

feat(api): add GET /api/connections listing user app connections#8

Merged
matoushavlena merged 1 commit intomainfrom
feat/connections-list-rest-endpoint
Apr 17, 2026
Merged

feat(api): add GET /api/connections listing user app connections#8
matoushavlena merged 1 commit intomainfrom
feat/connections-list-rest-endpoint

Conversation

@matoushavlena
Copy link
Copy Markdown

Summary

Adds GET /api/connections, a thin REST wrapper over the existing listConnections(accountId) service function. Returns the user's connected apps with {id, provider, label, status, scopes, metadata, connectedAt} — exactly the shape the dashboard already consumes via the getAppConnections server action.

Motivation

External consumers (e.g. the Humr agent platform) currently cannot:

  1. Display connected apps with identity metadata (email from Google, login from GitHub, etc.) — `/api/apps` strips `metadata` at the response boundary
  2. Resolve the connection IDs returned by /api/agents/{id}/connections back to their providers/labels — `/api/apps` also strips connection.id, so there's no way to join the agent assignments to the connection list

Both problems disappear with this endpoint, which exposes the exact data the dashboard's ManageAccessDialog already uses.

Changes

  • New apps/web/src/app/api/connections/route.ts — 16 lines. GET only. Uses resolveApiAuth + handleServiceError + unauthorized exactly like the existing /api/secrets route.

No schema changes, no service-layer changes, no validation schemas needed (read-only, no body).

Test plan

  • pnpm --filter @onecli/web run lint — clean
  • pnpm --filter @onecli/web run check-types — clean
  • pnpm exec prettier --check on the new file — clean
  • Manual: GET /api/connections with a valid API token returns the authenticated account's connections (no credentials)
  • Manual: missing auth returns 401

Follow-up on Humr side

Once this merges and a new OneCLI image ships, Humr will:

  • Swap its port from /api/apps/api/connections (drops the flattenApps defensive flattener)
  • Surface `identity` (email/username) on the Connections view
  • Wire up the read-only Apps group in the Edit Agent Secrets dialog using the intersection of GET /api/connections and GET /api/agents/{id}/connections

Thin REST wrapper over the existing listConnections service function.
Returns {id, provider, label, status, scopes, metadata, connectedAt}
per connection, which is exactly the data the OneCLI dashboard already
uses via the getAppConnections server action.

Motivation: external consumers (e.g. the Humr agent platform) need to
(a) display a user's connected apps with identity metadata (email from
Google, login from GitHub, etc.) and (b) map the connection IDs
returned by /api/agents/{id}/connections back to their providers. The
existing /api/apps endpoint strips connection.id and metadata at the
response boundary, so neither use case is solvable without this route.

No schema changes, no service-layer changes.
@matoushavlena matoushavlena merged commit 533ae85 into main Apr 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants