Skip to Content
Commands Reference

Commands Reference

Complete guide to all wfapi commands and their options.

Command Overview

CommandDescription
wfapi sitesList Webflow sites
wfapi configManage API token configuration
wfapi envManage environments
wfapi useManage site and collection context
wfapi cmsList CMS collections
wfapi itemsList CMS items
wfapi loginOAuth authentication (future)
wfapi --helpShow help for all commands

Global Options

All commands support:

wfapi <command> --help # Show help for specific command

wfapi sites

List all Webflow sites accessible with your API token.

Basic Usage

wfapi sites

With 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

OptionDescription
--recentShow only sites modified in the past week, newest first
--rawOutput 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 --raw

Output

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_abc123xyz789

Get Token

wfapi config get # or wfapi config show

Displays the currently active token (global, local, or environment variable).

Delete Token

wfapi config delete

Removes 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 delete

wfapi env

Manage multiple environments (dev, staging, prod, etc.).

Basic Usage

View current environment:

wfapi env

Switch to an environment:

wfapi env <name>

Switch back to default:

wfapi env default

Examples

# 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 default

Environment Configs

When an environment is active, wfapi uses the corresponding config file:

EnvironmentConfig 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 use

Set 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 6611b3f9f3b1f1e2c0a12345

Context Storage

Context is saved to the active config file:

  • If a local .wfapi exists → 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 cms

Output

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 8833d5b9e5d3f3a4e2c34567

wfapi 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 items

With Filter

Filter items by name or slug:

wfapi items "search term" wfapi items partial

Options

OptionDescription
--recentShow only items modified in the past week, newest first
--rawOutput 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 --raw

Output

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 local

How OAuth Will Work

  1. Opens browser for Webflow authorization
  2. User grants permissions
  3. Token saved to config file
  4. Automatic token refresh

Precedence

Token precedence when reading:

  1. ./.wfapi (local)
  2. Environment variable WEBFLOW_API_TOKEN
  3. ~/.wfapi (global)

wfapi --help

Display help information for all commands or a specific command.

Basic Usage

wfapi --help wfapi -h

Command-Specific Help

wfapi sites --help wfapi config --help wfapi use --help

Common 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 --recent

Filtering 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.json

Multi-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 --recent

Quick 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 --recent

Error 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.

Last updated on