Skip to content

feat(api): add the applications contract - #2888

Merged
gayathri-r-v merged 10 commits into
mainfrom
feat/applications-api
Nov 10, 2026
Merged

gayathri-r-v merged 10 commits into
mainfrom
feat/applications-api

Conversation

@gayathri-r-v

@gayathri-r-v gayathri-r-v commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Context

Summary

The first of three PRs for #2788. It adds the contract for registered
applications and their OAuth clients; domain and storage, then service and
API, follow in their own PRs.

  • POST /applications creates or revises a registered application by slug,
    and GET /applications/{id} reads one at its newest revision. The
    operations have no handler until the service PR; a request to them answers
    500 today.
  • application.json is the schema the server validates the document
    against. It stays out of .zitadel/meta/ until a command reads
    application files (Applications: declared applications in releases #2790).
  • Every new client gets a server-generated secret, returned once in
    client_secrets with the client's slug and client_id. The get response
    never carries one. An Idempotency-Key lets a retry after a lost response
    get the first response, secrets included.
  • A client keeps its client_id across revisions; a changed id is refused
    with application.field_immutable, a reused id with
    application.client_id_taken. A revision cannot remove a client; removal
    comes with deletion.
  • Scopes application.read and application.write, and the permission
    catalog rows for them.
  • The Applications page in the API reference, and the app, apprev and
    client prefixes in ADR 047.

Validation

  • moon run server:generate
  • moon run server:openapi (0 errors, 1 pre-existing warning)
  • cd apps/api && go build ./... && go test ./internal/api/ ./api/...
  • moon run config:test
  • moon run workspace:check -- --only release on Node 24 (CLI tests: 371 files, 6580 tests passed)

Release notes / changeset

Changeset: .changeset/applications-api-contract.md — @zitadel/server and
@zitadel/config minor: the applications contract.

Notes

  • A decision the contract makes, to note on Applications: create and read registered applications with their OAuth clients #2788: localhost, names under
    it and loopback IPs count as loopback hosts for http redirect URIs.
  • The client_/dcr_ prefix ban on a supplied client_id is a domain rule
    in the next PR, so the schema pattern accepts server-generated ids.
  • The large generated diffs in oas_json_gen.go are alphabetical insertion:
    Application* types sort before the Att* error types.
  • The application.* error codes named here (field_immutable,
    client_id_taken, invalid) get their domain sentinels and generated
    schemas in the domain PR, as the idps contract did in feat(idp): define the connection API #1217.
  • The client document carries no credential field. The ${{ NAME }} secret
    reference ADR 082 §3 puts in .zitadel/applications/<slug>.json comes with
    the release build in Applications: declared applications in releases #2790; POST /applications returns server-generated
    secrets once in client_secrets.
  • client_id is a column of the client row, not its key. A supplied id, a v4
    <id>@<project> or one the CLI generated, is caller-chosen and not
    time-sortable, which ADR 047 §4 keeps out of primary keys; the row has a
    minted key and ADR 047 §5 records the rule.
  • getApplicationById takes the project secret only. The session cookie
    comes with the console screen, as it did for the sibling reads.
  • The contract follows the ADR 082 amendment in docs: bring ADR 082 in line with the identity model and accept it #2864 (/applications,
    application.json, a caller-suppliable client_id, first_party per
    client); ADR 082 on main still describes /apps. Merge order: docs: bring ADR 082 in line with the identity model and accept it #2864 first.

🤖 Generated with Claude Code

Add POST /applications and GET /applications/{id}, the application.json
meta-schema that zitadel setup copies, and the application.read and
application.write scopes. The handlers return not implemented until the
server implements them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 9, 2026

Copy link
Copy Markdown

Deployment failed for project cloud with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: cloud.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: 970dd0d

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

This PR includes changesets to release 25 packages
Name Type
@zitadel/server Minor
@zitadel/config Minor
@zitadel/cli Minor
@zitadel/cloud Patch
@zitadel/components Minor
@zitadel/testing Minor
@zitadel/sdk-angular Minor
@zitadel/sdk-core Minor
@zitadel/sdk-next Minor
@zitadel/sdk-nuxt Minor
@zitadel/sdk-qwik Minor
@zitadel/sdk-react Minor
@zitadel/sdk-solid Minor
@zitadel/sdk-svelte Minor
@zitadel/sdk-tanstack-start Minor
@zitadel/sdk-vue 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/sdk-sveltekit Minor
@zitadel/sdk-solid-start Minor
@zitadel/sdk-qwik-router 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

@gayathri-r-v
gayathri-r-v requested a balanced review from Copilot November 9, 2026 08:32

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.

🟡 Changes recommended

Valid authenticated requests to the new application routes return HTTP 500 instead of 501, and the application schema lacks positive and negative validation tests.

1 open issue
What changed in this PR

Adds the contract for registered applications and their OAuth clients, establishing the API and editor schemas for #2788. Storage and service implementation remain follow-up work.

Changes:

  • Defines create-or-revise and read operations, client identity rules, and one-time secret responses.
  • Generates Go client/server bindings and exposes the application meta-schema through configuration tooling.
  • Adds application scopes, permission documentation, and release notes.
