> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://contentful.com/developers/docs/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/_mcp/server. # Authentication with the Contentful CLI > This guide will help you to authenticate with the Contentful CLI | Requirements | Login | Logout and Next steps For every request, clients [need to provide an API key](/references/content-management-api/overview), which is created per space and used to delimit applications and content classes. This helps you authenticate with the `contentful-cli`. ## Requirements * A (free) [Contentful account](https://www.contentful.com/sign-up/) * Locally [installed](/tutorials/cli/installation) `contentful-cli` ## Login ```bash contentful login ``` ![Contentful-login gif](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/contentful.docs.buildwithfern.com/67e52735dd130f3381805aaa404604ca41ef5f5c24070e7b25d395d8c26285cc/docs/assets/images/contentful-login.gif?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260930%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260930T003608Z&X-Amz-Expires=604800&X-Amz-Signature=4ca4ade5b2ca53e54a45cfe58c4c84bd6aaca74410321d4ecb5c5b2330cbbd8a&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject) If you have no browser available on your machine you can generate the management token manually and pass it directly to the login command. [Login](https://be.contentful.com/login) and create a management token at `Settings > API keys > Content management tokens > Generate personal token`. ```bash contentful login --management-token ``` *The output should look similar to this:* ```bash Great! Your CMA token is now stored on your system. (Located at ~/.contentfulrc.json) You can always run contentful logout to remove it. ``` ## Logout To log out and remove your current management token from `.contentfulrc.json` ```bash contentful logout ``` *The output should look similar to this:* ```bash Successfully logged you out. ``` ## Next steps * [Configure the Contentful CLI](/tutorials/cli/config-management) * [Manage spaces with the Contentful CLI](/tutorials/cli/space-management) * [Manage environments with the Contentful CLI](/tutorials/cli/environment-management/) * [Manage extensions with the Contentful CLI](/tutorials/cli/extension-management) * [Check out the documentation in the GitHub repository](https://github.com/contentful/contentful-cli/blob/master/docs/) > This guide will help you to authenticate with the Contentful CLI | Requirements | Login | Logout and Next steps