Skip to content

Sample iModels

The iTwin Studio CLI provides a set of commands to ease the management of sample iModels.

Terminal window
pnpx @bentley/studio-cli samples --help

The share-key sub-command provides a set of commands to manage share keys, which are used to fetch sample iModels in iTwin Studio.

Terminal window
pnpx @bentley/studio-cli samples share-key --help

All share key commands require authentication using the iTwin Platform. The first time you use any command, a browser window will open prompting you for login. You need to have owner access to an iTwin to create a share key for it.

The following environment variables can be used to override the default authentication and API endpoint configuration:

VariableRequiredDefaultDescription
STUDIO_CLIENT_IDNoenvironment specific iTwin Studio’s client IDsThe iTwin Platform client ID
STUDIO_SCOPENoitwin-platformThe OAuth scope for authorization
STUDIO_AUTHORITYNohttps://[env-prefix]ims.bentley.com/The issuer URL for authentication
STUDIO_REDIRECT_URINohttp://127.0.0.1:53386/signin-callback/The redirect URI for OAuth flow
IMJS_URL_PREFIXNo"" (production)Alternative environment prefix variable

Lists all share keys for a given iTwin using the Get iTwin Shares API.

Terminal window
pnpx @bentley/studio-cli samples share-key list --itwin-id <ITWIN_ID> [--env-prefix <ENV_PREFIX>]

Creates a new share key for a given iTwin with the iTwinStudioSamples contract using the Create iTwin Share API.

Terminal window
pnpx @bentley/studio-cli samples share-key create --itwin-id <ITWIN_ID> [--env-prefix <ENV_PREFIX>]

Revokes an existing share key using the Revoke iTwin Share API.

Terminal window
pnpx @bentley/studio-cli samples share-key revoke --itwin-id <ITWIN_ID> --share-id <SHARE_ID> [--env-prefix <ENV_PREFIX>]