A fast, fully-typed TypeScript CLI for managing Toggl Track via the REST API.
- Complete API Coverage — Time entries, projects, clients, tags, tasks, workspaces, organizations, and groups
- Multiple Output Formats — JSON (default), table, and CSV for easy scripting and data export
- Timer Control — Start, stop, and manage time entries directly from your terminal
- Flexible Authentication — Environment variables,
.envfiles, or command-line options - Type-Safe — Built with TypeScript strict mode and Zod schema validation
- Rate Limit Handling — Automatic retry with exponential backoff
npm install -g toggl-cligit clone https://github.com/FroeMic/toggl-cli.git
cd toggl-cli
npm install
npm run build
npm link-
Get your API token from Toggl Profile Settings
-
Configure authentication (choose one):
# Option A: Environment variable export TOGGL_API_TOKEN=your_api_token_here # Option B: Create a .env file echo "TOGGL_API_TOKEN=your_api_token_here" > .env
-
Verify setup:
toggl me get
-
Start tracking:
toggl te start --description "Working on feature"
All commands support these options:
| Option | Description |
|---|---|
--api-token <token> |
Override TOGGL_API_TOKEN environment variable |
--workspace <id> |
Override TOGGL_WORKSPACE_ID environment variable |
--format <format> |
Output format: json (default), table, or csv |
--verbose |
Show detailed error messages |
--help |
Display help for command |
--version |
Display version |
Manage time tracking with the time-entry command (alias: te).
# Start a timer
toggl te start --description "Working on feature" --project 12345
# See what's running
toggl te current
# Stop the timer
toggl te stop
# List recent entries (last 7 days)
toggl te list
toggl te list --format table
# List entries in date range
toggl te list --start-date 2024-01-01 --end-date 2024-01-31
# List entries from start date to now (end-date auto-defaults)
toggl te list --start-date 2024-01-01
# Create a completed entry
toggl te create --start "2024-01-15T09:00:00Z" --duration 3600 --description "Meeting"
# Update an entry
toggl te update <id> --description "Updated description"
# Delete an entry
toggl te delete <id>Manage projects with the project command (alias: proj).
# List all projects
toggl proj list
toggl proj list --active true --format table
# Get project details
toggl proj get <id>
# Create a project
toggl proj create --name "New Project" --color "#FF5733"
# Update a project
toggl proj update <id> --name "Renamed Project"
# Delete a project
toggl proj delete <id>Manage clients with the client command.
# List clients
toggl client list
toggl client list --status archived
# Create a client
toggl client create --name "Acme Corp" --notes "Important client"
# Archive/restore a client
toggl client archive <id>
toggl client restore <id>
# Delete a client
toggl client delete <id>Manage tags with the tag command.
# List tags
toggl tag list
# Create a tag
toggl tag create --name "urgent"
# Update a tag
toggl tag update <id> --name "high-priority"
# Delete a tag
toggl tag delete <id>Manage project tasks with the task command.
# List tasks for a project
toggl task list --project <project_id>
# Create a task
toggl task create --name "Implement feature" --project <project_id>
# Update a task
toggl task update <id> --project <project_id> --name "Updated task"
# Delete a task
toggl task delete <id> --project <project_id>Manage workspaces with the workspace command (alias: ws).
# List workspaces
toggl ws list
# Get workspace details
toggl ws get <id>
# List workspace users
toggl ws users list --workspace <id>Manage organizations with the organization command (alias: org).
# Get organization details
toggl org get <id>
# List organization users
toggl org users list --organization <id>Manage groups with the group command.
# List groups
toggl group list --organization <id>
# Create a group
toggl group create --organization <id> --name "Development Team"
# Update a group
toggl group update <id> --organization <org_id> --name "Engineering Team"
# Delete a group
toggl group delete <id> --organization <org_id>Access your profile with the me command.
# Get your profile
toggl me get
toggl me get --with-related-data
# Get preferences
toggl me preferences
# Get API quota info
toggl me quota| Variable | Description |
|---|---|
TOGGL_API_TOKEN |
Your Toggl API token (required) |
TOGGL_WORKSPACE_ID |
Default workspace ID (optional) |
DEBUG_API_ERRORS |
Set to true for detailed error messages |
Create a .env file in your project directory:
TOGGL_API_TOKEN=your_api_token_here
TOGGL_WORKSPACE_ID=your_workspace_id
DEBUG_API_ERRORS=falseOptions are resolved in this order (highest to lowest priority):
- Command-line flags (
--api-token,--workspace) - Environment variables
.envfile values
toggl te list --format jsonReturns structured JSON, ideal for piping to jq or other tools.
toggl te list --format tableHuman-readable table format for terminal viewing.
toggl te list --format csv > time-entries.csvCSV output for spreadsheets and data analysis.
git clone https://github.com/FroeMic/toggl-cli.git
cd toggl-cli
npm installnpm run buildnpm run dev -- te list
npm run dev -- --helpnpm run lint
npm run lint:fixnpm testRuns 74 unit tests covering API client, schemas, formatters, and utilities.
# Requires TOGGL_API_TOKEN in environment or .env file
npm run test:integrationRuns 11 integration tests against the live Toggl API, covering:
- User profile retrieval
- Project CRUD operations
- Time entry workflows (create, start, stop, delete)
npm test && npm run test:integrationThis CLI interacts with the Toggl Track API v9.
| Limit Type | Value |
|---|---|
| Quota | 30-600 requests/hour (subscription dependent) |
| Rate | ~1 request/second (leaky bucket) |
The CLI automatically handles rate limiting with retry logic and exponential backoff.
The Toggl API uses HTTP Basic Authentication with your API token:
Authorization: Basic base64(api_token:api_token)
toggl-cli/
├── src/
│ ├── cli.ts # Entry point
│ ├── api/
│ │ ├── client.ts # HTTP client
│ │ ├── errors.ts # Error classes
│ │ ├── schemas.ts # Zod validation
│ │ ├── types.ts # TypeScript types
│ │ └── endpoints/ # API endpoints
│ ├── commands/ # CLI commands
│ ├── formatters/ # Output formatters
│ └── utils/ # Utilities
├── tests/
│ ├── unit/ # Unit tests
│ └── integration/ # Integration tests
└── docs/ # Documentation
MIT License - see LICENSE.md for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request