Skip to content
@deckyard/unraid

unraid cheatsheet

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

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

Every function that sends a request throws Error{kind: "unraid"} when it fails. An id is one the API returned, such as Container.id; the server prefix (abc:) may be left out.

Constants

ConstantValueMeaning
ERROR_KIND"unraid"the kind of every error the deck throws
ROLES["ADMIN", "CONNECT", "GUEST", "VIEWER"]the roles an API key can hold
IMPORTANCE["INFO", "WARNING", "ALERT"]the importance levels of a notification
VM_STATES["NOSTATE", "RUNNING", "IDLE", "PAUSED", "SHUTDOWN", "SHUTOFF", "CRASHED", "PMSUSPENDED"]the states a virtual machine reports

Client

FunctionReturnsDoes
unraid.client(address as string)Clienta client for host, host:port or a URL; a bare host gets https:// and /graphql
unraid.withApiKey(c as Client, key as string)Clientsend x-api-key; letters, digits, - and _ only
unraid.withCaCert(c as Client, pem as bytes)Clienttrust a certificate besides the system's
unraid.withInsecure(c as Client)Clientaccept any certificate
unraid.withTimeout(c as Client, ms as int)Clientidle timeout per request; 0 for 30 s
unraid.withRetries(c as Client, n as int)Clientretry a query answered 429 or 5xx; never a mutation
unraid.withPollInterval(c as Client, ms as int)Clienthow often waitVm checks
unraid.query(c as Client, document as string, variables as json.Value)json.Valueany query or mutation; the reply's data

System

FunctionReturnsDoes
unraid.online(c as Client)boolwhether the server reports itself online
unraid.version(c as Client)VersionsUnraid, API and kernel versions
unraid.info(c as Client)SystemInfoname, OS, CPU, boot time
unraid.metrics(c as Client)MetricsCPU load and memory use
unraid.services(c as Client)list of Servicethe services the API reports on
unraid.upsDevices(c as Client)list of UpsDevicemonitored power supplies
unraid.logFiles(c as Client)list of LogFilelog files under /var/log
unraid.readLog(c as Client, path as string, lines as int, startLine as int)LogChunklines of a log; 0 for the defaults

Array, disks and shares

FunctionReturnsDoes
unraid.array(c as Client)StorageArraystate, capacity, disks, parity check
unraid.startArray(c as Client, passphrase as string)StorageArraystart it; passphrase over https:// only, "" for none
unraid.stopArray(c as Client)StorageArraystop it
unraid.mountDisk(c as Client, id as string)ArrayDiskmount a disk
unraid.unmountDisk(c as Client, id as string)ArrayDiskunmount a disk
unraid.addDiskToArray(c as Client, id as string, slot as int)StorageArrayadd a disk; slot -1 lets Unraid choose
unraid.clearDiskStats(c as Client, id as string)reset a disk's counters
unraid.disks(c as Client)list of Diskevery physical disk
unraid.assignableDisks(c as Client)list of Diskdisks in no array or pool
unraid.disk(c as Client, id as string)Diskone physical disk
unraid.shares(c as Client)list of Sharethe user shares
unraid.parityStatus(c as Client)ParityCheckthe current or last check
unraid.parityHistory(c as Client)list of ParityCheckpast checks
unraid.startParityCheck(c as Client, correct as bool)start one; correct writes fixes
unraid.pauseParityCheck(c as Client)pause it
unraid.resumeParityCheck(c as Client)resume it
unraid.cancelParityCheck(c as Client)cancel it

Containers

FunctionReturnsDoes
unraid.containers(c as Client)list of Containerevery Docker container
unraid.container(c as Client, id as string)Containerone container
unraid.containerByName(c as Client, name as string)Containerby name, with or without the leading /
unraid.startContainer(c as Client, id as string)Containerstart it
unraid.stopContainer(c as Client, id as string)Containerstop it
unraid.restartContainer(c as Client, id as string)Containerrestart it
unraid.pauseContainer(c as Client, id as string)Containerpause it
unraid.unpauseContainer(c as Client, id as string)Containerresume it
unraid.updateContainer(c as Client, id as string)Containerpull a newer image and recreate it
unraid.updateAllContainers(c as Client)list of Containerupdate every one with a newer image
unraid.removeContainer(c as Client, id as string, withImage as bool)remove it, and its image if asked
unraid.containerLogs(c as Client, id as string, since as string, tail as int)ContainerLogslog lines; since "" and tail 0 for all
unraid.setAutostart(c as Client, entries as list of Autostart)start order and delays

