# Create an API key inside your running container:
docker exec -it storage-server storage-server keys:create "Backend App" --role secret
# List all active keys:
docker exec -it storage-server storage-server keys:list
# View storage & cache metrics:
docker exec -it storage-server storage-server statsDevCloudDesk Storage Server includes a built-in command-line tool (storage-server) that allows administrators to generate and revoke API keys, check cluster health, and monitor cache usage without writing scripts or manual HTTP calls.
Running the CLI#
If you are running the server via Docker:
bashdocker exec -it storage-server storage-server <command> [options]
If you are running from source / Node.js directly:
bashnode dist/cli.js <command> [options]
Command Reference#
1. Create a New API Key (keys:create)
Generates a new secure API key with customizable permissions and rate limits:
bash# Create standard full-access secret key (default 120 req/min): docker exec -it storage-server storage-server keys:create "Mobile Backend" # Create key with custom rate limit (300 requests/minute): docker exec -it storage-server storage-server keys:create "High Traffic App" --rate 300 # Create restricted public key: docker exec -it storage-server storage-server keys:create "Frontend Client" --role public --rate 60
[!IMPORTANT]
Save Your Key: The raw secret API key (sk_live_...) is displayed only once upon creation. Store it in your project's .env or secret manager immediately.
2. List All Active API Keys (keys:list)
Displays a formatted table of all keys, their permissions, rate limits, and creation dates:
bashdocker exec -it storage-server storage-server keys:list
Output:
text🔑 API Keys (3 total): ┌─────────┬───────────────┬─────────────────┬────────┬─────────────────────────────┬───────────┐ │ ID │ Prefix │ Name │ Type │ Permissions │ RateLimit │ ├─────────┼───────────────┼─────────────────┼────────┼─────────────────────────────┼───────────┤ │ k_84920 │ sk_live_8a... │ Mobile Backend │ secret │ read, write, delete, admin │ 120/min │ │ k_19283 │ sk_live_f1... │ Frontend Client │ public │ read, write │ 60/min │ └─────────┴───────────────┴─────────────────┴────────┴─────────────────────────────┴───────────┘
3. Revoke an API Key (keys:revoke)
Immediately revokes an API key by its ID, preventing any further requests using that key:
bashdocker exec -it storage-server storage-server keys:revoke k_84920
4. Cluster Statistics (stats)
Prints real-time disk consumption, active files count, and cache usage:
bashdocker exec -it storage-server storage-server stats
Output:
text📊 Storage Server Stats: Driver: local Total Files: 1,420 Originals Size: 517.12 MB Cache Variants: 3,810 Cache Size: 85.06 MB RAM Consumption: 64 MB Uptime: 24 hours, 10 mins
5. Health Check (health)
Performs a fast ping check against the local storage engine:
bashdocker exec -it storage-server storage-server health
Next Steps#
- REST API Reference →: Programmatic HTTP endpoints.
- Custom Domains & Nginx Setup →: Set up production SSL and reverse proxy.
- Client SDK Installation →: Connect your application to the Storage Server.