File Description
packages/​go/​api/​oas_validators_gen.go Adds application and client validation.
packages/​go/​api/​oas_security_gen.go Maps application operation scopes.
packages/​go/​api/​oas_schemas_gen.go Adds application request and response types.
packages/​go/​api/​oas_response_decoders_gen.go Decodes application responses.
packages/​go/​api/​oas_request_encoders_gen.go Encodes application creation requests.
packages/​go/​api/​oas_parameters_gen.go Adds project and application parameters.
packages/​go/​api/​oas_operations_gen.go Adds application operation names.
packages/​go/​api/​oas_interfaces_gen.go Adds application response interfaces.
packages/​go/​api/​oas_client_gen.go Adds Go client methods.
packages/​go/​api/​oas_cfg_gen.go Adds the client ID validation pattern.
packages/​config/​src/​meta-schemas.ts Exposes the application editor schema.
packages/​config/​src/​meta-schemas.test.ts Checks application schema inclusion.
docs/​design/​api/​system-permission-catalog.md Documents application permissions and revision semantics.
apps/​cli/​tests/​unit/​commands/​api-coverage.test.ts Exempts applications pending CLI support.
apps/​api/​internal/​api/​generated/​oas_validators_gen.go Adds server-side schema validation.
apps/​api/​internal/​api/​generated/​oas_unimplemented_gen.go Adds placeholder application handlers.
apps/​api/​internal/​api/​generated/​oas_server_gen.go Extends the server handler interface.
apps/​api/​internal/​api/​generated/​oas_security_gen.go Maps server operation scopes.
apps/​api/​internal/​api/​generated/​oas_response_encoders_gen.go Encodes application responses.
apps/​api/​internal/​api/​generated/​oas_request_decoders_gen.go Decodes application creation requests.
apps/​api/​internal/​api/​generated/​oas_parameters_gen.go Decodes application route parameters.
apps/​api/​internal/​api/​generated/​oas_operations_gen.go Adds server operation names.
apps/​api/​internal/​api/​generated/​oas_interfaces_gen.go Adds server response interfaces.
apps/​api/​internal/​api/​generated/​oas_handlers_gen.go Adds application request handling pipelines.
apps/​api/​internal/​api/​generated/​oas_cfg_gen.go Adds server client ID validation pattern.
apps/​api/​api/​openapi/​security/​oauth2.yaml Declares application read/write scopes.
apps/​api/​api/​openapi/​openapi-spec.yaml Registers application tags and paths.
apps/​api/​api/​openapi/​endpoints/​schemas/​application.yaml Defines the application document.
apps/​api/​api/​openapi/​endpoints/​schemas/​application.json Generates the application JSON Schema.
apps/​api/​api/​openapi/​endpoints/​schemas/​application-client.yaml Defines OAuth client settings and identity rules.
apps/​api/​api/​openapi/​endpoints/​applications/​methods.yaml Defines create-or-revise behavior and examples.
apps/​api/​api/​openapi/​endpoints/​applications/​createApplication-error-response.yaml Generates creation error responses.
apps/​api/​api/​openapi/​endpoints/​applications/​create-application-response.yaml Defines write responses with one-time secrets.
apps/​api/​api/​openapi/​endpoints/​applications/​create-application-request.yaml Defines the application request envelope.
apps/​api/​api/​openapi/​endpoints/​applications/​by_id/​methods.yaml Defines reading the latest revision.
apps/​api/​api/​openapi/​endpoints/​applications/​by_id/​getApplicationById-error-response.yaml Generates read error responses.
apps/​api/​api/​openapi/​endpoints/​applications/​application-response.yaml Defines secret-free read responses.
apps/​api/​api/​openapi/​endpoints/​applications/​application-client-secret.yaml Defines one-time client secret payloads.
apps/​api/​api/​openapi/​components/​parameters/​application-id.yaml Defines the application path parameter.
apps/​api/​api/​openapi/​bundled/​openapi.json Bundles the new application contract.
.changeset/​applications-api-contract.md Records server and configuration releases.

Review effort: Balanced

"auth-method.json",
"sso-auth-method.json",
"idp-connection.json",
"application.json",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The schema's only consumer in this PR is the server, which validates documents against it in the service PR. That is where a negative case first has behavior to protect, so the Ajv cases come with that PR.

gayathri-r-v and others added 3 commits November 9, 2026 10:56
Removing a client waits for the deletion design, so a revision that omits
a stored client is refused instead of leaving a retired row behind.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Qualify the client_ ban to new clients, require authorization_code with
refresh_token, make redirect_uris the home of the redirect rule, compose
the create response over the application response, add the docs tag page,
register the prefixes in ADR 047 and name @zitadel/cli in the changeset.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@gayathri-r-v
gayathri-r-v marked this pull request as ready for review November 9, 2026 11:07
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@wim07101993 wim07101993 self-assigned this Nov 9, 2026
@wim07101993
wim07101993 self-requested a review November 9, 2026 13:42
Comment thread packages/config/src/meta-schemas.ts Resolved
gayathri-r-v and others added 2 commits November 9, 2026 15:35
A retry after a lost response finds the clients stored and gets no secret,
so the key lets the retry return the first response. The editor schema
leaves .zitadel/meta/ until a command reads application files, the document
is the application field of the body, and the query is listed as not yet
exposed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@gayathri-r-v
gayathri-r-v added this pull request to the merge queue Nov 10, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 10, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gayathri-r-v
gayathri-r-v added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit 8f2033e Nov 10, 2026
18 of 19 checks passed
@gayathri-r-v
gayathri-r-v deleted the feat/applications-api branch November 10, 2026 10:41
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Nov 10, 2026
cursor Bot pushed a commit that referenced this pull request Nov 10, 2026
Resolve additive conflicts between invitations (#2849) and applications
(#2888): keep both CLI api-coverage exclusions, regenerate ogen outputs
from the merged OpenAPI contract.

Co-authored-by: Silvan <adlerhurst@users.noreply.github.com>
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.

3 participants