Background Tasks
The following paths are relative to /api/v1 and require authentication.
These endpoints list existing tasks, read details, and retry failed tasks. Task creation is distributed across other modules; admins can also create storage-migration tasks.
Personal space
Section titled “Personal space”| Method | Path | Description |
|---|---|---|
GET | /tasks | Paginated list of current user’s personal tasks |
GET | /tasks/{id} | Read one personal task |
POST | /tasks/{id}/retry | Retry a failed personal task |
POST | /tasks/offline-download | Create a personal offline-download import task |
Team space
Section titled “Team space”| Method | Path | Description |
|---|---|---|
GET | /teams/{team_id}/tasks | Paginated list of team tasks |
GET | /teams/{team_id}/tasks/{id} | Read one team task |
POST | /teams/{team_id}/tasks/{id}/retry | Retry a failed team task |
POST | /teams/{team_id}/tasks/offline-download | Create a team offline-download import task |
Common task creators
Section titled “Common task creators”Current common creation paths include:
POST /batch/archive-compressPOST /teams/{team_id}/batch/archive-compressPOST /files/{id}/extractPOST /teams/{team_id}/files/{id}/extractGET /files/{id}/archive-previewGET /teams/{team_id}/files/{id}/archive-preview- public-share archive preview, thumbnail, image preview, and media metadata endpoints
- authenticated thumbnail, image preview, and media metadata endpoints
POST /tasks/offline-downloadPOST /teams/{team_id}/tasks/offline-downloadDELETE /trashDELETE /teams/{team_id}/trashPOST /admin/storage-migrationsPOST /admin/file-blobs/maintenance
System-created or system-recorded kinds include:
thumbnail_generateimage_preview_generatemedia_metadata_extractstorage_policy_migrationstorage_policy_temp_cleanupblob_maintenanceoffline_downloadsystem_runtime
Thumbnail, image preview, and media metadata tasks are blob-level cache tasks. They often have no creator, so the API returns creator = null, and ordinary /tasks lists usually do not show them. Admins can see all tasks through /api/v1/admin/tasks.
Storage migration task result
Section titled “Storage migration task result”storage_policy_migration tasks are created through /api/v1/admin/storage-migrations. They have independent checkpoints and can be resumed through /api/v1/admin/storage-migrations/{task_id}/resume.
The result is StoragePolicyMigrationTaskResult and currently includes:
source_policy_idtarget_policy_idscanned_blobsmigrated_blobsmerged_blobsskipped_blobsfailed_blobsmigrated_bytesrenamed_opaque_blobs
Opaque keys are not content hashes and are never merged across policies. If the target policy already has the same opaque key, the source blob is copied to a new migration-... key and counted in renamed_opaque_blobs.
Offline download
Section titled “Offline download”offline_download imports a file from a URL. Request body:
{ "url": "https://example.com/file.zip", "filename": "file.zip", "target_folder_id": 12, "expected_sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"}filename, target_folder_id, and expected_sha256 are optional. The server stores a redacted source URL in payload.source_display_url. On success, result includes the imported file_id, file_name, folder_id, file_path, source_display_url, content_length, actual sha256, and download_engine. result.source_display_url matches payload.source_display_url; sensitive URL parameters and credentials have been removed, so it is safe to display in the UI. Internal runtime metadata such as aria2 GIDs is still written to background_tasks.runtime_json for diagnostics, but is not returned as a public field.
The link-import engines are selected by the administrator runtime registry, not by the task request body. The registry can enable the built-in downloader, aria2, or both in fallback order; if all engines are disabled, create requests are rejected before a background task is inserted. Switching engines does not change the task kind, create request, or payload shape. The selected engine is persisted in internal runtime metadata while the task is running and in result.download_engine after success, so task presentation can show the actual downloader used. When aria2 is used, the execution GID is also persisted in background_tasks.runtime_json for diagnostics and recovery boundaries; runtime metadata is not exposed as a public API field.
Pagination
Section titled “Pagination”List endpoints use offset pagination:
limitoffset
Current defaults:
- default
limit = 20 - the max is controlled by runtime config
task_list_max_limit, default100 - personal endpoints return tasks created by the current user with
team_id = null - team endpoints return tasks for the specified
team_id
TaskInfo
Section titled “TaskInfo”Lists and details return TaskInfo, with fields such as:
idkindstatusdisplay_namecreatorteam_idshare_idprogress_currentprogress_totalprogress_percentstatus_textattempt_countmax_attemptslast_errorpayloadresultstepscan_retrylease_expires_atstarted_atfinished_atexpires_atcreated_atupdated_at
payload and result are structured objects, not the old payload_json / result_json fields. Internal execution state is not exposed through TaskInfo; for example, the aria2 engine persists its GID in background_tasks.runtime_json, not in payload or result. The public offline-download result may include download_engine, but this is the selected engine name, not aria2 internal state. steps gives per-stage state and progress. can_retry = true appears only for failed tasks that allow manual retry.
Current task kinds and statuses
Section titled “Current task kinds and statuses”BackgroundTaskKind currently includes:
archive_extractarchive_compressarchive_preview_generatethumbnail_generateimage_preview_generatemedia_metadata_extracttrash_purge_allstorage_policy_temp_cleanupstorage_policy_migrationblob_maintenanceoffline_downloadsystem_runtime
BackgroundTaskStatus currently includes:
pendingprocessingretrysucceededfailedcanceled
POST /tasks/{id}/retry
Section titled “POST /tasks/{id}/retry”Retry only accepts failed tasks:
- only
status = failedcan be retried - successful retry resets the task to a pending state
- the implementation clears the task’s old temp directory before reset
If the task is not failed, the API returns 400.
/batch/archive-downloaduses a short-lived stream ticket and direct ZIP streaming; it does not create abackground_tasksrow/batch/archive-compressand/files/{id}/extractdo create visible background tasks- archive preview endpoints return
202while generation is queued; clients should retry the original endpoint - image preview endpoints return
202whileimage_preview_generateis queued; clients should retry the original endpoint DELETE /trashcreatestrash_purge_allinstead of synchronously emptying trash/tasks/offline-downloadreturnsTaskInfoimmediately; progress should be shown in the task center; clients should not pass an engine choice in the request body/admin/storage-migrations/dry-rundoes not create a task;POST /admin/storage-migrationsdoesPOST /admin/file-blobs/maintenancecreatesblob_maintenance