A terminal-first, interactive API client that brings Postman-like features into the CLI
Project description
apicrafter
A terminal-first, interactive API client that brings Postman-like features into the CLI. Built with modern Python tooling and designed for developers who prefer the command line.
✨ Features
- 🌐 Full HTTP Support - GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
- 📝 Multiple Request Formats - JSON, Form data, Raw text, Custom headers
- 🎨 Beautiful Output - Syntax highlighting for JSON, XML, HTML responses
- 💾 Collections - Save and organize your API requests
- 🌍 Environments - Manage dev/staging/prod configurations with variables
- 🔄 Variable Substitution - Use
{{VARIABLE}}syntax for dynamic values - 📚 Request History - Track all requests with timestamps and response times
- 🧪 Basic Testing - Assertions for status codes, response content, and more
- 🎯 Interactive Mode - Firebase CLI-style menus and prompts
- ⚡ High Performance - Built on httpx for fast, async-capable requests
🚀 Quick Start
Installation
pip install apicrafter-cli
Basic Usage
# Send a simple GET request
apicrafter send GET https://jsonplaceholder.typicode.com/posts/1
# Send a POST request with JSON data
apicrafter send POST https://httpbin.org/post \
--header "Content-Type: application/json" \
--data '{"title": "Hello", "body": "World"}'
# Interactive mode for guided request building
apicrafter interactive
📖 Core Commands
Send Requests
# Basic request
apicrafter send GET https://api.example.com/users
# With headers
apicrafter send POST https://api.example.com/users \
--header "Authorization: Bearer token123" \
--header "Content-Type: application/json"
# With JSON data
apicrafter send POST https://api.example.com/users \
--data '{"name": "John", "email": "john@example.com"}'
# With form data
apicrafter send POST https://api.example.com/login \
--form username=john \
--form password=secret
# With query parameters
apicrafter send GET https://api.example.com/users \
--param page=1 \
--param limit=10
Collections Management
# Save a request to a collection
apicrafter save get-users \
--method GET \
--url "https://api.example.com/users" \
--header "Authorization: Bearer {{TOKEN}}"
# Run a saved request
apicrafter run get-users
# List all collections
apicrafter collections
Environment Management
# Set environment variables
apicrafter env-set dev BASE_URL https://dev-api.example.com
apicrafter env-set dev TOKEN dev_token_123
# Run request with specific environment
apicrafter run get-users --env dev
Request History
# View request history
apicrafter history
# Replay a request from history
apicrafter replay 1
Testing
# Test a request with assertions
apicrafter test GET https://api.example.com/health \
--assert-status 200 \
--assert-json "status:healthy"
🔧 Configuration
apicrafter stores its configuration in ~/.apicrafter/:
~/.apicrafter/
├── collections.yaml # Saved requests and collections
├── envs.yaml # Environment variables
└── history.log # Request history
Environment Variables
Use the {{VARIABLE}} syntax in your requests for dynamic values:
# In collections.yaml
- name: get-user
method: GET
url: "{{BASE_URL}}/users/{{USER_ID}}"
headers:
Authorization: "Bearer {{TOKEN}}"
📚 Documentation
For more detailed documentation, visit the GitHub repository.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- httpx - Modern HTTP client
- typer - CLI framework
- rich - Beautiful terminal output
- questionary - Interactive prompts
- pydantic - Data validation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file apicrafter_cli-0.1.0.tar.gz.
File metadata
- Download URL: apicrafter_cli-0.1.0.tar.gz
- Upload date:
- Size: 45.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57c6922fded28f5e831c485fc904922a42ddeb181a32fc831c1c2eb5ff6c6343
|
|
| MD5 |
548d33cb1839fb30eaf2a1e17f2262fb
|
|
| BLAKE2b-256 |
4fe50883f7fa9b8cde63c834e910809c2c53d3ccb1de5b89f3190f32d903d1eb
|
File details
Details for the file apicrafter_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: apicrafter_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 49.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71f87b685c61708794f24885e589ceb09a332c5cf70f2a21a9fbb738cf67900f
|
|
| MD5 |
dcb2b6bc1aaa1bd1f055b34a6ea92730
|
|
| BLAKE2b-256 |
0a24c739e4e6a042b4aebe63b922ebc9df9f55cab7e2324eaa5f1bac5f86ee04
|