Skip to main content

Download Queue

Queue up to 100 URLs for background download. Three run concurrently, with real-time progress via Server-Sent Events.

Download queue on dashboard

How It Works

When you submit a URL for download:

  1. A job is created and added to the queue
  2. The download starts in the background (up to 3 concurrent downloads)
  3. Progress is tracked and broadcast via Server-Sent Events (SSE)
  4. On completion, a Resource is created from the downloaded file

Queue Limits

SettingValue
Max concurrent downloads3
Max queue size100
Job retention (completed)1 hour
Job retention (paused)24 hours

When the queue is full, completed jobs are evicted first (oldest first), then failed/cancelled jobs. Active and paused jobs are never evicted.

Job Lifecycle

Each download job goes through these statuses:

StatusDescription
pendingQueued, waiting for a download slot
downloadingActively downloading the file
processingDownload complete, creating the Resource
completedResource created successfully
failedAn error occurred
cancelledCancelled by user
pausedPaused by user (can be resumed)

Job Operations

  • Cancel -- Stop an active download
  • Pause -- Pause a pending or downloading job (can be resumed later)
  • Resume -- Resume a paused job (restarts the download from the beginning)
  • Retry -- Retry a failed or cancelled job

Submitting Downloads

Single URL

POST /v1/jobs/download/submit
Content-Type: application/json

{
"url": "https://example.com/file.pdf",
"name": "My Document",
"ownerId": 123,
"tags": [1, 2]
}

Legacy alias: POST /v1/download/submit

Multiple URLs

Submit multiple URLs separated by newlines in the url field. Each URL becomes a separate job in the queue.

Timeout Configuration

Remote download timeouts are configurable via command-line flags or environment variables:

FlagEnv VariableDefaultDescription
-remote-connect-timeoutREMOTE_CONNECT_TIMEOUT30sTimeout for establishing a connection
-remote-idle-timeoutREMOTE_IDLE_TIMEOUT60sTimeout when the remote server stops sending data
-remote-overall-timeoutREMOTE_OVERALL_TIMEOUT30mMaximum total time for a download

API Endpoints

Legacy Download-Specific Aliases

MethodPathDescription
POST/v1/download/submitSubmit download URL(s)
GET/v1/download/queueList all download jobs
POST/v1/download/cancelCancel a download (id)
POST/v1/download/pausePause a download (id)
POST/v1/download/resumeResume a paused download (id)
POST/v1/download/retryRetry a failed download (id)
GET/v1/download/eventsSSE event stream (downloads and plugin action jobs)

Unified Job Routes

These are the canonical routes. Plugin action jobs appear only in the SSE event stream, not in the queue endpoint.

MethodPathDescription
POST/v1/jobs/download/submitSubmit download URL(s)
GET/v1/jobs/queueList download jobs
POST/v1/jobs/cancelCancel a download
POST/v1/jobs/pausePause a download
POST/v1/jobs/resumeResume a download
POST/v1/jobs/retryRetry a download
GET/v1/jobs/eventsSSE event stream (all job types)

SSE Event Format

On connect, the server sends an init event with the full current state of all jobs:

event: init
data: {"jobs":[...],"actionJobs":[...]}

Subsequent events use SSE event names (added, updated, removed) with JSON data:

event: added
data: {"type":"added","job":{"id":"abcd1234","status":"pending","url":"https://example.com/file.pdf"}}

event: updated
data: {"type":"updated","job":{"id":"abcd1234","status":"downloading","progress":45}}

event: removed
data: {"type":"removed","job":{"id":"abcd1234","status":"completed"}}

Each event data contains:

  • type -- "added", "updated", or "removed"
  • job -- The full job object with current status, progress, and metadata

Download progress updates are throttled to one event per 500ms per job.

note

The /v1/download/events and /v1/jobs/events endpoints serve identical streams. Both merge download job events and plugin action job events into a single SSE connection.