Separate Dosya CLI profiles
Isolate Dosya CLI credentials with separate XDG config roots or environment keys, then verify each account and target workspace before every job.
Last reviewed
The CLI has no named-profile store and no --profile flag. Isolate identities with different XDG_CONFIG_HOME directories, or inject different DOSYA_API_KEY values for each process.

Before you start
- The normal XDG file is
$XDG_CONFIG_HOME/dosya/config.json; without XDG configuration, the fallback is~/.dosya/config.json. - Key precedence is command-line
--key, thenDOSYA_API_KEY, then config. Base URL environment configuration precedes the saved value and built-in default. - The CLI creates its config directory with mode 0700 and file with 0600; loose existing modes produce a warning.
Steps
- Create one private config root per identity, for example
~/.config/dosya-workand~/.config/dosya-personal, and restrict each parent to the account owner. - Set
XDG_CONFIG_HOMEfor the desired identity, then save its key through stdin rather than a literal argument. Never invent--profile; argument parsing does not support it. - Run
XDG_CONFIG_HOME=… dosya whoami --jsonand assert the expected account identifier before any mutation. - Pass the intended workspace explicitly to commands that accept it, or verify the current workspace returned by the relevant read command. Config isolation does not choose a workspace for you.
- For ephemeral jobs, prefer
DOSYA_API_KEYfrom the scheduler’s secret store and an isolated empty XDG root. Remember that--keyoverrides both. - Log the nonsecret profile label, config root, verified account ID, and workspace ID. Refuse to run if any value differs from the job definition.

Expected result
Each process resolves one intended key from a private config root or environment, verifies its account, and acts only in the explicitly checked workspace. No unsupported profile flag is required.
Troubleshooting
The wrong account appears. Check for a higher-precedence --key or DOSYA_API_KEY before editing the config file.
The CLI warns about permissions. Restore 0700 on the directory and 0600 on config.json, then verify ownership.
Two jobs still interfere. Give them different XDG_CONFIG_HOME values and avoid exporting one shared key in the parent shell.
Related guides
Was this helpful?
Loading helpfulness results…
Voting saves a necessary ballot cookie for up to 180 days so you can change your answer.
Questions and replies
Ask about the steps in this guide. Questions are reviewed before publication.
Keep account details, credentials and private files out of public questions. Use private support for those.
Loading questions…
Sign in to your Dosya account to ask a question.