Login and contexts
Weik.io 2026.2Log in to your Weik.io installation with the weikio CLI and switch between installations with contexts. Video
Watch: Connecting the Weik.io CLI, 2:59
The video installs the weikio CLI and signs in to an installation through the browser, then switches between two contexts.
This part of the video couldn't be loaded.
On this page
weikio login logs you in to an installation and saves a context for it on your machine. A context has the installation’s address and an API key. It can also have a default project and environment. The CLI uses the current context unless you pass --context, --server, --project or --env.
| System | Configuration file |
|---|---|
| Linux and macOS | ~/., or under $XDG_ when that variable is set |
| Windows | %APPDATA%\weikio\config.yaml |
The CLI keeps the key in the system keyring when there is one. Otherwise it writes the key to a credentials file beside the configuration. Only you can read that file.
In a pipeline, set WEIKIO_SERVER and WEIKIO_API_KEY in place of weikio login, and WEIKIO_PROJECT and WEIKIO_ENV when the pipeline needs them.
Commands on this page#
| Command | What it does |
|---|---|
weikio login |
Log in to an installation and make it the current context. |
weikio logout |
Remove a context’s stored key and keep the context. |
weikio context list |
List the contexts and which one is current. |
weikio context use |
Make a context current. |
weikio context show |
Show a context and the ID of its API key. |
weikio context set |
Change a context’s address or its default project and environment. |
weikio context rename |
Rename a context. |
weikio context delete |
Delete a context and its stored key. |
weikio whoami |
Show which key a command runs with and what that key may do. |
weikio version |
Print the CLI’s and the installation’s versions. |
weikio completion |
Print the completion script for one shell. |
The tables below leave out the flags every command accepts, such as --env and --project, which the CLI reference lists.
weikio login#
Log in to an installation and make it the current context.
When you give no key, the command opens your browser at the installation’s approval page. Before you approve, check that the machine name and the address the request came from are yours, and that the key’s rights and expiry are what you need.
When you approve the request, the CLI gets an All my access key named after your machine. The key can do everything you can, including any project or role you’re given later. It expires in 90 days, or in 30 days for a platform administrator.
Approve the request within 10 minutes. When five requests from your address, or ten across the installation, are waiting for approval, a new login fails with HTTP 429 and a Retry-After of 10 minutes.
Give the key in WEIKIO_API_KEY or pipe it in on a machine without a browser. Otherwise, type it at the hidden API key: prompt.
A login to an http address on another machine first warns that the key will travel unencrypted, and shows the same weikio login command with the https address.
When the platform authority signed the hub’s certificate, give the authority’s SHA-256 fingerprint with --authority-fingerprint for a login without a terminal.
weikio login <server-url> [--name <ctx>] [--project P] [--env E] [--authority-fingerprint SHA256]| Argument or flag | What it does |
|---|---|
<server- |
Gives the base URL of the installation. |
--name <name> |
Sets the context’s name. The default is the installation’s host[:port]. |
-- |
Gives the SHA-256 fingerprint of the platform authority to trust, for a login without a terminal. |
Who can run it: any valid API key.
API: POST /api/v1/auth/cli-login/_start, GET /api/v1/auth/cli-login/{requestId}, POST /api/v1/auth/cli-login/{requestId}/approve, POST /api/v1/auth/cli-login/{requestId}/redeem, GET /api/v1/whoami, GET /api/v1/settings/install/authority.
$ weikio login https://hub.example --project sandbox --env devtestAPI key: ********
Context 'hub.example' saved and made current (server https://hub.example, project sandbox, environment devtest).$ weikio login https://hub.exampleAPI key: ********
Context 'hub.example' updated and made current (project sandbox and environment devtest kept).$ WEIKIO_API_KEY="$CI_KEY" weikio get environments --server https://hub.example -o json | jq -r '.items[].name'devtest
productionweikio logout#
Remove a context’s stored key and keep the context. To give it a key again, run weikio login with the same address.
weikio logout [<ctx>]| Argument or flag | What it does |
|---|---|
<context> |
Identifies the context, which is the current one by default. |
Who can run it: anyone, because the command runs on your machine.
weikio context list#
List the contexts and which one is current.
weikio context listWho can run it: anyone, because the command runs on your machine.
$ weikio context listNAME SERVER PROJECT ENVIRONMENT CURRENT
hub.example https://hub.example sandbox devtest *
ops https://hub.example - -weikio context use#
Make a context current.
weikio context use <name>| Argument or flag | What it does |
|---|---|
<name> |
Identifies the context to make current. |
Who can run it: anyone, because the command runs on your machine.
weikio context show#
Show a context and the ID of its API key.
weikio context show [<name>]| Argument or flag | What it does |
|---|---|
<name> |
Identifies the context, which is the current one by default. |
Who can run it: anyone, because the command runs on your machine.
weikio context set#
Change a context’s address or its default project and environment. A new address removes the context’s stored key.
weikio context set [<name>] [--server URL] [--project P] [--env E]| Argument or flag | What it does |
|---|---|
<name> |
Identifies the context, which is the current one by default. |
Who can run it: anyone. When the context has a key, the command also checks the environment on the installation.
API: GET /api/v1/environments/{name}.
$ weikio context set --env productionwarning: 'production' is a production environment: every write to it needs --env production.
Context 'hub.example' updated (environment production).weikio context rename#
Rename a context.
weikio context rename <old> <new>| Argument or flag | What it does |
|---|---|
<old> |
Identifies the context to rename. |
<new> |
Sets the new name. |
Who can run it: anyone, because the command runs on your machine.
weikio context delete#
Delete a context and its stored key.
weikio context delete <name>| Argument or flag | What it does |
|---|---|
<name> |
Identifies the context to delete. |
Who can run it: anyone, because the command runs on your machine.
weikio whoami#
Show the installation and the context a command uses, and the owner and grants of its key. Use it to check which key a pipeline runs with and what that key may do.
For an Only these key, the output ends with a weikio login command. Run it to get an All my access key. When your key has roles from an identity provider, the output also shows how long the key keeps them after your last sign-in there. See Check what you can do.
weikio whoamiWho can run it: any valid API key.
API: GET /api/v1/whoami.
$ weikio whoamiServer: https://hub.example (context local)
Key: 01m7mzdgte2nkywz5yd5cjcmd4
User: admin@local
Platform admin: yes
Grants: none
This key holds the grants listed and not roles added later. For a key that follows your roles, run:
weikio login https://hub.example --name localweikio version#
Print the CLI’s and the installation’s versions.
weikio versionWho can run it: anyone for the CLI’s version, and any API key for the installation’s.
API: GET /api/v1/version.
$ weikio versionweikio 2026.2.4 (linux/x64)
server: https://hub.example 2026.2.4weikio --version prints the same two lines. The server: line needs a context or --server.
weikio completion#
Print the completion script for one shell. Write the script to your shell’s completion folder, for example weikio completion bash > ~/.local/share/bash-completion/completions/weikio.
weikio completion bash|zsh|fish|powershell| Argument or flag | What it does |
|---|---|
<shell> |
Sets the shell, one of bash, zsh, fish or powershell. |
Who can run it: anyone, because the command runs on your machine.
Exit codes#
The codes match the exit code table in the CLI reference.
| Code | Meaning |
|---|---|
| 0 | The command succeeded. |
| 1 | The command stopped without making the change. |
| 2 | The command has a usage error. |
| 3 | Your key is missing, expired or revoked, or its access doesn’t cover the command. |
| 4 | What you named doesn’t exist. |
| 5 | The change conflicts with another change. |
| 6 | Weik.io couldn’t be reached or wasn’t ready, or it was rate limiting your calls or out of storage. Run the command again later. |
| 8 | A document isn’t valid. |