Was this article helpful?
Thanks for your feedback
After installing CLI in your system and before using the commands, you need to authenticate yourself either by using the Login command or by adding the Management token within the CLI session.
Note: Even though we support using delivery token for bulk publishing and unpublishing entries/assets, we recommend using Management token in the CLI session for efficient usability.
The auth:login command lets you log in to Contentstack and save the session.
Open the terminal and run the following command to log in to your Contentstack account. After successful login, the authtoken will be generated automatically which you can use in import and export operations.
Note: Contentstack currently supports three regions: North America, Europe and Azure North America. If you want to use a specific endpoint, other than NA, refer to the Set Region command.
Note: Contentstack CLI now supports Two-factor Authentication, which ensures additional security to your Contentstack account.
Usage
csdx auth:login
OR
csdx login
Options
Examples
The auth:logout command lets you log out of Contentstack and clear the session.
Usage
csdx auth:logout
OR
csdx logout
Options
y, --yes: Exclude confirmation to logout
Examples
To perform content management tasks, we recommend using the management token.
Note: Before running this command, make sure you have generated a management token in your stack.
The following command lets you add an existing management token from your Contentstack account and save it to the session for further use.
Usage
csdx auth:tokens:add --management
Options
Examples
For Bulk Publish commands, if you don’t want to use the management token, you can use the delivery token instead. However, you will not be able to execute import and export content commands by using the delivery token.
Note: Before running this command, make sure you have generated a delivery token in your stack.
Usage
csdx auth:tokens:add --delivery
Options
Examples
The auth:tokens:remove command lets you delete a management/ delivery token from your local CLI session.
Note: This command will not delete the management/ delivery token from the stack, it deletes the token from the local CLI session.
Usage
csdx auth:tokens:remove
Options
Examples
The auth:tokens command lists the existing tokens added to the session.
Usage
csdx auth:tokens
Options
The csdx auth:whoami command returns the username (email address) of the user who is currently logged in to the session.
Usage
csdx auth:whoami
OR
csdx whoami
Additional Resources: Contentstack supports three regions: North America, Europe, and Azure North America. Refer to the configuration guide if you want to use a particular region, other than North America (NA).
Was this article helpful?
Thanks for your feedback