Create or revise an identity provider
Creates or revises an identity provider, an external sign-in such as Google, from its connection document. If the slug does not already exist, a new identity provider 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 identity
provider's id. Identity links, which tie a user to an account at the
provider, keep resolving. Releases and authentication attempts stay pinned
to the revision they captured.
Identity fields are fixed for the life of the identity provider and a
revision that changes one is rejected: protocol, subject_claim, and
issuer, the field that names the authority. Their values decide which provider
account a stored subject belongs to, so changing one would silently
repoint existing identities at a different provider.
subject_claim is optional, and sub is used as the default value. If a
revision updates subject_claim to a different value than the one set
during creation, the request is rejected.
OIDC is the only protocol.
The document is validated against the idp-connection.json schema before
anything is stored. The rules the server applies when it starts a sign-in
then run on the document, so a document that could never start one is
refused here with idp.endpoints_partial: the OIDC block sets an endpoint
without the others. Set no endpoint, and discovery fills them, or set
authorization_endpoint, token_endpoint, jwks_uri, and
userinfo_endpoint. userinfo_endpoint may be left out when
id_token_mapping is on, but setting it alone still counts as setting an
endpoint. The details list the missing endpoints.
A refused document stores nothing, and on a revise the current revision stays unchanged.
oauth2 idp.writeAuthorizationBearer <token>Scope: idp.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_-]+$application/json- body
The request body for creating or revising an identity provider.
idp*The connection document, in the shape of a .zitadel/idps/<slug>.json
file. If its slug does not already exist, a new identity provider is
created. If one with that slug already exists, this becomes a new
revision of it. The document is validated against the
idp-connection.json schema, and returned as the definition in the
response.
The revised identity provider.
application/json- response
An identity provider, with its connection document as definition.
id*stringA unique ID, generated when the identity provider is created and shared by every revision. The identity links reference this ID.
revision_id*stringThe ID of the revision this entry holds, pinned by authentication
attempts and releases. getIdp (GET /idps/{idp_id}) and queryIdps (POST /idps/query)
return the newest one; getIdpRevision (GET /idps/revisions/{revision_id})
(GET /idps/revisions/{revision_id}) returns the requested revision.
slug*stringThe identifier by which user schemas and flow definitions reference the identity provider. Fixed for the life of the identity provider.
created_at*stringWhen the identity provider was created.
date-timeupdated_at*stringWhen this revision was created. On the newest revision, that is when the identity provider was last revised.
date-timedefinition*The stored connection document.
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 idp = await client.publishIdp( { idp: { slug: "google", protocol: "oidc", template: "google", display_name: "Google", subject_claim: "sub", claim_mapping: { email: "email", givenName: "given_name", familyName: "family_name", }, verified_claims: { email: "email_verified" }, provisioning: { creation: "auto" }, oidc: { issuer: "https://accounts.google.com", client_id: "${{ GOOGLE_CLIENT_ID }}", client_secret: "${{ GOOGLE_CLIENT_SECRET }}", scopes: ["openid", "profile", "email"], static_authorize_parameters: { prompt: "select_account" }, }, }, }, { project_id: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" },);The scope list grew. id is the one allocated when the
identity provider was created, revision_id is new, and updated_at
has moved past created_at.
{ "id": "idp_01KWH3B72K7M7F0N9WD3P2E4YM", "revision_id": "idprev_01KWHF2XY6RN7F0N9WD3P2E4YM", "slug": "google", "created_at": "2026-07-14T09:11:00Z", "updated_at": "2026-07-16T14:20:00Z", "definition": { "slug": "google", "protocol": "oidc", "template": "google", "display_name": "Google", "subject_claim": "sub", "claim_mapping": { "email": "email", "givenName": "given_name", "familyName": "family_name" }, "verified_claims": { "email": "email_verified" }, "provisioning": { "creation": "auto" }, "oidc": { "issuer": "https://accounts.google.com", "id_token_mapping": false, "client_id": "${{ GOOGLE_CLIENT_ID }}", "client_secret": "${{ GOOGLE_CLIENT_SECRET }}", "token_endpoint_auth_method": "client_secret_basic", "scopes": [ "openid", "profile", "email", "https://www.googleapis.com/auth/user.phonenumbers.read" ], "pkce_enabled": true, "static_authorize_parameters": { "prompt": "select_account" } } }}Was this helpful?