/download endpoint allows you to start new downloads and query the status of existing downloads.
POST /download
Start a new download.Request Body
The URL of the file to download. This is the only required parameter.
Custom filename for the downloaded file. If not provided, Surge will extract the filename from the URL or Content-Disposition header.
Destination directory path. Can be absolute or relative depending on the
relative_to_default_dir flag.If
true, the path parameter is treated as relative to the default download directory configured in settings.Array of mirror URLs to use for accelerated downloads. Surge will use these mirrors in addition to the primary URL.
Skip duplicate download checks and user prompts. Useful for automated downloads from trusted sources like browser extensions.
Custom HTTP headers to include in download requests. Useful for authentication, cookies, or other request customization.
Response
Returns a JSON object with the download ID and status:Unique identifier for the download. Use this ID with other endpoints to control the download.
Initial status of the download, typically
"queued".The URL being downloaded.
Examples
Response Example
GET /download
Query the status of a specific download.Query Parameters
The unique download ID returned when the download was created.
Response
Returns detailed status information about the download:Unique identifier for the download.
The URL being downloaded.
The filename of the download.
Full absolute path to the destination file.
Total file size in bytes.
Number of bytes downloaded so far.
Download progress as a percentage (0-100).
Current download speed in MB/s.
Current status:
"queued", "downloading", "paused", "completed", or "error".Error message if status is
"error".Estimated time remaining in seconds.
Number of active connections.
Unix timestamp when the download was added.
Total time taken in milliseconds (for completed downloads).
Average download speed in bytes/sec (for completed downloads).