Skip to content

feat: serve the API under /api/v1 and deprecate the root paths - #2358

Merged
fforootd merged 21 commits into
mainfrom
claude/api-v1-server
Nov 1, 2026
Merged

fforootd merged 21 commits into
mainfrom
claude/api-v1-server

Conversation

@fforootd

@fforootd fforootd commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Context

Summary

  • Mount. The server answers every spec operation under /api/v1.

    • internal/api/mount.go builds the API's generated servers over one handler with the same options (api.NewServers). One function mounts them for the production mux and the integration harness (api.MountAPI):
      • the prefixed server (WithPathPrefix("/api/v1")) at /api/v1/, and at the bare /api/v1 so it gets ADR 076's req.not_found instead of a ServeMux redirect;
      • the probes /livez and /readyz at the root, from an unprefixed server of their own;
      • the root alias as the catch-all.
    • The console, /console/runtime.json and the IdP callbacks keep their own mounts.
  • Deprecation. When a root path names an operation, the response carries:

    • Deprecation: @<epoch> (RFC 9745);
    • Link: <https://preview.zitadel.com/docs/reference/api#base-url>; rel="deprecation"; type="text/html".

    Probes, 404s, 405s and CORS preflights get neither header. No Sunset.

  • Metric. The root alias is built with WithAttributes(zitadel.api.root_path=true), so its spans and its ogen.server.* metrics count the traffic still on the root before GA removes it. The probes have their own server so that orchestrator traffic doesn't count as alias traffic. The server's meter views (internal/instrumentation/zotel) keep the attribute, and the configuration guide's Metrics section lists it.

  • api/client is a new hand-written package (MIT, under api/). It exports PathPrefix, BaseURL(origin) (drops a trailing / or /api/v1, so the prefix is never doubled) and New(origin, sec, opts...). The server, the integration harness (helpers.NewApiClient, Harness.APIBaseURL) and the benchmark (Bootstrap, the k6 module) use it. The benchmark's /readyz check stays at the root.

  • Code that reads the path before ogen.

    • WithSessionStateNoStore matches both spellings.
    • The audit records the operation, not the mount. It used to prefer the mux pattern, which would have recorded /api/v1/ for every request.
  • Spec.

    • servers: [{url: /api/v1}], with no name, so ogen generates nothing for it.
    • The System tag and the probe descriptions say to probe the root.
    • The generated Go output changes only in those descriptions' comments.
  • Cloud. vercel.json sends /api/(.*) to the server as its first rewrite. The catch-all stays.

  • Deployment checks.

    • e2e/schemas expects /api/v1/schemas and /api/v1/schemas/{id} without the header, and /schemas and /schemas/{id} with it.
    • e2e/console's routes spec checks the prefix and the root alias.
  • Docs.

    • The API reference's Base URL section gives the prefix, the root probes and the deprecation.
    • The Markdown cURL (curlServer) and its test use http://localhost:8080/api/v1.
    • Also updated: the System page, the cloud README and runbook, the quick start's local URL table and demo-next's README.

