Skip to content
@deckyard/synology

synology cheatsheet

Every export of @deckyard/synology. Guides are listed in the introduction.

jennifer
import "@deckyard/synology/" as synology;

Every function that sends a request throws Error{kind: "synology"} when it fails. A path or folder is a File Station path such as /photo/2024.

Constants

ConstantValueMeaning
ERROR_KIND"synology"the kind of every error the deck throws
DEFAULT_PORT5001the port client adds to a bare host
PAGE_SIZE1000entries files and shares ask for per request

Types

Client

FieldMeaning
url as stringhttps://host:5001, without /webapi
sessionName as stringthe DSM session login opens; FileStation
sid as stringthe session id; "" before login
synoToken as stringCSRF token sent as X-SYNO-TOKEN
deviceId as stringtrusted-device id from loginOtp
deviceName as stringthe device name that id was given for
apis as map of string to ApiInfothe APIs discover found
tls as http.TlsOptionscertificate checking
timeoutMs as intidle timeout per request; 0 for 30 s
retries as intretries of a read answered 429 or 5xx
pollMs as intinterval of a background task's status checks

ApiInfo

FieldMeaning
name as stringe.g. SYNO.FileStation.List
path as stringthe CGI under /webapi, e.g. entry.cgi
minVersion as intthe oldest version the host accepts
maxVersion as intthe newest version the host accepts
requestFormat as stringJSON when every parameter goes JSON-encoded

SystemInfo

FieldMeaning
model as stringe.g. DS920+
serial as stringthe serial number
version as stringe.g. DSM 7.2.1-69057 Update 5
build as stringthe build number
ramMb as intmemory in MiB
uptime as intseconds since boot
temperature as intdegrees Celsius
overheated as boolwhether DSM warns about the temperature

Share

FieldMeaning
name as stringe.g. photo
path as string/photo
realPath as string/volume1/photo
free as intfree bytes on its volume
total as intsize of its volume in bytes
readOnly as boolwhether the volume is read-only

File

FieldMeaning
name as stringthe last path segment
path as stringthe File Station path
isDir as boolwhether it is a folder
size as intbytes; 0 for a folder
modified as intlast modification, Unix seconds

VDisk

FieldMeaning
id as stringthe vDisk id
sizeMb as intits size in MiB
controller as int1 VirtIO, 2 IDE, 3 SATA
unmap as boolwhether space reclamation is on

VNic

FieldMeaning
id as stringthe vNIC id
mac as stringits MAC address
model as int1 VirtIO, 2 e1000, 3 rtl8139
networkId as stringthe network it is connected to; "" for none
networkName as stringthat network's name

Guest

FieldMeaning
id as stringthe guest id
name as stringthe name the VM verbs take
description as stringthe description
status as stringe.g. running, shutdown, booting, creating
autorun as intafter a host boot: 0 off, 1 the last state, 2 on
storageId as stringthe storage it is on
storageName as stringthat storage's name
vcpus as intvirtual CPUs
ramMb as intmemory in MiB
disks as list of VDiskits virtual disks
nics as list of VNicits virtual network cards

DiskSpec

FieldMeaning
sizeMb as intthe size of an empty disk in MiB; ignored with an image
image as stringa disk image to copy; "" for an empty disk

GuestSpec

FieldMeaning
name as stringthe new VM's name
storage as stringthe storage it goes on
disks as list of DiskSpecits disks; the first one boots
networks as list of stringa network name per vNIC; "" for unconnected
vcpus as intvirtual CPUs; 0 for VMM's default
ramMb as intmemory in MiB; 0 for VMM's default

VmHost

FieldMeaning
id as stringthe host id
name as stringthe host name
status as stringrunning, inaccessible, network_warn or control_unavail
freeCpus as intfree CPU threads
totalCpus as intall CPU threads
freeRamMb as intfree memory in MiB
totalRamMb as intall memory in MiB

VmStorage

FieldMeaning
id as stringthe storage id
name as stringe.g. Synology - VM Storage 1
hostId as stringthe host it is on
hostName as stringthat host's name
status as stringe.g. online, degraded, full
sizeMb as intits size in MiB
usedMb as intused MiB
volumePath as stringe.g. /volume1

VmNetwork

FieldMeaning
id as stringthe network id
name as stringe.g. Default VM Network

VmImage

FieldMeaning
id as stringthe image id
name as stringthe name
type as stringdisk, vdsm or iso
storages as list of stringthe storages holding it

User

FieldMeaning
name as stringthe account name
uid as intthe user id
description as stringthe description
email as stringthe e-mail address
expired as stringnormal, or now for a disabled account

Group

FieldMeaning
name as stringthe group name
gid as intthe group id
description as stringthe description

SharePermission

FieldMeaning
name as stringthe user or group
access as stringrw, ro, deny or none
isAdmin as boolwhether it is an administrator

Certificate

