Create or revise a registered application
Creates or revises a registered application that authenticates its users via Zitadel. If the slug does not already exist in the project, a new application is created. If one with that slug already exists, a revision is created.
A revision gets a new revision_id and does not modify the application's
id. Sending an unchanged document also creates a revision. Each client
is matched to the stored one by its slug and keeps its client_id: a
revision that changes a client's client_id is rejected with
app.field_immutable. A revision keeps every client of the
stored document: one that omits a client is also rejected with
app.field_immutable, since removing a client is not available
yet. A client with a new slug is a new client. It takes the client_id
the document supplies, or the server generates one, and every response
carries it in definition. A client_id another client of the project
holds, or ever held, is rejected with app.client_id_taken.
Every new client gets a secret, generated by the server and returned once
in client_secrets. The server stores only its hash, so no later read
returns it.
The document is validated against the application.json schema before
anything is stored, and then against the rules the authorization server
applies: refresh_token comes with authorization_code, a client with
authorization_code has at least one redirect URI, and each redirect
URI meets the rules redirect_uris states. A document that breaks one
is refused with app.invalid, whose details identify the
setting.
An application a release declares has one writer, the release: a slug
one holds is refused with app.declared. Edit its file under
.zitadel/applications/ and deploy instead. A client here leaves
secret out, which only a release sets; one that sets it is refused with
app.invalid.
If the document is refused, no change is stored and an existing application keeps its current revision.
oauth2 application.writeAuthorizationBearer <token>Scope: application.write
project_id*stringThe project ID: the id that createProject (POST /projects) returns. zitadel setup prints
it as "Project id" in its summary and as project_id with --json, and
writes it to .env.local as ZITADEL_PROJECT_ID.
^[a-zA-Z0-9_-]+$Idempotency-Key?stringOptional. Once honored, a retry with the same key and body returns the first request's status and a new secret for each client the first request created, and writes no revision.
Not honored yet: sending the same request again, for example after its response was lost, creates another revision and returns no secret, because the clients the first request created are already stored.
application/json- body
The request body for creating or revising a registered application.
application*The application document. If its slug does not already exist in the
project, a new application is created. If one with that
slug already exists, this becomes a new revision of it. The document is
validated against the application.json schema, and returned as the
definition in the response with each client's client_id filled in.
The revised application.
application/json- response
An application as publishApplication (POST /applications) wrote it, with
its document as definition and the secrets of the clients it created.
id*stringA unique ID, generated when the application is created and shared by every revision.
revision_id*stringThe ID of the revision this entry holds. getApplication
(GET /applications/{application_id}) returns the newest one.
slug*stringThe identifier by which other documents reference the application. Fixed for the life of the application.
declared*booleanTrue when a release declares the application, from a file under
.zitadel/applications/, and only a deploy revises it. False when it
was registered through createApplication (POST /applications).
created_at*stringWhen the application was created.
date-timeupdated_at*stringWhen this revision was created. On the newest revision, that is when the application was last revised.
date-timedefinition*The stored application document, with each client's client_id.
client_secrets?array<>The secrets this write generated, one for each client it created,
each with the client's client_id. Absent when the write created
no client. Each secret is shown only once.
import { createZitadelClient } from "@zitadel/api/client";const client = createZitadelClient({ baseUrl: process.env.ZITADEL_URL ?? "http://localhost:8080", token: process.env.ZITADEL_PROJECT_SECRET!, // server-side only});const application = await client.publishApplication( { application: { slug: "shop", name: "Shop", clients: [ { slug: "web", type: "confidential", grant_types: ["authorization_code", "refresh_token"], redirect_uris: [ "https://shop.example.com/callback", "http://localhost:3000/callback", ], }, ], }, }, { project_id: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" },);id is the one allocated when the application was created,
revision_id is new, and updated_at has moved past
created_at. The new client jobs got a generated client_id
and a secret; the kept client web got neither.
{ "id": "app_01KWH3B72K7M7F0N9WD3P2E4YM", "revision_id": "apprev_01KWHF2XY6RN7F0N9WD3P2E4YM", "slug": "shop", "declared": false, "created_at": "2026-11-06T09:11:00Z", "updated_at": "2026-11-07T14:20:00Z", "definition": { "slug": "shop", "name": "Shop", "clients": [ { "slug": "web", "client_id": "client_01KWH3B72K7M7F0N9WD3P2E4YP", "type": "confidential", "grant_types": [ "authorization_code", "refresh_token" ], "redirect_uris": [ "https://shop.example.com/callback", "http://localhost:3000/callback" ] }, { "slug": "jobs", "client_id": "client_01KWHF2XY6RN7F0N9WD3P2E4YQ", "type": "confidential", "grant_types": [ "authorization_code" ], "redirect_uris": [ "https://jobs.shop.example.com/callback" ] } ] }, "client_secrets": [ { "client": "jobs", "client_id": "client_01KWHF2XY6RN7F0N9WD3P2E4YQ", "secret": "sk_client_7Kp2mQx9vR4tL8nB3wZ5yH6jF1dS0aE2" } ]}Was this helpful?