Skip to content

ptkl profile

Manage authentication profiles. A profile stores the credentials and connection details needed to interact with a Protokol project — every other ptkl command depends on an active profile.


Overview

Profiles are stored in ~/.ptkl/profiles.json. Each profile contains the API host, project identifier, username, and an authentication token. You can create multiple profiles (e.g. one per project or environment) and switch between them with ptkl profile use.


Subcommands

Subcommand Description
(none) Print the name of the currently active profile
new Create a new profile
auth Re-authenticate the current profile
list List all profiles
use <name> Set a profile as active
inspect <name> Print profile details
delete <name> Delete a profile

ptkl profile (no subcommand)

Prints the name of the currently active profile.

ptkl profile
my-project

ptkl profile new

Create a new profile and authenticate against the Protokol API.

ptkl profile new [options]

Options

Option Description
-n, --name <name> Profile name (used to reference the profile in other commands)
-u, --username <username> API-user username (with --legacy)
-p, --password [secret] API-user secret (with --legacy) — if provided without a value, prompts securely
-P, --project <project> Project identifier
-h, --host <host> API host URL (e.g. https://api.protokol.io)
--legacy Use API-user credentials instead of the browser login (implied by -u, -p, -t)
--no-browser Print the sign-in URL instead of opening a browser

Example

ptkl profile new \
  --name staging \
  --project my-project \
  --host https://api.staging.protokol.io

By default the toolkit signs you in with the OAuth browser flow. For an API user, add --legacy:

ptkl profile new --legacy \
  --name ci \
  --username my-api-user \
  --password \
  --project my-project \
  --host https://api.staging.protokol.io

When --password is specified without a value, the toolkit prompts for the secret with hidden input — it is never visible in your terminal history.


ptkl profile auth

Re-authenticate the current active profile. Use this when a token has expired or when you need to switch projects or update credentials.

ptkl profile auth [options]

Options

Option Description
-u, --username <username> API-user username (with --legacy)
-p, --password [secret] API-user secret (with --legacy) — if provided without a value, prompts securely
-t, --token <token> Authenticate using a token (implies --legacy)
-P, --project <project> Change project identifier
--legacy Use API-user credentials instead of the browser login
--no-browser Print the sign-in URL instead of opening a browser

Example

# re-authenticate through the browser
ptkl profile auth

# switch to a different project
ptkl profile auth --project other-project

# re-authenticate an API-user profile
ptkl profile auth --legacy --password

ptkl profile list

List all configured profiles. The active profile is marked with *.

ptkl profile list
  production
* staging
  local-dev

ptkl profile use

Set a profile as the active profile.

ptkl profile use production

All subsequent commands will use the production profile unless --profile is specified.


ptkl profile inspect

Print the details of a profile (host, project, username, token expiry).

ptkl profile inspect staging

ptkl profile delete

Delete a profile from ~/.ptkl/profiles.json.

ptkl profile delete old-project

Warning

Deleting a profile is irreversible. If the deleted profile was active, you must run ptkl profile use to select a new active profile.


Without a profile: the SDK's env variables

When PROJECT_API_TOKEN is set and no --profile is chosen, ptkl does not read ~/.ptkl/profiles.json. It signs in from the environment, with the same names @ptkl/sdk reads:

Variable Meaning
PROJECT_API_TOKEN The token to call the API with
API_HOST The API host. Required when PROJECT_API_TOKEN is set
PROJECT_UUID The project
PROJECT_ENV dev or live: the default env for commands. --env wins
export API_HOST=https://api.protokol.io
export PROJECT_UUID=<project-id>
export PROJECT_API_TOKEN=<token>   # from your CI secret store
ptkl forge list --env live

This is useful in CI, and it is automatic inside a Kiln machine, where all four are already set. Pass --profile <name> to use a stored profile instead. Keep the token in a secret; never write it in a script or commit it.


See Also