HFDesk exposes a local JSON API under /api. The web UI uses this API directly.
Errors return JSON with a legacy flat error string and a structured error_detail object:
{
"ok": false,
"error": "Invalid request body",
"details": "unexpected EOF",
"error_detail": {
"code": "bad_request",
"message": "Invalid request body",
"details": "unexpected EOF"
}
}GET /api/healthReturns server status, version, and timestamp.
GET /api/search?q=Qwen%20GGUF&sort=downloads&limit=40&filter=gguf
GET /api/search?datasets=true&q=finewebSearches Hugging Face models or datasets through the configured endpoint/proxy.
GET /api/analyze/{owner}/{repo}?revision=main&dataset=falseReturns repository metadata, files, type-specific analysis, selectable download items, and recommended download defaults.
Important response fields:
{
"repo": "owner/name",
"is_dataset": false,
"type": "gguf",
"files": [],
"selectable_items": [
{
"id": "q4_k_m",
"label": "Q4_K_M",
"filter_value": "q4_k_m",
"recommended": true,
"files": ["model-Q4_K_M.gguf"]
}
],
"recommended_filters": ["q4_k_m"],
"recommended_download": {
"repo": "owner/name",
"filters": ["q4_k_m"]
}
}recommended_download is a ready-to-send request body for POST /api/download. It replaces the old CLI-command string contract.
POST /api/planRequest:
{
"repo": "owner/name",
"revision": "main",
"dataset": false,
"filters": ["q4_k_m"],
"excludes": [],
"exactMatch": false
}Returns the files that would be downloaded without starting a job.
POST /api/downloadUses the same request shape as /api/plan. Starts or reuses a download job.
Notes:
repois required and must beowner/name.revisiondefaults tomain.cacheDirand globallocalDirare server-controlled.- Per-request
localDiris accepted only where explicitly supported by server configuration. - Duplicate active downloads return the existing job.
GET /api/jobs
GET /api/jobs/{id}
DELETE /api/jobs/{id}
POST /api/jobs/{id}/pause
POST /api/jobs/{id}/resume
POST /api/jobs/{id}/dismissdismiss removes terminal jobs from the UI/state. Running or queued jobs must be cancelled first.
GET /api/settings
POST /api/settingsSettings include runtime paths, concurrency, verification, endpoint, proxy settings, the HF cache directory, and extra local scan folders.
Storage fields:
{
"cacheDir": "I:\\huggingface",
"localDir": "D:\\Models",
"localScanDirs": ["D:\\Models", "I:\\LM Studio\\models"]
}cacheDir controls where HF cache-layout downloads are written. When localDir is set, downloads use real files under <localDir>/<owner>/<model>, which matches LM Studio-style model roots. localScanDirs are read-only model roots scanned as <owner>/<model> folders for the Cache browser and local badges in Hub search results.
GET /api/cache
GET /api/cache/{owner}/{repo}
POST /api/cache/rebuild
DELETE /api/cache/{owner}/{repo}?type=modelCache entries may come from:
HF cacheFriendly viewLocal
downloadStatus is one of:
completefilteredunknown
GET /api/mirror/targets
POST /api/mirror/targets
DELETE /api/mirror/targets/{name}
POST /api/mirror/diff
POST /api/mirror/push
POST /api/mirror/pullMirror operations compare and synchronize cache roots to configured targets.
GET /api/history
GET /api/diskfree?path=/path/to/cache/api/diskfree defaults to the resolved HF cache directory when no path is provided.
GET /api/wsMessages use:
{
"type": "job_update",
"data": {}
}Known message types:
job_updateeventstatus