FieldMeaning
id as stringthe certificate id
description as stringthe description
isDefault as boolwhether it is the default
commonName as stringthe subject, e.g. nas.example.com
issuer as stringthe issuer's common name
validFrom as stringas DSM shows it
validTill as stringas DSM shows it
services as list of stringthe services using it

Snapshot

FieldMeaning
name as stringe.g. GMT+01-2026.11.04-12.00.00
description as stringthe description
locked as boolkept from automatic removal
scheduled as boolwhether a schedule took it

Utilization

FieldMeaning
cpuPercent as intCPU load, all kinds
memoryPercent as intmemory in use
memoryTotalKb as intinstalled memory in KiB
memoryAvailableKb as intavailable memory in KiB
rxBytes as intbytes per second received
txBytes as intbytes per second sent

Volume

FieldMeaning
id as stringe.g. volume_1
path as stringe.g. /volume1
status as stringe.g. normal, degraded, crashed
fsType as stringe.g. btrfs
totalBytes as intits size
usedBytes as intbytes in use

Disk

FieldMeaning
id as stringe.g. sata1
name as stringe.g. Drive 1
model as stringthe model
status as stringe.g. normal, warning, crashed
smartStatus as stringe.g. normal, failing
temperature as intdegrees Celsius
sizeBytes as intits size

DsmUpdate

FieldMeaning
available as boolwhether an update is available
version as stringthe version on offer; "" without one
reboot as stringwhether installing reboots, e.g. now, none

Package

FieldMeaning
id as stringe.g. ContainerManager
name as stringe.g. Container Manager
version as stringthe version
status as stringe.g. running, stop

ScheduledTask

FieldMeaning
id as intthe task id
name as stringthe name
owner as stringthe account it runs as
type as stringe.g. script, service
enabled as boolwhether its schedule is on
nextRun as stringe.g. 2026-11-05 03:00
action as stringwhat it does

TaskResult

FieldMeaning
start as stringwhen it started
stop as stringwhen it ended
exitCode as intthe exit code
exitType as stringnormal or by_signal

BackupTask

FieldMeaning
id as intthe task id
name as stringthe name
state as stringe.g. backupable, backuping
status as stringe.g. none, waiting
lastResult as stringe.g. done, failed
lastTime as stringwhen it last ran
nextTime as stringwhen it runs next

Container

FieldMeaning
name as stringthe container name
id as stringthe container id
image as stringe.g. caddy:alpine
status as stringe.g. running, stopped

ContainerImage

FieldMeaning
id as stringsha256:...
repository as stringe.g. caddy, ghcr.io/owner/app
tags as list of stringe.g. ["alpine"]
size as intbytes
created as intUnix seconds
upgradable as boolwhether the registry has a newer image

Project

FieldMeaning
id as stringthe project id
name as stringthe project name
path as stringits folder, e.g. /docker/app
status as stringe.g. RUNNING, STOPPED
containerIds as list of stringits containers

LogLine

FieldMeaning
created as stringRFC 3339
stream as stringstdout or stderr
text as stringthe line

Connecting

FunctionReturnsDoes
synology.client(address)Clienta client for a host, not logged in
synology.withCaCert(c, pem)Clienttrust a certificate
synology.withInsecure(c)Clientaccept any certificate
synology.withTimeout(c, ms)Clientset the idle timeout
synology.withRetries(c, n)Clientretry reads answered 429 or 5xx
synology.withPollInterval(c, ms)Clientset the task check interval
synology.withSessionName(c, name)Clientname the session login opens
synology.withSession(c, sid, synoToken)Clientreuse a stored session
synology.withDeviceId(c, deviceId, deviceName)Clientpresent a trusted device
synology.discover(c)Clientfind the deck's APIs on the host
synology.apiInfo(c, api)ApiInfowhere an API lives and its versions
synology.login(c, account, password)Clientlog in and keep the session
synology.loginOtp(c, account, password, code, deviceName)Clientlog in with a 2-step code; trust the device when named
synology.logout(c)Clientend the session
synology.refreshToken(c)Clientget a new CSRF token for the session
synology.call(c, api, version, method, params)json.Valueany method of any API; version 0 for the newest

System

FunctionReturnsDoes
synology.info(c)SystemInfomodel, DSM version, memory, uptime, temperature

Files

FunctionReturnsDoes
synology.shares(c)list of Sharethe shared folders the account can see
synology.files(c, folder)list of Filea folder's entries, folders first
synology.stat(c, path)Fileone entry
synology.exists(c, path)boolwhether a path exists
synology.mkdir(c, path, parents)Filecreate a folder, and missing parents when parents
synology.rename(c, path, name)Filerename in place
synology.copy(c, path, folder, overwrite)stringcopy into a folder; the new path
synology.move(c, path, folder, overwrite)stringmove into a folder; the new path
synology.delete(c, path)delete a file, or a folder and its contents
synology.upload(c, folder, name, data, overwrite)stringupload bytes; the file's path
synology.download(c, path, maxBytes)bytesdownload a file; a folder as a zip

