Docs

Add an origin pattern

POST
/projects/{project_id}/origins

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.

Authorization

headerAuthorizationBearer <token>

Scope: origin.write

Path Parameters

project_id*string

The unique identifier of the project.

Match^[a-zA-Z0-9_-]+$

Request Body

application/json
  1. 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*string
kind*string
Value in"primary""preview"

Response Body

The pattern was added.

application/json
  1. response
pattern*string
kind*string
Value in"primary""preview"
Example Request
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" });
Example Response
{  "pattern": "string",  "kind": "primary"}

Was this helpful?