Virtual machines

FunctionReturnsDoes
unraid.vms(c as Client)list of Vmevery virtual machine
unraid.vm(c as Client, id as string)Vmone machine
unraid.vmByName(c as Client, name as string)Vmby name
unraid.startVm(c as Client, id as string)start it
unraid.stopVm(c as Client, id as string)ask it to shut down (ACPI)
unraid.forceStopVm(c as Client, id as string)power it off at once
unraid.pauseVm(c as Client, id as string)pause it
unraid.resumeVm(c as Client, id as string)resume it
unraid.rebootVm(c as Client, id as string)ask it to reboot
unraid.resetVm(c as Client, id as string)reset it
unraid.waitVm(c as Client, id as string, state as string, timeoutMs as int)Vmwait for a state from VM_STATES

Notifications

FunctionReturnsDoes
unraid.notifications(c as Client, archived as bool, importance as string, offset as int, limit as int)list of Notificationa page; importance "" for all
unraid.notificationOverview(c as Client)NotificationOverviewcounts, unread and archived
unraid.notify(c as Client, title as string, subject as string, description as string, importance as string, link as string)Notificationraise one
unraid.notifyOnce(c as Client, title as string, subject as string, description as string, importance as string, link as string)boolraise one unless an unread twin exists
unraid.archiveNotification(c as Client, id as string)archive it
unraid.unarchiveNotification(c as Client, id as string)move it back to unread
unraid.deleteNotification(c as Client, id as string, archived as bool)delete it
unraid.archiveAll(c as Client, importance as string)archive all unread; "" for every level

Administration

FunctionReturnsDoes
unraid.apiKeys(c as Client)list of ApiKeythe keys, without secrets
unraid.createApiKey(c as Client, name as string, description as string, roles as list of string)ApiKeymake one; the secret is in key, once
unraid.deleteApiKey(c as Client, id as string)delete one
unraid.plugins(c as Client)list of Plugininstalled plugins
unraid.flash(c as Client)Flashthe boot device
unraid.backupFlash(c as Client, remoteName as string, sourcePath as string, destinationPath as string)FlashBackupcopy the flash device to an rclone remote
unraid.rcloneRemotes(c as Client)list of RcloneRemotethe rclone remotes
unraid.createRcloneRemote(c as Client, name as string, type as string, parameters as json.Value)RcloneRemoteset one up
unraid.deleteRcloneRemote(c as Client, name as string)delete one
unraid.setServerIdentity(c as Client, name as string, comment as string)rename the server

Types

Client

FieldMeaning
url as stringthe GraphQL endpoint
apiKey as stringsent as x-api-key; "" for none
caCert as bytesa PEM certificate to trust
insecure as boolaccept any certificate
timeoutMs as intidle timeout per request; 0 for 30 s
retries as intretries of a query answered 429 or 5xx
pollMs as intdelay between waitVm checks

Versions

FieldMeaning
unraid as stringe.g. 7.2.0
api as stringthe Unraid API's version
kernel as stringthe Linux kernel

SystemInfo

FieldMeaning
name as stringthe server name
version as stringthe Unraid version
hostname as stringthe host name
distro as stringe.g. Unraid OS
release as stringits release
kernel as stringthe Linux kernel
arch as stringe.g. x64
bootTime as stringISO 8601
cpu as stringthe processor model
cores as intphysical cores
threads as inthardware threads
timeZone as stringe.g. Europe/Vienna

Metrics

FieldMeaning
cpuPercent as floatCPU load, percent
memTotal as intbytes
memUsed as intbytes
memAvailable as intbytes
memPercent as floatpercent in use
swapTotal as intbytes
swapUsed as intbytes

Service

FieldMeaning
name as stringe.g. unraid-api
online as boolwhether it runs
version as string"" when not reported

UpsDevice

FieldMeaning
id as stringits id
name as stringits name
model as stringits model
status as stringe.g. Online, On Battery
chargePercent as intbattery charge
runtimeSeconds as intestimated runtime
health as stringbattery health
loadPercent as intload
inputVolts as floatinput voltage
outputVolts as floatoutput voltage

LogFile

FieldMeaning
name as stringe.g. syslog
path as stringe.g. /var/log/syslog
size as intbytes
modified as stringISO 8601

