Repository navigation
Document authenticating a laptop script with API key environment variables or viam.json - #5479
Jeremy Rose (jeremyrose-viam) wants to merge 5 commits into
Conversation
…ables or viam.json
✅ Deploy Preview for viam-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Docs review: Needs changesRe-review at CI: All required checks passing. Docs health: No regressions. Should fix
Nits
Needs owner sign-off
Verified against source (8 claims)
Automated review by Claude. Rerunning the review updates this comment. |
|
Thanks for the careful read. Pushed Blocking: I ran it against a real machine instead of reasoning from source. A machine running in a cloud simulation, connected through its cloud address, with the credentials file copied from Machine cloud credentials in the app:
So the original example would have worked for cloud-dialed connections, but your points about the example still land, and I changed it:
I kept the subsection, because the copied credentials file is what people get from the app, and the page now says how to read it. Nits
Local checks pass: prettier, markdownlint, vale, frontmatter, and |
|
Hey Jeremy Rose (@jeremyrose-viam) — this PR has been approved and CI has been green for 3+ business days. Ready to merge? Auto-comment from overwatch. Will not re-nudge for 7 days. |

Adds a "Script on your laptop" section to Manage API keys, under "Use an API key".
It covers:
VIAM_API_KEYandVIAM_API_KEY_ID, with a Python example that reads them and callsRobotClient.Options.with_api_key.viam.jsonalternative: how to copy the file from the app, and a Python example that reads theapi_keyblock undercloudand authenticates with it. A short note covers files that have only a partsecret, which the Python SDK can use asrobot-secretcredentials when connecting through the machine's cloud address. The default/etc/viam.jsonlocation is noted for computers whereviam-agentis installed.Verified against the Python SDK (viam-sdk 0.85.1, installed in a scratch venv):
VIAM_API_KEYandVIAM_API_KEY_IDitself only inViamClient.create_from_env_vars().RobotClientdoes not, so the script reads the variables.robot-secretis a supportedCredentialstype forRobotClientdial options (and is rejected forViamClient).Verified against a real machine: a machine running in a cloud simulation, connected through its cloud address, with the credentials file copied from the app's Machine cloud credentials:
api_keyblock in the file authenticates.secretasrobot-secretcredentials authenticate.robot-secretcall with a wrong secret is refused (permission denied), so the successful connections were real authentication.secret, and anapi_keyblock with a key ID and key.Checks run locally: prettier 3.2.5, markdownlint, vale,
scripts/frontmatter_rules.py, andmake build-prod, all passing.Not verified: connecting to a machine's local address with
robot-secretcredentials, other cloud environments, and the Go and TypeScript SDKs' handling ofviam.jsonor environment variables. The examples are Python only.🤖 Generated with Claude Code