MicroticaMicrotica

Authenticate the CLI

Create a Microtica API key in the console, log in to the CLI, see where credentials are stored, and configure the CLI with environment variables.

Before any command can reach the Microtica API, the CLI needs an API key. You create one in the Microtica console, store it once with microtica login, and every later command reuses it.

Create an API key

API keys are long-lived credentials for the CLI, SDK, and external automation. A key belongs to the project, not the person who created it — so it keeps working when team members leave, and you can scope it to specific environments and revoke it at any time.

  1. Open your project and go to Settings → API keys.
  2. Click Create API key.
Microtica project settings showing the API keys tab, existing keys with their scopes, and the Create API key button
Project Settings → API keys
  1. Give the key a Name like claude code or ci pipeline. It appears in the key list and in audit logs.
  2. Choose when it Expires — never, in 7, 30, or 90 days, in a year, or on a custom date.
  3. Set the Baseline access that applies across every entity in the project (environments, pipelines, apps): None, read, write, admin, or owner. Pick read to let the key use discovery and list endpoints; pick None for a strict per-environment key.
  4. Optionally add Per-environment upgrades to grant a stronger role on specific environments. Each upgrade must be strictly stronger than the baseline.
  5. Click Create key, then copy the mic_… value — this is the only time it's shown in full.
Create API key dialog with fields for name, expiry, baseline access, and per-environment permission scopes
Create API key dialog

Back in the list, each key shows its prefix, status, and scopes, and lets you add scopes or revoke it.

Scope keys tightly. Give a key only the access it needs — for example a read baseline with a write upgrade on one environment. Revoke any key from the list the moment it's no longer needed.

Log in

Store your API key with microtica login:

Terminal
microtica login --token mic_…

You can also pipe the key on stdin, which keeps it out of your shell history:

Terminal
echo "$MIC_API_KEY" | microtica login

On success the CLI prints where it saved the key. A token that isn't a valid Microtica API key is rejected before anything is written.

Where credentials live

microtica login writes your key to ~/.microtica/credentials with owner-only permissions (0600). Delete that file to log out.

Configure with environment variables

Environment variables override the stored file, which makes them the right fit for CI and ephemeral shells:

VariablePurpose
MICROTICA_TOKENAPI key to use. Takes precedence over ~/.microtica/credentials.
MICROTICA_PROJECT_IDDefault project id for commands that need one.

With MICROTICA_TOKEN set, you can skip microtica login entirely:

Terminal
export MICROTICA_TOKEN=mic_…
export MICROTICA_PROJECT_ID=<project-id>
microtica whoami

Set a default project

Most commands need a project id. Pass --project <id> on any command, or set MICROTICA_PROJECT_ID once so you don't repeat it. The --project flag wins when both are present.

Terminal
# Per command
microtica env list --project <project-id>

# Or set it once for the session
export MICROTICA_PROJECT_ID=<project-id>
microtica env list

Run microtica project list to find the ids of the projects your key can access.

Verify your session

microtica whoami shows the identity behind your stored key and probes the API, so you can confirm both the key and that it still works:

Terminal
microtica whoami
Output
via:                apikey
api key prefix:     mic_d60bea1d
api reachable:      true
projects visible:   12

Next steps

On this page