Starting the Server
Launch the server
Start Surge in headless server mode:This starts the background daemon with the HTTP API bound to
0.0.0.0:1700.Server Configuration
The server accepts several configuration flags:The
surge and surge server commands both bind the HTTP API to 0.0.0.0 (all interfaces) by default. This means the server is accessible via localhost (127.0.0.1) as well as your local network IP.API Authentication
The Surge server API is token-protected for security.Getting Your Token
Retrieve the current API authentication token:Using Custom Tokens
Set a custom token when starting the server:Exit When Done
The--exit-when-done flag is perfect for automation and scripting:
- Single Download
- Batch Downloads
- CI/CD Integration
Download a file and exit when complete:The server will automatically shut down after the download finishes.
Managing the Server
Server Subcommands
Surge provides legacy compatibility commands for managing the server:Checking Downloads
List all downloads via CLI:Network Binding
By default, Surge binds to all network interfaces:- Localhost Access:
http://127.0.0.1:1700 - Local Network:
http://<your-ip>:1700 - Remote Access: Configure firewall rules to allow external access
Use the
--port flag to change the default port (1700) if it conflicts with other services.Automation Examples
API Endpoints
The server exposes an HTTP API on port 1700:| Endpoint | Method | Description |
|---|---|---|
/health | GET | Health check (returns {"status": "ok"}) |
/list | GET | List all downloads |
/download | POST | Queue a new download |
/pause?id=<id> | POST | Pause a download |
/resume?id=<id> | POST | Resume a download |
/delete?id=<id> | DELETE | Delete a download |
Server Logs
Surge maintains timestamped log files for debugging and monitoring:- Linux:
~/.local/state/surge/logs/ - macOS:
~/Library/Application Support/surge/logs/ - Windows:
%APPDATA%\surge\logs\
The server mode is designed to run 24/7. The daemon architecture ensures efficient resource usage even with many downloads.