Convert any WordPress REST API to a Bruno collection with beautiful interactive CLI or direct command-line usage.
- 🔍 Dynamic discovery of all endpoints (core, plugins, custom post types)
- 📁 Organization by namespace and resource type
- 🎨 Beautiful interactive CLI with prompts
- 🔐 Authentication ready (Basic Auth, Application Passwords)
- ⚡ Optional schema fetching for faster conversions
npm install @n5s/bruno-wordpress-converternpm install -g @n5s/bruno-wordpress-converterAfter global installation, the wp-to-bruno command is available anywhere:
wp-to-bruno https://example.com/wp-json/# Local
node src/cli.js
# Global
wp-to-brunoThe CLI will prompt you for:
- WordPress API URL
- Collection name
- Output directory
- Namespace filtering (optional)
- Schema fetching preference
# Local
node src/cli.js https://example.com/wp-json/ -o ./my-api -n "My API"
# Global
wp-to-bruno https://example.com/wp-json/ -o ./my-api -n "My API"| Option | Alias | Description |
|---|---|---|
--output <dir> |
-o |
Output directory |
--name <name> |
-n |
Collection name |
--namespaces <list> |
Comma-separated namespaces (e.g., "wp/v2,wc/v3") | |
--no-schemas |
Skip detailed schema fetching (faster) | |
--username <username> |
-u |
WordPress username for authentication |
--password <password> |
-p |
WordPress application password |
--insecure |
-k |
Allow insecure SSL connections |
--help |
-h |
Show help |
# Interactive mode
wp-to-bruno
# Quick conversion with defaults
wp-to-bruno https://example.com/wp-json/
# Full CLI mode
wp-to-bruno https://example.com/wp-json/ -o ./my-api -n "My API"
# Filter specific namespaces
wp-to-bruno https://example.com/wp-json/ --namespaces "wp/v2"
# Fast conversion without schemas
wp-to-bruno https://example.com/wp-json/ --no-schemas
# With authentication (for private/restricted endpoints)
wp-to-bruno https://example.com/wp-json/ -u admin -p "xxxx xxxx xxxx xxxx xxxx xxxx"
# Full example with all options
wp-to-bruno https://example.com/wp-json/ \
-o ./my-api \
-n "My Private API" \
-u admin \
-p "xxxx xxxx xxxx xxxx xxxx xxxx" \
--namespaces "wp/v2,custom/v1"- Fetches the API index from
/wp-json/to discover all routes - Optionally fetches detailed schemas via
OPTIONSrequests - Converts WordPress schema to Bruno format using official Bruno packages
- Organizes endpoints by namespace and resource type
- Generates
.brufiles with environment variables and authentication
bruno-collection/
├── bruno.json
├── collection.bru # Auth configuration
├── environments/
│ └── default.bru # baseUrl, username, password
├── wp-v2/
│ ├── posts/
│ │ ├── list-posts.bru
│ │ ├── create-post.bru
│ │ ├── get-posts-by-id.bru
│ │ └── ...
│ ├── pages/
│ └── users/
└── [other-namespaces]/
Each endpoint includes:
- Request details (method, URL, headers)
- Query/path parameters
- Request body examples
- Basic test assertions
For private or restricted endpoints, you can provide authentication credentials during the conversion process:
Interactive Mode: The CLI will prompt you if you need authentication for private endpoints.
Command Line Mode:
wp-to-bruno https://example.com/wp-json/ -u admin -p "xxxx xxxx xxxx xxxx"After conversion, configure authentication in Bruno's environments/default.bru:
vars {
baseUrl: https://example.com/wp-json
username: your-username
password: your-application-password
}
Application Passwords (available since WordPress 5.6) are the recommended way to authenticate:
-
Create an Application Password:
- Go to WordPress Admin → Users → Profile
- Scroll to "Application Passwords" section
- Enter a name (e.g., "Bruno API Client")
- Click "Add New Application Password"
- Copy the generated password immediately (it's only shown once)
-
Use the Password:
- The password will have spaces (e.g.,
xxxx xxxx xxxx xxxx) - Spaces are automatically removed by the tool
- You can use it with or without spaces
- The password will have spaces (e.g.,
-
Security Benefits:
- Works only for API requests (not site login)
- Can be revoked anytime without changing your account password
- Create separate passwords for different applications
- Works with 2FA-protected accounts
Note: Application Passwords require HTTPS. For local development with self-signed certificates, use the --insecure flag.
The tool also supports Basic Auth, OAuth, and Cookie Authentication configured in Bruno.
CORS Errors: Use a CORS plugin or run on the server
Authentication Required: Temporarily disable auth or manually download schema
SSL Certificate Errors: Use NODE_TLS_REJECT_UNAUTHORIZED=0 for local development with self-signed certificates
MIT - Built with Bruno official packages