Create an sPAT by selecting its system account by name:
kongctl create spat \
--system-account-name ci-bot \
--name deployment \
--expires-in 30d \
--output env
You can use --system-account-id instead of --system-account-name. sPATs
have the same expiration limits and one-time secret output behavior as PATs.
List, retrieve, or delete sPAT metadata within a system account:
kongctl get spat --system-account-name ci-bot
kongctl get spat deployment --system-account-name ci-bot
kongctl delete spat deployment \
--system-account-name ci-bot \
--auto-approve
You can pass the token with each command using the --pat flag:
kongctl get apis --pat "YOUR PAT HERE"
Store the token in an environment variable to avoid passing it with every command. For the default profile,
set the KONGCTL_DEFAULT_KONNECT_PAT environment variable:
See the environment variable configuration reference
for full details on environment variables and the kongctl configuration system.
export KONGCTL_DEFAULT_KONNECT_PAT="YOUR PAT HERE"
Then run commands normally:
You can also store the token in the kongctl configuration file under the desired profile:
default:
konnect:
pat: "YOUR PAT HERE"
See the configuration file reference
for full details on the kongctl configuration file.
Then run commands normally:
Warning: When storing tokens in configuration files, ensure the file is
protected and not committed to version control.
Use this method only for local development or secure environments.
Store the token as a secret in your CI/CD platform.
For example, to store it as a secret in GitHub Actions:
- name: Deploy to Konnect
env:
KONGCTL_DEFAULT_KONNECT_PAT: $
run: kongctl apply -f config/
Security: Never commit tokens to version control. Always use secrets management.