fileinbox
v0.1.0
Published
CLI for the Fileinbox API — manage upload pages, responses, and file submissions
Maintainers
Readme
fileinbox-cli
CLI for the Fileinbox API. Manage upload pages, view responses, download files, and submit files programmatically.
Prerequisites
- Node.js 18+
Setup
npm install -g fileinbox
# or
git clone https://github.com/christiangenco/fileinbox-cli.git
cd fileinbox-cli
npm install && npm run build && npm linkGet an API token from fileinbox.com/settings/api_tokens, then:
fileinbox auth login
# paste your token when promptedOr set environment variables:
export FILEINBOX_API_TOKEN=fi_xxxxx
export FILEINBOX_API_URL=https://fileinbox.com # optional, defaults to thisCommands
Authentication
fileinbox auth login [token] # Save API token to .env (prompts if no token given)
fileinbox auth status # Verify token works (GET /ping)Pages
fileinbox pages list [--page N] [--per-page N]
fileinbox pages get <slug>
fileinbox pages create --slug <slug> [--title "Page Title"] [--api-submissions] [--access-code secret]
fileinbox pages update <slug> [--title "New Title"] [--api-submissions | --no-api-submissions]
fileinbox pages delete <slug>Responses
fileinbox responses list <slug> [--since 2025-01-01T00:00:00Z] [--page N] [--per-page N]
fileinbox responses get <slug> <id>
fileinbox responses delete <slug> <id>Download Files
# Download a specific file
fileinbox download <slug> <responseId> <fileId> [-o output.pdf]
# Download all files from a response
fileinbox download <slug> <responseId> [-o ./downloads/]Default output is the current directory using the original filename.
Submit (⭐ Star Command)
Submit files and form answers to a page in one shot. The page must have api_submissions_enabled: true.
# Simple: one file, one answer
fileinbox submit mypage --answer "[email protected]" --file ./report.pdf
# Multiple files
fileinbox submit mypage --answer "[email protected]" --file ./a.pdf --file ./b.jpg
# Use question title instead of ID (fuzzy match)
fileinbox submit mypage --answer "Your [email protected]" --file ./doc.pdf
# Multiple file questions: specify which question each file belongs to
fileinbox submit mypage --file "q_files_1=./report.pdf" --file "q_files_2=./photo.jpg"
# With access code
fileinbox submit mypage --answer "[email protected]" --file ./doc.pdf --access-code secret123How it works:
- Fetches the page to discover questions
- Maps
--answerkeys to question IDs (by ID or fuzzy title match) - Auto-maps
--fileto the file question (if there's only one) - POSTs multipart form data to
/api/v1/pages/:slug/submissions
Output Format
All commands output JSON to stdout:
{"ok": true, "data": { ... }}
{"ok": false, "error": "message", "code": "ERROR_CODE"}Use --pretty for indented output. Errors exit with code 1.
Environment Variables
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| FILEINBOX_API_TOKEN | Yes | — | API token (starts with fi_) |
| FILEINBOX_API_URL | No | https://fileinbox.com | Base URL |
Development
npm run dev -- pages list # Run without building (via tsx)
npm run build # Compile TypeScript
FILEINBOX_API_URL=http://localhost:8529 fileinbox pages list # Test against dev serverLicense
MIT