LogChunk

FieldMeaning
path as stringthe file
content as stringthe lines
totalLines as intlines in the file
startLine as intfirst line returned, from 1; 0 when not reported

ArrayDisk

FieldMeaning
id as stringits id
idx as intslot: parity 0 and 29, data 1 to 28, pools 30 to 53
name as stringe.g. disk1
device as stringe.g. sdb
type as stringDATA, PARITY, CACHE, BOOT, FLASH
status as stringe.g. DISK_OK
sizeKb as intkilobytes
fsSizeKb as intfile system size, kilobytes
fsFreeKb as intfree, kilobytes
fsUsedKb as intused, kilobytes
fsType as stringe.g. xfs
temp as intdegrees Celsius; -1 when spun down
errors as interrors since the array started
spinning as boolspun up
rotational as boola spinning disk

ParityCheck

FieldMeaning
status as stringNEVER_RUN, RUNNING, PAUSED, COMPLETED, CANCELLED, FAILED
running as boolone runs now
paused as boolit is paused
correcting as boolit writes corrections
progress as intpercent
errors as intsync errors
speed as stringMB/s
duration as intseconds
date as stringISO 8601

StorageArray

FieldMeaning
state as stringSTARTED, STOPPED, or why it cannot start
totalKb as intcapacity, kilobytes
usedKb as intused, kilobytes
freeKb as intfree, kilobytes
parities as list of ArrayDiskparity disks
disks as list of ArrayDiskdata disks
caches as list of ArrayDiskpool devices
parity as ParityCheckthe current or last check

Disk

FieldMeaning
id as stringits id
device as stringe.g. /dev/sdb
name as stringits model
vendor as stringits vendor
type as stringe.g. HD, SSD
size as intbytes
serial as stringserial number
firmware as stringfirmware revision
interfaceType as stringSATA, SAS, USB, PCIE, UNKNOWN
smartStatus as stringOK or UNKNOWN
temperature as floatdegrees Celsius; -1.0 when not reported
spinning as boolspun up

Share

FieldMeaning
id as stringits id
name as stringe.g. appdata
comment as stringits description
freeKb as intkilobytes
usedKb as intkilobytes
sizeKb as intkilobytes
cache as booluses a pool
includeDisks as list of stringdisks it may use; empty for all
excludeDisks as list of stringdisks it must not use

Port

FieldMeaning
ip as stringhost address, "" for all
privatePort as intinside the container
publicPort as inton the host; 0 when not published
type as stringTCP or UDP

Container

FieldMeaning
id as stringits id
name as stringfirst name, without /
names as list of stringevery name
image as stringits image
state as stringRUNNING, PAUSED, EXITED
status as stringe.g. Up 3 hours
autoStart as boolstarts with the array
webUiUrl as string"" for none
updateAvailable as boola newer image is known
created as intUnix seconds
ports as list of Portits ports

LogLine

FieldMeaning
timestamp as stringISO 8601
message as stringthe line

ContainerLogs

FieldMeaning
lines as list of LogLineoldest first
cursor as stringpass as since to continue

Autostart

FieldMeaning
id as stringthe container
autoStart as boolstart it with the array
wait as intseconds before the next one

Vm

FieldMeaning
id as stringits id
name as stringits name
state as stringone of VM_STATES

Notification

FieldMeaning
id as stringits id
title as stringits title
subject as stringits subject
description as stringits text
importance as stringINFO, WARNING, ALERT
link as string"" for none
archived as boolarchived
timestamp as stringISO 8601

NotificationCounts

FieldMeaning
info as intINFO
warning as intWARNING
alert as intALERT
total as intall

NotificationOverview

FieldMeaning
unread as NotificationCountsunread ones
archived as NotificationCountsarchived ones

ApiKey

FieldMeaning
id as stringits id
name as stringits name
description as stringits description
key as stringthe secret; set only by createApiKey
roles as list of stringfrom ROLES
createdAt as stringISO 8601

Plugin

FieldMeaning
name as stringits name
version as stringits version

Flash

FieldMeaning
guid as stringthe GUID the licence is tied to
vendor as stringits vendor
product as stringits product name

RcloneRemote

FieldMeaning
name as stringits name
type as stringits backend, e.g. s3

FlashBackup

FieldMeaning
status as stringas the server reports it
jobId as stringthe rclone job; "" when not reported