Virtual Machine Manager

FunctionReturnsDoes
synology.guests(c)list of Guestthe virtual machines
synology.guest(c, name)Guestone virtual machine
synology.createGuest(c, spec)Guestcreate one and wait; it stays off
synology.resizeGuest(c, name, vcpus, ramMb)change CPUs and memory; 0 keeps
synology.renameGuest(c, name, newName)rename one
synology.setAutorun(c, name, mode)off, last or on after a host boot
synology.deleteGuest(c, name)delete one and its disks
synology.powerOnGuest(c, name)power on
synology.shutdownGuest(c, name)shut down through the guest OS
synology.powerOffGuest(c, name)cut the power
synology.vmHosts(c)list of VmHostthe hosts, with free CPU and memory
synology.vmStorages(c)list of VmStoragethe storages
synology.vmNetworks(c)list of VmNetworkthe networks
synology.vmImages(c)list of VmImagethe images
synology.createImage(c, name, type, file, storages)stringimport a file on the NAS as an image; its id
synology.deleteImage(c, name)delete an image

Users, groups and shares

FunctionReturnsDoes
synology.users(c)list of Userthe local accounts
synology.user(c, name)Userone account
synology.createUser(c, name, password, description, email)Usercreate an account
synology.setUserPassword(c, name, password)set its password
synology.setUserEnabled(c, name, enabled)enable or disable it
synology.deleteUser(c, name)delete it
synology.groups(c)list of Groupthe local groups
synology.groupMembers(c, group)list of stringa group's accounts
synology.addToGroup(c, group, names)add accounts
synology.removeFromGroup(c, group, names)remove accounts
synology.createShare(c, name, volume, description)stringcreate a shared folder; its path
synology.deleteShare(c, name)delete a shared folder and its contents
synology.sharePermissions(c, share, kind)list of SharePermissioneach user or group and its access
synology.setSharePermission(c, share, kind, name, access)set one user's or group's access

Certificates

FunctionReturnsDoes
synology.certificates(c)list of Certificatethe certificates and their services
synology.importCertificate(c, key, cert, chain, description, replaceId, asDefault)stringimport or renew one; its id
synology.setDefaultCertificate(c, id)make it the default
synology.deleteCertificate(c, id)delete one
synology.assignCertificate(c, id, service)let a service use it

Snapshots

FunctionReturnsDoes
synology.snapshots(c, share)list of Snapshota share's snapshots
synology.createSnapshot(c, share, description, lock)stringtake one; its name
synology.deleteSnapshot(c, share, name)delete one

Health and system

FunctionReturnsDoes
synology.utilization(c)UtilizationCPU, memory and network load
synology.volumes(c)list of Volumethe volumes and their state
synology.disks(c)list of Diskthe drives, health and temperature
synology.checkUpdate(c)DsmUpdatewhether a DSM update is available
synology.reboot(c)restart the NAS
synology.shutdown(c)turn the NAS off

Packages and services

FunctionReturnsDoes
synology.packages(c)list of Packagethe installed packages
synology.startPackage(c, id)start one
synology.stopPackage(c, id)stop one
synology.serviceEnabled(c, service)boolwhether ssh, smb or nfs is on
synology.setService(c, service, enabled)turn it on or off

Scheduled tasks and Hyper Backup

FunctionReturnsDoes
synology.scheduledTasks(c)list of ScheduledTaskthe Task Scheduler's tasks
synology.runScheduledTask(c, job)run one now
synology.setScheduledTaskEnabled(c, job, enabled)turn its schedule on or off
synology.taskResults(c, job)list of TaskResultits recent runs
synology.backupTasks(c)list of BackupTaskthe Hyper Backup tasks
synology.backupStatus(c, id)BackupTaskone task and its last run
synology.runBackup(c, id)start a backup now

Container Manager

FunctionReturnsDoes
synology.containers(c)list of Containerthe containers, running or not
synology.inspectContainer(c, name)json.ValueDocker's inspect data
synology.startContainer(c, name)start one
synology.stopContainer(c, name)stop one
synology.restartContainer(c, name)restart one
synology.deleteContainer(c, name, force)delete one; force while it runs
synology.containerLogs(c, name, limit)list of LogLineits newest lines, newest first
synology.containerImages(c)list of ContainerImagethe images on the NAS
synology.pullContainerImage(c, repository, tag)pull an image
synology.deleteContainerImage(c, repository, tag)delete an image
synology.projects(c)list of Projectthe Compose projects
synology.project(c, id)Projectone project
synology.createProject(c, name, folder, compose)stringcreate one from a compose.yaml; its id
synology.buildProject(c, id)pull, build and start it
synology.startProject(c, id)start its containers
synology.stopProject(c, id)stop its containers
synology.deleteProject(c, id, keepFiles)delete it and its containers