Dev

Authentication

Authenticate the CloudCart CLI with Personal Access Tokens, environment variables, or interactive login.

The CLI talks to the GraphQL Admin API, so it authenticates the same way: with a Personal Access Token (PAT) or a short-lived JWT.

Get a token

Create a PAT in your store admin under Settings → PAT Tokens — see the illustrated walkthrough. Tokens look like this:

cc_pat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Pick the access level that matches what you'll do:

Access levelUse it for
Read Only (recommended to start)Reporting, monitoring, letting an AI assistant explore your data safely
Full AccessCI/CD pipelines, automation that creates or updates data
Custom PermissionsLimited-scope integrations (e.g. products only)

Option A — environment variables

Best for CI pipelines and AI agents: no prompts, no state.

export CLOUDCART_CLI_TOKEN=cc_pat_your_token
export CLOUDCART_CLI_STORE=mystore.cloudcart.com

cloudcart app execute --query '{ generalSettings { siteName } }' --json

Option B — interactive login

Best for your own machine. The token is stored in the OS keychain (macOS Keychain / libsecret), never in a plaintext file.

cloudcart auth login
# or non-interactive:
cloudcart auth login --store mystore.cloudcart.com --token cc_pat_your_token

Check what you're logged into:

cloudcart auth status
# Show a specific store:
cloudcart auth status --store mystore.cloudcart.com

Log out (removes stored credentials for the store):

cloudcart auth logout --store mystore.cloudcart.com

Multiple stores

You can be logged into several stores at once. Every app command accepts --store to pick the target:

cloudcart app execute --query '{ generalSettings { siteName } }' --store store-a.cloudcart.com
cloudcart app execute --query '{ generalSettings { siteName } }' --store store-b.cloudcart.com

Keep tokens out of your shell history

Prefer cloudcart auth login (interactive) or environment variables loaded from a secret manager. If a token leaks, revoke it immediately from Settings → PAT Tokens — deactivating the token kills access instantly.

JWT authentication

If you can't use PATs, exchange admin credentials for a short-lived JWT via the Admin API login mutation and pass it the same way (CLOUDCART_CLI_TOKEN). PATs are recommended for anything long-running.

On this page