Docs

API reference

How to call the Zitadel API, and every operation it has, generated from its OpenAPI document.

The API reference is generated from the server's OpenAPI document, one page per operation, grouped by the document's tags. The whole document is at /docs/openapi.json, for client generators, API tools, and agents. A running server also serves the contract it was built from at /api/v1/openapi.json on its origin, with no authentication. This page covers what every operation shares: where to send a request, how to authenticate it, and what errors and lists look like.

Each operation shows its request as a call through @zitadel/api, the generated TypeScript client, as the CLI command that runs it where there is one, and as cURL. All of them follow the example you pick and what you enter in the playground. An operation's Markdown, its URL plus .md, has the same samples for its default request, cURL against a local server at http://localhost:8080/api/v1.

Use it when you need exact request bodies, response shapes, auth requirements, and operation names for the preview server. For the higher-level product path, start with the Quickstart, the CLI reference, and the SDK docs:

Base URL

The API lives under /api/v1 on the server's origin, and an operation's path follows it: POST /projects is https://preview.zitadel.com/api/v1/projects on the hosted preview.

ServerBase URL
The hosted preview, the CLI's defaulthttps://preview.zitadel.com/api/v1
A server zitadel start runs on your machinehttp://localhost:8080/api/v1, or the next free port for a second directory

Setup writes the server your app uses to .env.local as ZITADEL_URL, its origin without the prefix, which the SDKs and the samples on these pages read.

The health probes stay at the root of the origin, /livez and /readyz, where orchestrators look for them; they answer under /api/v1 too. The OpenAPI document for that deployment is GET /api/v1/openapi.json.

Until 1.0.0 the server also answers every operation at its path without the prefix, https://preview.zitadel.com/projects for one. Such a response carries a Deprecation header (RFC 9745) with the date the prefix shipped, and a Link with rel="deprecation" to this section. Move a client that still calls those paths to the prefix: from 1.0.0 they answer 404 with req.not_found.

Authentication

An operation's page names the security schemes it accepts; one that names none needs no credential. The API document declares two.

Project secret (oauth2)

Send the project secret as a bearer token:

Authorization: Bearer <project secret>

The document declares this scheme as OAuth 2.0, with authorization-code and client-credentials flows and their scopes; today the server accepts a project secret for it and no other token.

zitadel setup creates your project and writes its secret to .env.local as ZITADEL_PROJECT_SECRET, and to .zitadel/secret. Create project (POST /projects), which needs no credential, returns it as project_secret; no other operation returns it. Keep the secret on a server, out of source control and out of the browser (Configuration as code).

The session cookie, __Host-zitadel_session, authenticates a signed-in user's requests from the browser. The server sets it when a session is created or a handoff is exchanged (Sessions); an app sends it through the SDK proxy on its own origin. Over plain http to a loopback host, such as http://localhost:8080, the server sets it as zitadel_session, without the prefix and Secure, so that Safari keeps it, and reads that name there too. A program sends __Host-zitadel_session over any transport.

A request the cookie authenticates that changes something must come from the same origin and carry the session's CSRF token, from GET /sessions/me/csrf, in the X-Zitadel-CSRF header. GET requests and the POST …/query reads need no token. A missing or invalid cookie answers 401 with the code auth.unauthorized, a failed CSRF check 403 with auth.csrf_invalid.

When a request to an operation that accepts both schemes carries a valid bearer token, the token is its credential and the cookie is not read.

Errors

A request that fails answers with a 4xx or 5xx status and the error envelope as its body:

{
  "code": "proj.not_found",
  "message": "project not found"
}
  • code, always present: the error, stable across releases. Branch on it. Before the dot is its namespace, such as proj for projects or req for the request itself, and after it what went wrong; a few codes, such as internal, have no namespace.
  • message, always present: an explanation for people, which may change. Never parse it.
  • details, optional: an object with more about the error, such as the request field at fault. Most errors carry none.

Errors lists every code, what it means, and the operations that return it.

Timestamps

Every timestamp the API returns is a UTC RFC 3339 string ending in Z, such as 2026-04-28T15:45:00Z. The API returns no other offset, and never epoch seconds or milliseconds. Fractional seconds appear only when the value has them, so parse the string instead of matching a fixed length.

Show a time in your user's own zone in your client; the API does not convert.

Pagination

A list is paged with a cursor. Set the page size with limit, from 1 to 100, 20 when you leave it out. While more results follow, the response carries next_page_token; repeat the request with it as page_token to get the next page. On the last page next_page_token is absent or null. A list returns no total count.

A GET list takes both as query parameters, a POST …/query in its JSON body:

curl -X POST "$ZITADEL_URL/api/v1/users/query" \
  -H "Authorization: Bearer $ZITADEL_PROJECT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"limit": 50, "page_token": "<next_page_token from the previous page>"}'

A page token is opaque, and its format may change between releases: pass it back as you got it.

Rate limits

Some operations declare a 429 Too Many Requests response, with the error envelope as its body; Errors lists them. The API document defines no rate-limit headers and no Retry-After, so a 429 does not say how long to wait: retry after a pause, and wait longer each time it answers 429 again.

Runtime auth

Configuration

Management

System

Was this helpful?