Skip to main content

Authentication

The CLI authenticates with an API key. There is no separate username or password. Generate a key in the Skrybe web app under Settings. The API docs describe keys in more detail.

One API key belongs to exactly one brand, so everything you do with a key happens in that brand. To work with several brands, save a profile per brand.

Log in​

skrybe auth login
# API key: (paste it here)

The CLI talks to https://dashboard.skry.be unless told otherwise. To use a different Skrybe install, pass its address with --url (including https://) or set SKRYBE_API_URL; auth login saves whichever URL it used in the profile.

The key is read from stdin, never from a flag. Command line arguments are visible to other users in ps and end up in your shell history. At a terminal you are prompted for it. In a script, pipe it in:

printf '%s' "$SKRYBE_KEY" | skrybe auth login

If SKRYBE_API_KEY is set, auth login saves that value instead of reading stdin.

Before saving, auth login checks the key by fetching the brand it belongs to and prints:

✓ Authenticated against https://dashboard.skry.be as brand Acme.
✓ Saved profile default to /home/ada/.skrybe/config.json

Pass --no-verify to save without checking (for example, when the install is not reachable yet).

FlagDescription
--url <url>Base URL of the install (global flag, required here)
--profile <name>Profile to save as. Default: default
--no-verifySave without checking the key against the API

Logging in makes the saved profile the current one.

Check who you are​

skrybe whoami
# or: skrybe auth whoami
Profile  default
URL https://dashboard.skry.be

BRAND ID NAME
86 Acme

--output json prints {"profile": ..., "url": ..., "brands": [...]}. With --output text it prints one tab-separated line per brand: profile, URL, brand ID, brand name. When the credentials come from environment variables and match no saved profile, the profile shows as (from environment) (or null in JSON).

Profiles​

A profile is a saved URL and API key under a name. A profile per brand is the natural setup:

skrybe auth login --profile acme
skrybe auth login --profile globex

skrybe --profile acme lists
skrybe --profile globex campaigns

List profiles​

skrybe auth list      # or: skrybe auth ls
   PROFILE  URL
* acme https://dashboard.skry.be
globex https://dashboard.skry.be

The * marks the current profile.

Switch the current profile​

There is no separate "use" command. Logging in to a profile makes it current, and --profile or SKRYBE_PROFILE picks one for a single command or shell session:

export SKRYBE_PROFILE=globex
skrybe lists

Log out​

skrybe auth logout                  # removes the current profile
skrybe --profile globex auth logout # removes a named profile

This deletes the profile from the config file. It does not revoke the key; do that in the Skrybe web app. If you remove the current profile, the first remaining profile becomes current.

Where credentials are stored​

Profiles are saved in a JSON file, created with mode 0600 in a directory with mode 0700:

ConditionLocation
SKRYBE_CONFIG is setthat path
XDG_CONFIG_HOME is set$XDG_CONFIG_HOME/skrybe/config.json
otherwise~/.skrybe/config.json
{
"currentProfile": "acme",
"profiles": {
"acme": { "url": "https://dashboard.skry.be", "apiKey": "..." },
"globex": { "url": "https://dashboard.skry.be", "apiKey": "..." }
}
}

If the file cannot be parsed, every command fails with a usage error (exit code 2) naming the file. Fix or delete it, then log in again.

Environment variables​

Environment variables need no config file, which suits CI:

export SKRYBE_API_KEY=...
skrybe lists
VariableDescription
SKRYBE_API_KEYAPI key. Overrides the key of any profile
SKRYBE_API_URLInstall URL. Overrides the URL of any profile
SKRYBE_PROFILEProfile to use when --profile is not given
SKRYBE_CONFIGPath of the config file
XDG_CONFIG_HOMEPuts the config file at $XDG_CONFIG_HOME/skrybe/config.json

Resolution order​

For each command the key and URL are resolved in this order, highest first:

  1. SKRYBE_API_KEY / SKRYBE_API_URL
  2. --profile <name>
  3. SKRYBE_PROFILE
  4. the current profile in the config file

The global --url flag overrides the URL from any of these for one command. If nothing sets a URL, https://dashboard.skry.be is used.

If no key is found, the command fails with No API key configured. If a profile was asked for by name and does not exist, it fails with No profile named "..." and lists the known profiles. Both exit with code 2.

Main account keys​

Most commands need a brand key: one generated while logged in as a brand. The install's main account key is not tied to a brand, so brand-scoped commands answer it with brand_not_found. The one exception is brands transport, which needs the main account key. Keep it in its own profile:

skrybe auth login --profile admin
skrybe --profile admin brands transport 86

Authentication errors​

An invalid or missing key exits with code 3:

Error [invalid_api_key]: Invalid API key
Generate a key in the Skrybe UI under Settings, then run `skrybe auth login`.
Note that keys are cleared for every login of a brand placed under review.