Validation

  • After merging main a fifth time and stacking on feat: accept /api/v1 paths in the SDK and dev-proxy gates #2357 (see Notes), at 6a27e50:
    • moon run server:lint server:test: pass.
    • go test -count=1 -p 1 -tags postgres_integration ./internal/api/integration_test/... against a throwaway local Postgres 18, as in the Postgres bullet below: 201 tests passed, none failed or were skipped, including TestRootPathAliasServesTheSignIn and main's new TestSessionCookieNames.
    • moon run docs:typecheck docs:lint docs:e2e: 39 passed, among them the playground tests that failed on this branch's preview before the fix.
    • This branch's preview (6ee2d11): /api/v1/users/me 401 without Deprecation, /users/me and /schemas 401 with it, /livez and /api/v1/readyz 200 without it, /api/v1/nope 404. The deployment checks cli, console and schemas (Preview) pass, so the clients of this branch, still on the root paths, work against it in the cloud.
    • The binary, self-hosted, and the whole stack: see feat!: call the API under /api/v1 #2359's Validation.
  • After the fourth merge, on that merge: go build ./..., go vet -tags postgres_integration on the server, service and API packages, moon run server:lint server:test (which also ran server:format, server:openapi, server:check-generate and server:vet) and go test ./apps/cloud/...: pass. The integration lane is left to CI this time: the conflict was one line, and main added no integration test.
  • After the third merge; the other bullets here are from before the merges:
    • moon run server:generate: no change, so the generated code matches a fresh run;
    • moon run server:openapi server:vet server:lint server:test server:test-sqlite bench:vet bench:lint bench:test: pass;
    • moon run server:check-generate-pruned, run on its own: pass, no drift;
    • moon run e2e:typecheck e2e:lint docs:typecheck docs:lint and turbo boundaries: pass;
    • TestMountAPIMarksRootPathTraffic fails with zitadel.api.root_path taken out of the meter views, and passes with it;
    • go test -v -count=1 -p 1 -tags postgres_integration ./internal/api/integration_test/... against a throwaway local Postgres 18, as in the Postgres bullet below: 199 tests passed, none failed or were skipped, including TestRootPathAliasServesTheSignIn and the tests main added.
  • moon run server:generate: only the probe descriptions' comments changed in api/generated.
  • moon run server:openapi: 0 errors, 0 warnings.
  • moon run server:format server:lint server:test: pass.
  • moon run server:test-sqlite: pass.
  • moon run server:check-generate-pruned, run on its own: pass, no drift.
  • go test ./... in tools/bench: pass.
  • moon run e2e:typecheck e2e:lint docs:typecheck docs:lint: pass.
  • biome check on the changed TypeScript: clean.
  • go vet -tags={postgres,spanner,sqlite}_integration ./internal/api/integration_test/...: pass.
  • Postgres lane: there is no Docker on this machine, so server:test-postgres was not run. The integration package ran against a throwaway local Postgres 18 instead (ZITADEL_TEST_POSTGRES_URL): go test -v -count=1 -p 1 -tags postgres_integration ./internal/api/integration_test/. 188 tests passed, none failed or were skipped, including TestRootPathAliasServesTheSignIn.
  • On a local branch that merges all five ADR 077 PRs (docs: amend and accept ADR 077 on the /api/v1 prefix #2356, feat: accept /api/v1 paths in the SDK and dev-proxy gates #2357, feat: make the CLI refuse a local server that another release started #2360, this one and feat!: call the API under /api/v1 #2359): moon run e2e:console-embedded e2e:console-real e2e:console-platform e2e:demo-next-mock e2e:demo-next-real e2e:demo-nuxt-mock and the React and Next journeys (moon run e2e:journey -- --framework <id>) passed against this server.
  • Not run: the Spanner lane, pnpm check:cloud (needs the preview), and the docs Playwright suite (apps/docs/tests/pages.spec.ts changed).
  • What the tests cover:
    • internal/api/mount_test.go, with real generated servers:
      • 401 under the prefix and at the root, with the headers only at the root;
      • the probes on both spellings without the header;
      • 404 for /api/v1, /api/v1/, /api/v1/nope, /api/v1x/…, /nope and /livez/;
      • 405 on both spellings;
      • CORS preflight 204 on both;
      • root-path traffic marked on spans and on the request counter.
    • cmd/server/mux_test.go: the whole routing table through buildHTTPMux, including OPTIONS on both spellings and CSRF recording on every mount.
    • mux_errors_test.go: ADR 076's page and envelope at /api/v1 and /api/v1/no-such-page.
    • The raw-request integration tests now call the prefix. TestRootPathAliasServesTheSignIn runs a real handoff exchange and session read at the root and checks:
      • the Deprecation and Link headers;
      • the no-store header on the session read;
      • an undeprecated /livez.

Release notes / changeset

  • Changeset: .changeset/server-api-path-prefix.md, @zitadel/server minor. The server answers the API under /api/v1, and the probes, the console and the callbacks stay at the root. Until 1.0.0 the root paths still answer, with a Deprecation header and a Link. Not breaking: nothing a client calls today stops answering.

Notes

  • After a review (2026-11-01): a Go test (api/client) and a TypeScript one (@zitadel/api's base-url.spec.ts) hold client.PathPrefix and API_PREFIX to the spec's servers URL, so a change to the contract alone fails CI; the docs' playground session helper and cURL base take API_PREFIX. Checked: go test ./api/client/, moon run api:test api:lint docs:typecheck docs:lint docs:e2e server:lint (docs: 39 passed).
  • main is merged in five times to resolve conflicts:
    • First, in docs/runbooks/cloud.md: both sides rewrote the paragraph on the deployment checks. It keeps this PR's /api/v1/schemas check and main's new CLI suite. main also dropped the request chain's query-redaction argument, for which this PR wrapped the chain, so buildHTTPMux now passes it to MountAPI as it is.
    • Then the runbook's service table, in the server row: main now builds every cloud service through one turbo graph (build(deploy): build every cloud service through one turbo graph #2425), and this PR adds /api/* to what the server serves. The row takes main's build and this PR's paths.
    • Then buildHTTPMux and its tests: main added the event retention trigger (feat: let a scheduler start the audit event purge instead of the server's timer #2397), a mount of its own at /cron/events-retention, and this PR replaced the API's catch-all with MountAPI. buildHTTPMux takes both, the trigger ahead of MountAPI, and main's trigger test expects the root alias where it expected the API.
    • main also made the meter views keep only the attributes they list on the API's request metrics (feat(telemetry): cap metric series and limit API request metrics to the route template #2337), which would have dropped zitadel.api.root_path without a test failing. The views keep it now, TestMountAPIMarksRootPathTraffic collects through them, and the configuration guide lists it with the other request attributes.
    • Then the server's run: main now passes the console's origins to the runtime resolver (feat: let the console be reached at more origins than public_base's #2462), next to where this PR builds the API's servers. The file takes both. Nothing main added decides by request path: the new origins gate a flow's opening by its Origin header, wherever the API is mounted.
    • Then buildHTTPMux and the tests that drive the API: main wraps the mux in its security headers (feat: send security headers and a Content-Security-Policy from every service #2480), adds /csp-report ahead of the API, and renamed the session cookies (ADR 083). buildHTTPMux returns main's wrapped handler with MountAPI inside; main's loopback-cookie test drives the API's test doubles under the prefix and at the root, the headers test also reads /api/v1/users, TestSessionCookieNames mounts the API through MountAPI, and TestRootPathAliasServesTheSignIn reads the new cookie name. The runbook's table takes main's cloud-functions service.
  • The docs' API playground sends to the spec's server, /api/v1 since this PR; its session helper (apps/docs/components/session-auth.tsx, main's docs: send the API playground's requests with the reader's session #2476) now reads the session and its CSRF token there too, and its browser tests stub the prefixed paths.
  • Before merging, set rootPathDeprecatedSince in internal/api/mount.go to the date of the release that ships this. 2026-10-25 (@1792886400) holds its place.
  • First-party clients still call the root paths until the follow-up, feat!: call the API under /api/v1 #2359, so their responses carry the header in the meantime. The SDK and dev-proxy path checks that accept both spellings ship in feat: accept /api/v1 paths in the SDK and dev-proxy gates #2357.
  • Porting onto refactor: move the Go server module into apps/api #2271–build: serve Go vanity-import metadata for go.zitadel.com from the cloud #2274. The server module keeps its path github.com/zitadel/nextgen, so a rebase mostly follows renames:
    • cmd/, internal/ and api/openapi move under apps/api/;
    • the generated server's import moves to internal/api/generated;
    • api/client moves to the public module as go.zitadel.com/zitadel/v5/client, and the integration harness and tools/bench import it from there. packages/go/README.md's example should use client.New;
    • vercel.json's /api/(.*) rule goes after build: serve Go vanity-import metadata for go.zitadel.com from the cloud #2274's go.zitadel.com host rule;
    • ADR 077's code links into apps/api/ follow then.
  • Deviations from the plan.
    • Three generated servers, not two, so probe traffic stays out of the root-path metric.
    • The probe mounts take every method, so a POST /livez gets the probe server's 405, not the alias.
    • client.New takes the security source, as NewClient requires.

🤖 Generated with Claude Code

fforootd and others added 3 commits October 25, 2026 23:56
Checking the proposal against the code showed that more moves than the
mount and the client base URL. The project secret, the SDKs' session-cookie
handling, the dev proxies the CLI writes and the production proxies the docs
describe all decide by exact path; so do the session no-store rule and the
audit's route fallback in the server.

The amendment keeps the probes in the spec and at the root for good, gives
the root alias a Deprecation header and a measure of its traffic, has every
path check accept both spellings until 1.0.0 (with a doctor --fix migration
for scaffolded proxies), and orders the rollout so every mix of versions
keeps working. The design docs say the prefix is accepted but not shipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ADR 077 moves the resource API under /api/v1, and until 1.0.0 the server
answers both spellings. Every check that decides by path now accepts both,
so apps keep signing in on any mix of versions once their packages call
the prefix:

- @zitadel/sdk-core: the project-secret gate (POST /sessions/exchange) and
  the shared-session handling of the session probe, sign-in and sign-out
  trim the prefix before they compare. All six server SDKs go through it.
- The dev proxies zitadel setup writes for SPAs (Vite and Angular) move to
  zitadel:proxy:v3, whose bearer hook knows both exchange paths. A separate
  convenience edit migrates the v2 hook, matched formatter-insensitively in
  vite.config.*: zitadel doctor warns until zitadel doctor --fix applies it,
  since a v2 proxy keeps working until the packages call the prefix.
- The credential-policy check now accepts only the exact guard (POST, one
  or both exchange paths, no overwrite), so a guard an `|| true` widens is
  flagged for manual review.
- @zitadel/api exports API_PREFIX; the SDK proxy docs tell a hand-written
  SPA production proxy to accept both paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The server mounts the resource API under /api/v1 (ADR 077): the spec's
servers URL, a generated server with WithPathPrefix at /api/v1/ and at
the bare prefix, so it gets ADR 076's not-found instead of a redirect.
The health probes answer at the root for good, from a server of their
own. Until 1.0.0 a root alias answers every operation at its old path;
its responses carry Deprecation (RFC 9745) and a Link to the docs on
the base URL, and its spans and metrics carry zitadel.api.root_path so
the traffic left on it can be counted before GA removes it.

api/client holds the prefix and builds the generated client on an
origin; the server, the integration harness and the benchmark use it.
The session no-store rule matches both spellings, and the audit records
the operation instead of the mount's pattern. vercel.json routes /api/*
to the server first, and the docs say where the API lives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloud Ready Ready Preview Nov 1, 2026 3:44am UTC

Request Review

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: 2750b4a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 24 packages
Name Type
@zitadel/server Minor
@zitadel/cli Minor
@zitadel/testing Minor
@zitadel/server-linux-x64 Minor
@zitadel/server-linux-arm64 Minor
@zitadel/server-darwin-x64 Minor
@zitadel/server-darwin-arm64 Minor
@zitadel/server-win32-x64 Minor
@zitadel/api Minor
@zitadel/config Minor
@zitadel/components Minor
@zitadel/sdk-core Minor
@zitadel/sdk-next Minor
@zitadel/sdk-nuxt Minor
@zitadel/sdk-react Minor
@zitadel/sdk-vue Minor
@zitadel/sdk-angular Minor
@zitadel/sdk-solid Minor
@zitadel/sdk-svelte Minor
@zitadel/sdk-qwik Minor
@zitadel/sdk-sveltekit Minor
@zitadel/sdk-solid-start Minor
@zitadel/sdk-qwik-router Minor
@zitadel/sdk-tanstack-start Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

fforootd added a commit that referenced this pull request Oct 26, 2026
Brings in #2358's server, so CI and this branch's Vercel preview run against a server that serves /api/v1. The PR's base is that branch, so its diff is unchanged. When #2357 and #2358 have merged, rebase with: git rebase --onto origin/main claude/api-v1-gates-and-server

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the conflict in docs/runbooks/cloud.md, where both sides
rewrote the paragraph on the deployment checks: it keeps this branch's
/api/v1/schemas check and main's new CLI suite.

main dropped the request chain's query-redaction argument, for which
this branch wrapped the chain, so buildHTTPMux now passes the chain to
MountAPI as it is. The generated code both sides changed matches a
fresh server:generate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the conflict in docs/runbooks/cloud.md's service table: main
now builds every cloud service through one turbo graph (#2425), and this
branch adds /api/* to what the server serves. The server row takes
main's build and this branch's paths. The generated code matches a
fresh server:generate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fforootd and others added 2 commits October 28, 2026 15:26
Resolves the conflicts in buildHTTPMux and its tests: main added the
event retention trigger, a mount of its own, and this branch replaced
the API's catch-all with MountAPI. buildHTTPMux takes both, the trigger
ahead of MountAPI, and main's trigger test expects the root alias where
it expected the API.

main's meter views keep only the attributes they list on the API's
request metrics, which would have dropped zitadel.api.root_path, the
mark this branch puts on the root alias's traffic. The views keep it
now, the mount test collects through them, and the configuration guide
lists it. The generated code matches a fresh server:generate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the conflict in the server's run: main passes the console's
origins to the runtime resolver (#2462), and this branch builds the API's
two servers on the next line. The file takes both. Nothing main added
decides by request path: the console origins gate a flow's opening by
its Origin header, wherever the API is mounted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fforootd and others added 7 commits October 31, 2026 15:19
Resolves the conflicts with ADR 083's session cookies:

- The Vite and Angular proxies' session-cookie edits take both
  migrations: main replaces the hooks from before ADR 083, and this
  branch finds the CLI's entry by either version of its bearer hook.
  main's new code calls this branch's cliEntry instead of the
  cliEntryStatements it renamed.
- doctor's tests keep this branch's v2-proxy test beside main's two for
  the hooks from before ADR 083.
- sdk-core's tests for the prefixed session probe, sign-in and sign-out
  use ADR 083's cookie names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The cloud functions check BotID only in front of the sign-in widget's
POST /flow and /flow/{id}/submit, matched by exact path. Once the widget
calls the API under /api/v1 (ADR 077), those calls would pass unchecked.
The check reads both spellings, as the SDK and dev-proxy gates do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the conflicts with main's security headers and ADR 083:

- buildHTTPMux returns main's securityheaders.Middleware around the mux,
  with main's /csp-report mount ahead of MountAPI's.
- main's tests move onto this branch's mounts: the loopback-cookie test
  drives the API's test doubles under the prefix and at the root, the
  headers test also reads /api/v1/users, and TestSessionCookieNames
  mounts the API through MountAPI and calls the prefix.
- TestRootPathAliasServesTheSignIn reads ADR 083's cookie name.
- The cloud runbook's service table takes main's cloud-functions service
  and this branch's /api/* for the server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mpact-506209

No conflicts. Brings the branch up to date so the PRs stacked on it show
only their own changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hosted cloud's functions check the sign-in widget's flow writes for
bots by path (ADR 084), so section 5 lists them with the checks that
accept both spellings. The version check a separate PR proposed for
every CLI command is not part of this rollout; section 5 names the
checks zitadel start and zitadel setup already make.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ath-gates

Stacks this PR on #2356 (ADR 077's amendment), so the stack's top tests
the whole change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stacks this PR on #2357 (the path checks that accept both spellings),
itself on #2356, so the stack's top tests the whole change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fforootd
fforootd changed the base branch from main to claude/api-v1-path-gates October 31, 2026 22:28
fforootd added a commit that referenced this pull request Oct 31, 2026
Stacks this PR on #2358 instead of the merge branch of #2357 and #2358,
and brings in main through them. Conflicts:

- ADR 077, its README row and the design docs keep this PR's
  "Implemented" and "shipped" wording, with #2356's new section 5 text
  and main's other edits to the resource map.
- The console's Vite config is main's, restructured for the cloud's
  add-on, with this PR's proxy for /api/v1; the test base moved to
  vitest.config.ts, which now names the origin. The console's specs that
  main added or changed call /api/v1, as the rest do.
- sdk-core's revokeSession (ADR 083, main) asks for the CSRF token and
  revokes under the prefix; its tests and the six server SDKs' tests take
  main's cookie names and this PR's prefixed URLs.
- The scaffold guidance, sdk-next's docs, the CLI's SKILL.md, the
  console README and src/api/zitadel.ts take main's text with this PR's
  /api/v1 paths. The CLI's local-server tests and console-real's
  response match take main's cases on the prefixed paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fforootd
fforootd added this pull request to stack #2564 October 31, 2026 22:42
fforootd added a commit that referenced this pull request Oct 31, 2026
Brings in #2358's fix for the docs playground's session reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fforootd
fforootd marked this pull request as ready for review October 31, 2026 23:55
Copilot AI balanced review requested due to automatic review settings October 31, 2026 23:55
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-11-01T00:05:06.017608Z 6a27e50 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

A thorough review of the routing logic, client helper, path handling, tests, and configuration surfaced no concrete defects, with the only placeholder (the deprecation date) intentionally flagged and tracked as a pre-merge step.

No open issues 🎉

What changed in this PR

This PR (third in the ADR 077 stack) moves the resource API from the server root to the /api/v1 prefix while keeping backward compatibility: the server still answers every operation at its old root path until 1.0.0, marking those responses as deprecated (RFC 9745 Deprecation + Link headers) and tagging their spans/metrics with zitadel.api.root_path=true. Health probes (/livez, /readyz), the console, the runtime document, and IdP callbacks remain at the root. A new hand-written api/client package (PathPrefix, BaseURL, New) centralizes prefixing for the server, integration harness, and benchmark.

The implementation is careful and well-tested: it mounts the prefixed server at both /api/v1 and /api/v1/ to serve the API's own req.not_found instead of a ServeMux redirect; uses a separate unprefixed server for probes so orchestrator traffic isn't counted as alias traffic; makes deprecation headers depend on FindPath so 404s, 405s, and CORS preflights get none; and uses slices.Clip to avoid option-slice aliasing across the three servers.

Changes:

  • Add internal/api/mount.go (NewServers/MountAPI/withRootPathDeprecation) and api/client package; rewire buildHTTPMux and the integration harness to mount the three servers.
  • Update path-reading code (WithSessionStateNoStore, audit route recording) to accept both the prefixed and root spellings; keep the root-path metric attribute in the meter views.
  • Update the OpenAPI spec server to /api/v1, cloud vercel.json routing, deployment e2e checks, docs, and a @zitadel/server minor changeset.
File Description
internal/​api/​mount.go (+ mount_test.go) Core: builds prefixed/probe/root servers, mounts them, adds deprecation headers on root operations
api/​client/​client.go (+ client_test.go) New package: PathPrefix, BaseURL (de-dups prefix), New
internal/​audit/​request_middleware.go (+ test) Records operation as route; isAPIMount avoids recording mount patterns
internal/​api/​session_cache.go (+ tests) isNoStoreOperation strips /api/v1 before matching session paths
internal/​instrumentation/​zotel/​meter.go (+ test) Keeps zitadel.api.root_path in ogen request attributes
cmd/​server/​server.go, cmd/​server/​mux*_test.go buildHTTPMux takes api.Servers and calls MountAPI; tests cover full routing table
internal/​api/​integration_test/​helpers/​* EnsureAPIServers/APIBaseURL/NewApiClient use the prefix; harness field renamed
internal/​api/​integration_test/​*_test.go Raw requests switched to harness.APIBaseURL(t); new root_path_alias_test.go
tools/​bench/​* Harness/k6 module use client.New; /readyz stays at root
e2e/​console/​...routes.spec.ts, e2e/​schemas/​...schemas.spec.ts Assert /api/v1 prefix and deprecated root paths
apps/​docs/​**, docs/​**, api/​openapi/​**, api/​generated/​** Doc/spec updates (server URL, probes at root, base-URL section); generated comments only
vercel.json, apps/​cloud/​README.md, .changeset/​server-api-path-prefix.md Route /api/* to server first; runbook/README/changeset updates

Notes for the human reviewer: the deprecation date (rootPathDeprecatedSince = 2026-10-25) is an intentional placeholder with a TODO and is called out in the PR description as a pre-merge step, so I did not flag it. Final approval is deferred to a human.

Review effort: Balanced

fforootd and others added 3 commits October 31, 2026 17:48
…d's checks

The CLI's doctor verdicts on an SPA dev proxy and the cloud functions' bot
check each spelled /api/v1 out again, beside @zitadel/api's API_PREFIX.
Both now derive it: the CLI names the prefixed exchange path once
(PREFIXED_EXCHANGE_PATH) and its verdicts and messages use it; the cloud
functions import API_PREFIX, with @zitadel/api as a dependency, its build
ahead of theirs in moon and turbo, and their tests reading its source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in #2357's shared API prefix for the CLI's and cloud's checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The spec's servers URL is the contract, but nothing held client.PathPrefix
(Go) or API_PREFIX (@zitadel/api) to it: changing the spec alone would
have left the server's mount and every client behind. A test on each side
now reads the spec and compares. The docs' playground session helper and
cURL base take API_PREFIX instead of spelling /api/v1 out again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fforootd added a commit that referenced this pull request Nov 1, 2026
Brings in #2358's spec checks and #2357's shared prefix. The cloud
functions' sign-in forwarder and directory both import API_PREFIX from
@zitadel/api now, so the constant this branch had added to zitadel.ts
goes; base-url.spec.ts keeps this branch's imports beside the new test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fforootd and others added 2 commits October 31, 2026 19:50
The specs import @zitadel/api's dist/, as Next does: the source condition
the previous commit set reaches only Vite's client resolution, not the
SSR mode a node-environment test runs in. Locally a dist/ was there; in
CI, where nothing had built it, three suites failed with "Cannot find
package '@zitadel/api/runtime/base-url'". The test task now waits for
api:build in moon and @zitadel/api#build in turbo, as sdk-core's and the
test kit's do, and the ineffective condition goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in #2357's build edge for the cloud functions' tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fforootd
fforootd added this pull request to the merge queue Nov 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 1, 2026
Base automatically changed from claude/api-v1-path-gates to main November 1, 2026 03:36
Takes #2356 and #2357, which the merge queue landed, and #2561's
reads-only playground; its session read and spec stubs move to /api/v1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fforootd
fforootd added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit aa38122 Nov 1, 2026
20 checks passed
@fforootd
fforootd deleted the claude/api-v1-server branch November 1, 2026 03:58
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Nov 1, 2026

This branch was successfully deployed

1 active deployment
Preview — 2750b4a3 Deployed Nov 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants