DeviceCloud supports two ways to authenticate the CLI: browser login (best for local, interactive use) and an API key (best for CI and headless environments). The REST API uses the API key.
Run dcd login once and authenticate in your browser. The CLI stores the resulting session locally, so you don't need to pass a key on every command — and it unlocks live test updates and a smoother experience.
dcd loginThis opens your browser, where you sign in (email OTP or Enterprise SSO) and authorise the CLI. If you belong to more than one organisation, you'll be prompted to pick one. The session is stored at:
$XDG_CONFIG_HOME/dcd/config.json, or~/.dcd/config.jsonifXDG_CONFIG_HOMEis not set
The file is written with 0600 permissions (owner read/write only). Expiring sessions are refreshed automatically — you generally only log in again if you log out or switch machines.
{% hint style="info" %}
No browser on the box (e.g. over SSH)? Run dcd login --no-browser and the CLI prints a URL to open elsewhere.
{% endhint %}
See Login & Accounts for logout, whoami, and switch-org.
In CI and other non-interactive environments, use an API key.
- Log in to the console
- Open Settings → API Key
- Copy the key
Set it as an environment variable so you don't have to pass it on every command:
export DEVICE_CLOUD_API_KEY=your-api-key-here
dcd cloud <appFile> <flowFile>Or pass it explicitly with --api-key on any command:
dcd cloud --api-key your-api-key-here <appFile> <flowFile>{% hint style="info" %} Store your API key as a secret in your CI provider (e.g. a GitHub Actions secret) — never commit it to your repository. {% endhint %}
When more than one credential is available, the CLI resolves authentication in this order:
--api-keyflagDEVICE_CLOUD_API_KEYenvironment variable- Stored session from
dcd login
The REST API authenticates with the API key, passed in the x-app-api-key header:
curl https://api.devicecloud.dev/... \
-H "x-app-api-key: your-api-key-here"