A lightweight, cross-platform command-line interface for interacting with APIs. Built as a companion to the FluxAPI Desktop client, it allows developers and testers to send HTTP requests, inspect responses, and manage API workflows directly from the terminal.
- π Send HTTP Requests - Support for all HTTP methods (GET, POST, PUT, DELETE, etc.)
- πΎ Save & Manage Requests - Store frequently used requests for quick access
- π¨ Beautiful Output - Colored JSON responses and status codes
- π Code Generation - Export saved requests as code snippets in 12+ languages
- π Authentication Support - Bearer token authentication
- π Query Parameters & Headers - Full support for custom headers and query parameters
- π― Environment Variables - Support for environment-based authentication
- π Clipboard Integration - Copy generated code snippets to clipboard
npm install -g fluxapi-clipnpm add -g fluxapi-cliyarn global add fluxapi-cli# Simple GET request
fluxapi req https://jsonplaceholder.typicode.com/posts/1
# POST request with JSON data
fluxapi req https://jsonplaceholder.typicode.com/posts \
-m POST \
-H "Content-Type=application/json" \
-b '{"title": "My Post", "body": "Hello World", "userId": 1}'# Save a request configuration
fluxapi save myapi https://api.example.com/users \
-m GET \
-H "Authorization=Bearer your-token" \
-q "limit=10&page=1"
# Use saved request
fluxapi req @myapi
# List all saved requests
fluxapi list
# Delete a saved request
fluxapi delete myapi# Export as curl command
fluxapi export myapi --language curl
# Export as Python requests code
fluxapi export myapi -l python --copy
# Export as JavaScript fetch
fluxapi export myapi -l javascriptSend an HTTP request to the specified URL or use a saved request.
Usage:
fluxapi req <url|@saved-name> [options]Arguments:
<url>- URL to send the request to, or@nameto use a saved request
Options:
-m, --method <method>- HTTP method (GET, POST, PUT, DELETE, etc.) [default: "GET"]-H, --header <header...>- Headers inkey=valueformat (can be used multiple times)-q, --query <query...>- Query parameters inkey=valueformat (can be used multiple times)-b, --body <body>- Request body (JSON string)-t, --token <token>- Bearer authentication token
Examples:
# GET request
fluxapi req https://api.github.com/users/octocat
# POST with JSON body
fluxapi req https://httpbin.org/post \
-m POST \
-H "Content-Type=application/json" \
-b '{"name": "John", "age": 30}'
# With authentication
fluxapi req https://api.example.com/protected \
-H "Authorization=Bearer your-token"
# With query parameters
fluxapi req https://api.example.com/search \
-q "q=javascript" \
-q "sort=stars"
# Use saved request
fluxapi req @myapiSave a request configuration for future use.
Usage:
fluxapi save <name> <url> [options]Arguments:
<name>- Name to save the request under<url>- URL to send the request to
Options:
-m, --method <method>- HTTP method [default: "GET"]-H, --header <header...>- Headers inkey=valueformat-q, --query <query...>- Query parameters inkey=valueformat-b, --body <body>- Request body (JSON string)-t, --token <token>- Bearer authentication token
Examples:
# Save a simple GET request
fluxapi save github-user https://api.github.com/users/octocat
# Save a complex POST request
fluxapi save create-post https://jsonplaceholder.typicode.com/posts \
-m POST \
-H "Content-Type=application/json" \
-H "Authorization=Bearer token123" \
-b '{"title": "My Post", "body": "Content", "userId": 1}'
# Save with query parameters
fluxapi save search-repos https://api.github.com/search/repositories \
-q "q=javascript" \
-q "sort=stars" \
-q "order=desc"Display all saved request configurations.
Usage:
fluxapi listExample:
$ fluxapi list
Saved Requests:
- github-user
- create-post
- search-reposDelete a saved request configuration.
Usage:
fluxapi delete <name>Arguments:
<name>- Name of the saved request to delete
Example:
fluxapi delete github-userExport a saved request as a code snippet in various programming languages.
Usage:
fluxapi export <name> [options]Arguments:
<name>- Name of the saved request
Options:
-l, --language <lang>- Target language/framework [default: "curl"]--copy- Copy the generated snippet to clipboard
Supported Languages:
curl- cURL commandfetch/javascript- JavaScript Fetch APIaxios- JavaScript Axios librarypython/requests- Python requests libraryjava/okhttp- Java OkHttp librarygo/golang- Go net/http packagephp- PHP with file_get_contentscsharp/c#- C# HttpClientruby- Ruby Net::HTTPswift- Swift URLSessionkotlin- Kotlin OkHttprust- Rust reqwest library
Examples:
# Export as cURL (default)
fluxapi export myapi
# Export as Python requests
fluxapi export myapi -l python
# Export as JavaScript and copy to clipboard
fluxapi export myapi -l javascript --copy
# Export as Go code
fluxapi export myapi -l goYou can provide authentication tokens in several ways:
- Via command line option:
fluxapi req https://api.example.com/protected -t "your-token-here"- Via environment variable:
export AUTH_TOKEN="your-token-here"
fluxapi req https://api.example.com/protected- Save in request configuration:
fluxapi save protected-api https://api.example.com/protected -t "your-token-here"
fluxapi req @protected-apiFor other authentication methods, use custom headers:
# API Key authentication
fluxapi req https://api.example.com/data -H "X-API-Key=your-api-key"
# Basic authentication (base64 encoded)
fluxapi req https://api.example.com/data -H "Authorization=Basic dXNlcjpwYXNz"
# Custom token format
fluxapi req https://api.example.com/data -H "X-Auth-Token=your-custom-token"FluxAPI CLI provides beautiful, colored output for API responses:
- Status Codes: Color-coded by status (green for 2xx, yellow for 3xx, red for 4xx, etc.)
- JSON Responses: Syntax highlighted and pretty-printed
- Error Messages: Clear error formatting with helpful details
FluxAPI CLI stores your saved requests in a local configuration file using the conf package. The configuration is stored in:
- Linux/macOS:
~/.config/fluxapi/config.json - Windows:
%APPDATA%/fluxapi/config.json
For complex JSON bodies, you can use files:
# Save JSON to a file
echo '{"complex": {"nested": "data"}}' > body.json
# Use the file content
fluxapi req https://api.example.com/complex -m POST -b "$(cat body.json)"fluxapi req https://api.example.com/data \
-H "Content-Type=application/json" \
-H "Accept=application/json" \
-H "User-Agent=MyApp/1.0" \
-q "page=1" \
-q "limit=50" \
-q "sort=name"# Set base URL and token via environment
export API_BASE="https://api.staging.example.com"
export AUTH_TOKEN="staging-token-123"
# Use in requests
fluxapi req $API_BASE/users
fluxapi save staging-users $API_BASE/users -t $AUTH_TOKENWe welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: [your-email@example.com]
- Built with Commander.js for CLI framework
- Uses Axios for HTTP requests
- Powered by Chalk for beautiful terminal output
- JSON highlighting by json-colorizer
Made with β€οΈ by M-Skilla