Add an origin pattern
Adds one {pattern, kind} to the project's origins. A primary pattern
must be an exact URL (no wildcard). Preview patterns may include a single
DNS-label wildcard. Adding a pattern that already exists with the same
kind is idempotent and answers 201 with the stored origin.
AuthorizationBearer <token>Scope: origin.write
project_id*stringThe unique identifier of the project.
^[a-zA-Z0-9_-]+$application/json- body
One of a project's origins: a pattern and what it is for. A primary
pattern is an exact origin (scheme and host, no *) that admits requests
from the URLs it matches. A preview pattern only bounds which URLs a
preview deploy may register; it may include at most one * inside a single
host label (* matches one or more characters, none of them a dot). A
literal beats a wildcard. Unknown hosts are accepted as written. An empty
list means every origin is admitted until the first pattern is added.
Loopback origins are admitted without a pattern.
pattern*stringkind*string"primary""preview"The pattern was added.
application/json- response
pattern*stringkind*string"primary""preview"import { configureZitadel, getApi } from "@zitadel/api/config";import { setApiCsrfToken } from "@zitadel/api/runtime/auth";// In the browser, through the SDK proxy: the session cookie authenticates the call.const client = getApi(configureZitadel({ projectId: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" }));// A write the session cookie authenticates carries the session's CSRF token.setApiCsrfToken((await client.getMySessionCsrfToken()).csrf_token);const origin = await client.addOrigin("proj_01KWH1P4MYS7F0N9WD3P2E4YM5", { pattern: "string", kind: "primary" });{ "pattern": "string", "kind": "primary"}Was this helpful?