Docs
/
/

Schemas

Commands for managing recipient schemas in the Knock CLI.

#

Schema commands enable you to sync your recipient schemas (for users, tenants, and object collections) between a Knock environment and your local file system, so you can keep your schema configuration in version control.

Schema file structure

#

When schemas are pulled from Knock, they are stored in a schemas/ directory. User and tenant schemas are stored at the top level, and object collection schemas are stored under an objects/ subdirectory, named by their collection key.

Each file describes the schema's properties, including the curated visible, label, description, and preview_text values. A property's inferred type and source are read-only.

knock schema pull [itemType] [flags]

#

Pull one or more recipient schemas from an environment into your local file system. Pass an item type (user, tenant, or object) to pull a single schema, or use --all to pull every schema in the environment.

Use an --environment flag to specify the target environment; if omitted, the Knock CLI defaults to the development environment.

Flags

--environmentstring

The environment to use. Defaults to development.

--branchstring

The branch to use. Defaults to the main branch.

--allboolean

Pull all schemas from the environment. Cannot be combined with an item type.

--collectionstring

The object collection key. Required when the item type is object.

--schemas-dirstring

The target schemas directory path.

--forceboolean

Overwrite local schema files without prompting for confirmation. Defaults to false.

knock schema push [itemType] [flags]

#

Push one or more local recipient schemas to an environment. Pass an item type (user, tenant, or object) to push a single schema, or use --all to push every schema in your local schemas directory.

Pushing a schema applies your curation (hidden properties, labels, descriptions, and preview text) to the target environment immediately. A property's inferred type and source are read-only and are not changed by a push.

Flags

--environmentstring

The environment to use. Defaults to development.

--branchstring

The branch to use. Defaults to the main branch.

--allboolean

Push all schemas from the local schemas directory. Cannot be combined with an item type.

--collectionstring

The object collection key. Required when the item type is object.

--schemas-dirstring

The target schemas directory path.

New chat