Docs

zitadel grants create

Create a grant.

Usage

npx @zitadel/cli@latest grants create [flags]

Flags

FlagDescription
-e, --env <value>Environment to run against, e.g. production. Defaults to ZITADEL_ENV, then the hosting platform's build (VERCEL_ENV, or Netlify's CONTEXT), then development.
--env-file <value>Read ZITADEL_* values from this file ahead of the process environment. A relative path is read from the current directory, not from --cwd. Cannot be combined with --env.

Required field flags

FlagDescription
--relation <value>(required) Catalog relation on object_type project. One of viewer, editor, admin.

Optional field flags

FlagDescription
--expires-at <value>Optional expiry.

User field flags

FlagDescription
--user-user-id <value>
--user-identifier <value>The user schema's designated identifier (x-identifier), looked up in the platform project.

Team field flags

FlagDescription
--team-team-id <value>
--team-name <value>Team name, unique per project case-insensitively.

Raw body flags

FlagDescription
--data <value>Whole body as a JSON object. Field flags and --set apply over it. Not with --file.
--file <value>Read the body from a JSON file; - reads stdin. Field flags and --set apply over it. Not with --data.
--set <value>Set one field by its dot path: path=value, or path:=json for JSON. Repeatable; applied after the field flags, in order. A key that contains a dot is set through its parent: --set 'parent:={"a.b":"x"}'. Can be given more than once.

It also takes the global flags.

Examples

npx @zitadel/cli@latest grants create --relation viewer --user-identifier alice@acme.com --json
npx @zitadel/cli@latest grants create --data '{...}' --json
npx @zitadel/cli@latest grants create --file ./grant.json

API

It calls Create grant, POST /grants, in the Grants API.

Was this helpful?