A powerful command-line interface for managing Tyk APIs and configurations. Built to streamline API lifecycle management with OpenAPI Specification (OAS) support.
π View Complete Documentation | π Get Started | π‘ Examples
- π Interactive Setup Wizard - Get started quickly with guided configuration
- π Unified Config/Environment System - Named environments with seamless switching
- π OpenAPI First - Native support for OAS 3.0 specifications
- π§ Flexible Configuration - Environment variables, unified config file, or CLI flags
- π¨ Beautiful CLI - Colorful, intuitive command-line experience
- β Comprehensive Testing - >80% test coverage with live environment validation
- This CLI is designed to work with the licensed version of Tyk - via Control Plane.
# Add the Tyk tap
brew tap sedkis/tyk
# Install the CLI
brew install tyk
## Check version
$ tyk -v
tyk version 0.2.1
## UPGRADING the cli
$ brew update
$ brew upgrade tyk
## Check version
$ tyk -v
tyk version 0.2.1
# Download and install the latest release
curl -L "https://github.com/sedkis/tyk-cli/releases/latest/download/tyk-cli_$(uname -s)_$(uname -m).tar.gz" | tar xz
sudo mv tyk /usr/local/bin/
# Verify installation
tyk --version
git clone https://github.com/sedkis/tyk-cli.git
cd tyk-cli
go build -o tyk .
sudo mv tyk /usr/local/bin/
# Run the interactive setup wizard
tyk init
π‘ Need more help? Check out our complete documentation with detailed guides, examples, and troubleshooting tips!
# Interactive setup wizard
tyk init # Full setup wizard with multiple environments
# Environment management
tyk config list # List all environments
tyk config use # Switch environnment interactively
tyk config use staging # Switch to staging environment
tyk config current # Show current environment
tyk config set dashboard-url https://api.tyk.io # Update current environment
# Quick API Creation
tyk api create --name "User Service" --upstream-url https://users.api.com
# Create from OpenAPI Spec Management
tyk api import-oas --file petstore.yaml # Import external OpenAPI spec
tyk api import-oas --url https://api.example.com/openapi.json # Import from URL
tyk api update-oas <api-id> --file new-spec.yaml # Update API's OpenAPI spec only
# Tyk-Enhanced OAS Management (GitOps)
# If the file contains x-tyk-api-gateway.info.id, apply will upsert:
# update if it exists, or create with the same ID if missing
tyk api apply --file enhanced-api.yaml # Idempotent upsert (update or create)
# General Operations
tyk api list # List all APIs
tyk api list -i # Interactive
tyk api get <api-id> # Get API details
tyk api get <api-id> --oas-only # Get OpenAPI spec only
tyk api delete <api-id> # Delete API (with confirmation)
tyk api delete <api-id> --yes # Delete without confirmation
# Utilities (Phase 3)
tyk api convert --file api.yaml --format apidef # Convert OAS to Tyk format
The Tyk CLI uses a unified environment/configuration system with the following precedence (highest to lowest):
- Command-line flags (
--dash-url
,--auth-token
,--org-id
) - Environment variables (
TYK_DASH_URL
,TYK_AUTH_TOKEN
,TYK_ORG_ID
) - Named environments in config file (
~/.config/tyk/cli.toml
)
Each "environment" is simply a named set of configuration values.
export TYK_DASH_URL=http://localhost:3000
export TYK_AUTH_TOKEN=your-api-token
export TYK_ORG_ID=your-org-id
Configuration is automatically saved to ~/.config/tyk/cli.toml
:
default_environment = "dev"
[environments.dev]
dashboard_url = "http://localhost:3000"
auth_token = "dev-api-token"
org_id = "dev-org-id"
[environments.staging]
dashboard_url = "https://staging.tyk.io"
auth_token = "staging-token"
org_id = "staging-org-id"
[environments.production]
dashboard_url = "https://api.yourcompany.com"
auth_token = "prod-token"
org_id = "prod-org-id"
- Local Development:
http://localhost:3000
(default) - Tyk Cloud:
https://admin.cloud.tyk.io
- Self-hosted: Your custom domain
- Log into your Tyk Dashboard
- Go to Users β Your User Profile
- Find API Access Credentials
- Copy the Auth Token
- Found next to your API Token, in User Profile.
- Go 1.21+
- Make (optional)
# Clone the repository
git clone https://github.com/sedkis/tyk-cli.git
cd tyk-cli
# Install dependencies
go mod download
# Build the CLI
go build -o tyk .
# Run tests
go test ./...
# Build with make (if available)
make build
make test
tyk-cli/
βββ cmd/ # CLI commands and subcommands
βββ internal/ # Internal packages
β βββ config/ # Configuration management
β βββ client/ # HTTP client for Tyk Dashboard API
β βββ util/ # Utilities and helpers
βββ pkg/ # Public packages (if any)
βββ test/ # Integration tests
βββ docs/ # Documentation
- Tyk Security Policies
- Tyk API Tokens / Credentials
tyk api convert
- Convert between OAS and Tyk API definition formats- Enhanced error handling and user experience improvements
- Advanced JSON output formatting
- API versioning commands (
versions list/create/switch-default
) - API validation and linting
- GitOps diff functionality
We welcome contributions! Please see our Contributing Guide for details.
# Run tests
go test ./...
# Run tests with coverage
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
# Lint code (if golangci-lint is installed)
golangci-lint run
# Format code
go fmt ./...
This project is licensed under the MIT License.
- π Documentation: Complete Documentation
- π Getting Started: Installation & Setup Guide
- π Issues: GitHub Issues
- π¬ Community: Tyk Community Forum
Built with: