Commands Reference
Complete guide to all wfapi commands and their options.
Command Overview
| Command | Description |
|---|---|
wfapi sites | List Webflow sites |
wfapi config | Manage API token configuration |
wfapi env | Manage environments |
wfapi use | Manage site and collection context |
wfapi cms | List CMS collections |
wfapi items | List CMS items |
wfapi login | OAuth authentication (future) |
wfapi --help | Show help for all commands |
Global Options
All commands support:
wfapi <command> --help # Show help for specific commandwfapi sites
List all Webflow sites accessible with your API token.
Basic Usage
wfapi sitesWith Filter
Filter sites by display name or short name:
wfapi sites "portfolio"
wfapi sites "my-site"The filter performs a case-insensitive partial match.
Options
| Option | Description |
|---|---|
--recent | Show only sites modified in the past week, newest first |
--raw | Output raw JSON instead of formatted table |
Examples
# All sites
wfapi sites
# Sites containing "client" in name
wfapi sites client
# Recent sites only
wfapi sites --recent
# Recent sites with filter, raw JSON output
wfapi sites "project" --recent --rawOutput
Displays:
- Display name
- Short name
- Site ID
- Primary custom domain (if configured)
wfapi config
Manage your Webflow API token configuration.
Subcommands
Set Token
wfapi config set <token>Saves the token to your global ~/.wfapi file.
Example:
wfapi config set wfp_abc123xyz789Get Token
wfapi config get
# or
wfapi config showDisplays the currently active token (global, local, or environment variable).
Delete Token
wfapi config deleteRemoves the global ~/.wfapi config file.
This only deletes the global config. Local .wfapi files and environment variables are not affected.
Examples
# Set a new token
wfapi config set wfp_your_token_here
# Check which token is active
wfapi config show
# Remove global token
wfapi config deletewfapi env
Manage multiple environments (dev, staging, prod, etc.).
Basic Usage
View current environment:
wfapi envSwitch to an environment:
wfapi env <name>Switch back to default:
wfapi env defaultExamples
# Show current environment
wfapi env
# Switch to dev environment (uses .wfapi.dev)
wfapi env dev
# Switch to staging
wfapi env staging
# Switch to production
wfapi env prod
# Back to default
wfapi env defaultEnvironment Configs
When an environment is active, wfapi uses the corresponding config file:
| Environment | Config File |
|---|---|
default | .wfapi |
dev | .wfapi.dev |
staging | .wfapi.staging |
prod | .wfapi.prod |
<custom> | .wfapi.<custom> |
Environment Badges
Commands display a colored badge when an environment is active:
- DEV/DEVELOPMENT — Yellow background
- STAGING/STAGE — Blue background
- PROD/PRODUCTION — Red background
- TEST — Cyan background
- QA — Magenta background
- Other — Green background
wfapi use
Manage site and collection context for easier command execution.
View Context
Show current site and collection:
wfapi useSet Site Context
By site ID:
wfapi use site <siteId>By short name:
wfapi use site <shortName>Set Collection Context
Requires site context to be set first.
By collection slug:
wfapi use cms <slug>By collection ID:
wfapi use cms <collectionId>Examples
# View current context
wfapi use
# Set site by ID
wfapi use site 68f81168c2a32ba4ce25cfc3
# Set site by short name
wfapi use site my-portfolio-site
# Set collection by slug
wfapi use cms blog-posts
# Set collection by ID
wfapi use cms 6611b3f9f3b1f1e2c0a12345Context Storage
Context is saved to the active config file:
- If a local
.wfapiexists → saved locally - Otherwise → saved to global
~/.wfapi
This allows project-specific context while maintaining global defaults.
wfapi cms
List CMS collections for the currently selected site.
Requirements
Site context must be set first:
wfapi use site <siteId|shortName>Basic Usage
wfapi cmsOutput
Displays for each collection:
- Collection name
- Slug
- Collection ID
Example Workflow
# Set site context
wfapi use site my-site
# List collections
wfapi cms
# Output:
# Blog Posts blog-posts 6611b3f9f3b1f1e2c0a12345
# Team Members team-members 7722c4a8d4c2e2f3d1b23456
# Projects projects 8833d5b9e5d3f3a4e2c34567wfapi items
List CMS items from the currently selected collection.
Requirements
Both site and collection context must be set:
wfapi use site <siteId>
wfapi use cms <collectionSlug>Basic Usage
wfapi itemsWith Filter
Filter items by name or slug:
wfapi items "search term"
wfapi items partialOptions
| Option | Description |
|---|---|
--recent | Show only items modified in the past week, newest first |
--raw | Output raw JSON instead of formatted table |
Examples
# All items
wfapi items
# Items containing "featured" in name/slug
wfapi items featured
# Recent items only
wfapi items --recent
# Items with filter, raw JSON
wfapi items "blog" --raw
# Recent items with filter
wfapi items "post" --recent --rawOutput
Displays:
- Item name
- Slug
- Item ID
- Last updated date
Example Workflow
# Set context
wfapi use site my-site
wfapi use cms blog-posts
# List all items
wfapi items
# Find recent posts
wfapi items --recent
# Search for specific posts
wfapi items "tutorial"wfapi login
OAuth-based authentication for Webflow.
Currently Unavailable: The login feature is disabled pending Webflow App approval. For now, use manually created API tokens via wfapi config set.
Future Usage
When available:
# Global OAuth (saves to ~/.wfapi)
wfapi login
# Local OAuth (saves to ./.wfapi)
wfapi login localHow OAuth Will Work
- Opens browser for Webflow authorization
- User grants permissions
- Token saved to config file
- Automatic token refresh
Precedence
Token precedence when reading:
./.wfapi(local)- Environment variable
WEBFLOW_API_TOKEN ~/.wfapi(global)
wfapi --help
Display help information for all commands or a specific command.
Basic Usage
wfapi --help
wfapi -hCommand-Specific Help
wfapi sites --help
wfapi config --help
wfapi use --helpCommon Patterns
Working with a Specific Site
# Set site context once
wfapi use site my-site-id
# Now run commands without repeating site ID
wfapi cms
wfapi use cms blog-posts
wfapi items
wfapi items --recentFiltering and Export
# Export all sites to JSON
wfapi sites --raw > sites.json
# Export recent items to JSON
wfapi items --recent --raw > recent-items.json
# Filter and export
wfapi items "featured" --raw > featured-items.jsonMulti-Environment Workflow
# Development
wfapi env dev
wfapi sites
wfapi use site dev-site-id
wfapi items
# Staging
wfapi env staging
wfapi sites
wfapi use site staging-site-id
wfapi items
# Production
wfapi env prod
wfapi sites
wfapi use site prod-site-id
wfapi items --recentQuick Context Switch
# Site A
wfapi use site site-a-id
wfapi use cms blog
wfapi items
# Site B
wfapi use site site-b-id
wfapi use cms products
wfapi items --recentError Handling
Common Errors
No API token configured:
Error: No API token found. Please run 'wfapi config set <token>' or set WEBFLOW_API_TOKEN.Solution: Configure your token with wfapi config set
No site context:
Error: No site context set. Run 'wfapi use site <siteId>' first.Solution: Set site context with wfapi use site
No collection context:
Error: No collection context set. Run 'wfapi use cms <collectionSlug>' first.Solution: Set collection context with wfapi use cms
Invalid permissions:
Error: API token lacks required permissions.Solution: Ensure your API token has Site (read) and CMS (read) permissions
Next Steps
See the Examples page for real-world workflows and use cases.