2015-05-30 13:05:37 +02:00
. \" Man page generated from reStructuredText.
.
2020-05-13 07:45:31 +02:00
.TH "SYNCTHING-REST-API" "7" "May 12, 2020" "v1" "Syncthing"
2015-05-30 13:05:37 +02:00
.SH NAME
syncthing-rest-api \- REST API
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\ $1 \\ n[an-margin]
level \\ n[rst2man-indent-level]
level margin: \\ n[rst2man-indent\\ n[rst2man-indent-level]]
-
\\ n[rst2man-indent0]
\\ n[rst2man-indent1]
\\ n[rst2man-indent2]
. .
.de1 INDENT
. \" .rstReportMargin pre:
. RS \\ $1
. nr rst2man-indent\\n[rst2man-indent-level] \\ n[an-margin]
. nr rst2man-indent-level +1
. \" .rstReportMargin post:
. .
.de UNINDENT
. RE
. \" indent \\n[an-margin]
. \" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
. \" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\ n[rst2man-indent\\n[rst2man-indent-level]]u
. .
.sp
Syncthing exposes a REST interface over HTTP on the GUI port. This is used by
2018-02-07 07:45:17 +01:00
the GUI (from Javascript) and can be used by other processes wishing to control
2015-05-30 13:05:37 +02:00
Syncthing. In most cases both the input and output data is in JSON format. The
interface is subject to change.
.SH API KEY
.sp
2018-05-16 07:45:25 +02:00
To use the REST API an API key must be set and used. The API key can be
2016-10-07 04:09:19 +02:00
generated in the GUI, or set in the \fB configuration/gui/apikey\fP element in
the configuration file. To use an API key, set the request header
\fB X\- API\- Key\fP to the API key value. For example, \fB curl \- X POST \- H
"X\- API\- Key: abc123" http://localhost:8384/rest/...\fP can be used to invoke
2020-02-26 07:45:29 +01:00
with \fB curl\fP (add \fB \- k\fP flag when using HTTPS with a Syncthing generated or self signed certificate).
2015-05-30 13:05:37 +02:00
.SH SYSTEM ENDPOINTS
2017-08-22 11:00:52 +02:00
.SS GET /rest/system/browse
.sp
Returns a list of directories matching the path given by the optional parameter
2019-03-27 07:45:25 +01:00
\fB current\fP \& . The path can use \fI \% patterns as described in Go’ s filepath package\fP <\fB https://golang.org/pkg/path/filepath/#Match\fP >\& . A ‘ *’ will always be appended
2017-08-22 11:00:52 +02:00
to the given path (e.g. \fB /tmp/\fP matches all its subdirectories). If the option
\fB current\fP is not given, filesystem root paths are returned.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
$ curl \- H "X\- API\- Key: yourkey" localhost:8384/rest/system/browse | json_pp
[
"/"
]
$ curl \- H "X\- API\- Key: yourkey" localhost:8384/rest/system/browse?current=/var/ | json_pp
[
"/var/backups/",
"/var/cache/",
"/var/lib/",
"/var/local/",
"/var/lock/",
"/var/log/",
"/var/mail/",
"/var/opt/",
"/var/run/",
"/var/spool/",
"/var/tmp/"
]
$ curl \- H "X\- API\- Key: yourkey" localhost:8384/rest/system/browse?current=/var/*o | json_pp
[
"/var/local/",
"/var/lock/",
"/var/log/",
"/var/opt/",
"/var/spool/"
]
.ft P
.fi
.UNINDENT
.UNINDENT
2015-05-30 13:05:37 +02:00
.SS GET /rest/system/config
.sp
Returns the current configuration.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
2020-03-25 07:45:35 +01:00
"version": 30,
"folders": [
2016-06-03 13:02:27 +02:00
{
2020-03-25 07:45:35 +01:00
"id": "GXWxf\- 3zgnU",
"label": "MyFolder",
"filesystemType": "basic",
"path": "...",
"type": "sendreceive",
2016-06-03 13:02:27 +02:00
"devices": [
{
"deviceID": "...",
2020-03-25 07:45:35 +01:00
"introducedBy": ""
2016-06-03 13:02:27 +02:00
}
],
2020-03-25 07:45:35 +01:00
"rescanIntervalS": 60,
"fsWatcherEnabled": false,
"fsWatcherDelayS": 10,
"ignorePerms": false,
"autoNormalize": true,
"minDiskFree": {
"value": 1,
"unit": "%"
2016-06-03 13:02:27 +02:00
},
2020-03-25 07:45:35 +01:00
"versioning": {
"type": "simple",
"params": {
"keep": "5"
}
2016-06-03 13:02:27 +02:00
},
2020-03-25 07:45:35 +01:00
"copiers": 0,
"pullerMaxPendingKiB": 0,
"hashers": 0,
"order": "random",
"ignoreDelete": false,
"scanProgressIntervalS": 0,
"pullerPauseS": 0,
"maxConflicts": 10,
"disableSparseFiles": false,
"disableTempIndexes": false,
"paused": false,
"weakHashThresholdPct": 25,
"markerName": ".stfolder",
"copyOwnershipFromParent": false,
"modTimeWindowS": 0
}
],
"devices": [
{
"deviceID": "...",
"name": "Laptop",
"addresses": [
"dynamic",
"tcp://192.168.1.2:22000"
],
"compression": "metadata",
"certName": "",
"introducer": false,
"skipIntroductionRemovals": false,
"introducedBy": "",
"paused": false,
"allowedNetworks": [],
"autoAcceptFolders": false,
"maxSendKbps": 0,
"maxRecvKbps": 0,
"ignoredFolders": [],
"pendingFolders": [
{
"time": "2019\- 06\- 05T10:21:22+02:00",
"id": "cpkn4\- 57ysy",
"label": "SomeonesFolder"
}
],
"maxRequestKiB": 0
2016-06-03 13:02:27 +02:00
}
2020-03-25 07:45:35 +01:00
],
"gui": {
"enabled": true,
"address": "127.0.0.1:8384",
"user": "Username",
"password": "$2a$10$ZFws69T4FlvWwsqeIwL.TOo5zOYqsa/.TxlUnsGYS.j3JvjFTmxo6",
"authMode": "static",
"useTLS": false,
"apiKey": "pGahcht56664QU5eoFQW6szbEG6Ec2Cr",
"insecureAdminAccess": false,
"theme": "default",
"debugging": false,
"insecureSkipHostcheck": false,
"insecureAllowFrameLoading": false
},
"ldap": {
"addresd": "",
"bindDN": "",
"transport": "plain",
"insecureSkipVerify": false
},
"options": {
"listenAddresses": [
"default"
],
"globalAnnounceServers": [
"default"
],
"globalAnnounceEnabled": true,
"localAnnounceEnabled": true,
"localAnnouncePort": 21027,
"localAnnounceMCAddr": "[ff12::8384]:21027",
"maxSendKbps": 0,
"maxRecvKbps": 0,
"reconnectionIntervalS": 60,
"relaysEnabled": true,
"relayReconnectIntervalM": 10,
"startBrowser": false,
"natEnabled": true,
"natLeaseMinutes": 60,
"natRenewalMinutes": 30,
"natTimeoutSeconds": 10,
"urAccepted": \- 1,
"urSeen": 2,
"urUniqueId": "",
"urURL": "https://data.syncthing.net/newdata",
"urPostInsecurely": false,
"urInitialDelayS": 1800,
"restartOnWakeup": true,
"autoUpgradeIntervalH": 12,
"upgradeToPreReleases": false,
"keepTemporariesH": 24,
"cacheIgnoredFiles": false,
"progressUpdateIntervalS": 5,
"limitBandwidthInLan": false,
"minHomeDiskFree": {
"value": 1,
"unit": "%"
},
"releasesURL": "https://upgrades.syncthing.net/meta.json",
"alwaysLocalNets": [],
"overwriteRemoteDeviceNamesOnConnect": false,
"tempIndexMinBlocks": 10,
"unackedNotificationIDs": [],
"trafficClass": 0,
"defaultFolderPath": "~",
"setLowPriority": true,
"maxFolderConcurrency": 0,
"crURL": "https://crash.syncthing.net/newcrash",
"crashReportingEnabled": true,
"stunKeepaliveStartS": 180,
"stunKeepaliveMinS": 20,
"stunServers": [
"default"
],
"databaseTuning": "auto",
"maxConcurrentIncomingRequestKiB": 0
},
"remoteIgnoredDevices": [],
"pendingDevices": []
2015-05-30 13:05:37 +02:00
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS GET /rest/system/config/insync
.sp
Returns whether the config is in sync, i.e. whether the running
configuration is the same as that on disk.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
"configInSync": true
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS POST /rest/system/config
.sp
Post the full contents of the configuration, in the same format as returned by
2020-01-11 12:56:45 +01:00
the corresponding GET request. When posting the configuration succeeds,
the posted configuration is immediately applied, except for changes that require a restart. Query
rest\- config\- insync to check if a restart is required.
.sp
This endpoint is the main point to control Syncthing, even if the change only
concerns a very small part of the config: The usual workflow is to get the
config, modify the needed parts and post it again.
2015-05-30 13:05:37 +02:00
.SS GET /rest/system/connections
.sp
2015-11-09 14:00:10 +01:00
\fB NOTE:\fP
.INDENT 0 .0
.INDENT 3 .5
2016-06-03 13:02:27 +02:00
Return format changed in 0.13.0.
2015-11-09 14:00:10 +01:00
.UNINDENT
.UNINDENT
.sp
Returns the list of configured devices and some metadata associated
with them. The list also contains the local device itself as not connected.
2016-06-03 13:02:27 +02:00
.sp
The connection types are \fB TCP (Client)\fP , \fB TCP (Server)\fP , \fB Relay (Client)\fP and \fB Relay (Server)\fP \& .
2015-05-30 13:05:37 +02:00
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
2015-11-09 14:00:10 +01:00
"total" : {
"paused" : false,
"clientVersion" : "",
"at" : "2015\- 11\- 07T17:29:47.691637262+01:00",
"connected" : false,
"inBytesTotal" : 1479,
2016-06-03 13:02:27 +02:00
"type" : "",
2015-11-09 14:00:10 +01:00
"outBytesTotal" : 1318,
"address" : ""
},
"connections" : {
"YZJBJFX\- RDBL7WY\- 6ZGKJ2D\- 4MJB4E7\- ZATSDUY\- LD6Y3L3\- MLFUYWE\- AEMXJAC" : {
"connected" : true,
"inBytesTotal" : 556,
"paused" : false,
"at" : "2015\- 11\- 07T17:29:47.691548971+01:00",
"clientVersion" : "v0.12.1",
"address" : "127.0.0.1:22002",
2016-06-03 13:02:27 +02:00
"type" : "TCP (Client)",
2015-11-09 14:00:10 +01:00
"outBytesTotal" : 550
},
"DOVII4U\- SQEEESM\- VZ2CVTC\- CJM4YN5\- QNV7DCU\- 5U3ASRL\- YVFG6TH\- W5DV5AA" : {
"outBytesTotal" : 0,
2016-06-03 13:02:27 +02:00
"type" : "",
2015-11-09 14:00:10 +01:00
"address" : "",
"at" : "0001\- 01\- 01T00:00:00Z",
"clientVersion" : "",
"paused" : false,
"inBytesTotal" : 0,
"connected" : false
},
"UYGDMA4\- TPHOFO5\- 2VQYDCC\- 7CWX7XW\- INZINQT\- LE4B42N\- 4JUZTSM\- IWCSXA4" : {
"address" : "",
2016-06-03 13:02:27 +02:00
"type" : "",
2015-11-09 14:00:10 +01:00
"outBytesTotal" : 0,
"connected" : false,
"inBytesTotal" : 0,
"paused" : false,
"at" : "0001\- 01\- 01T00:00:00Z",
"clientVersion" : ""
}
}
2015-05-30 13:05:37 +02:00
}
.ft P
.fi
.UNINDENT
.UNINDENT
2015-11-05 16:47:06 +01:00
.SS GET /rest/system/debug
.sp
New in version 0.12.0.
.sp
Returns the set of debug facilities and which of them are currently enabled.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
"enabled": [
"beacon"
],
"facilities": {
"beacon": "Multicast and broadcast discovery",
"config": "Configuration loading and saving",
"connections": "Connection handling",
"db": "The database layer",
"dialer": "Dialing connections",
"discover": "Remote device discovery",
"events": "Event generation and logging",
"http": "REST API",
"main": "Main package",
"model": "The root hub",
"protocol": "The BEP protocol",
"relay": "Relay connection handling",
"scanner": "File change detection and hashing",
"stats": "Persistent device and folder statistics",
"sync": "Mutexes",
"upgrade": "Binary upgrades",
"upnp": "UPnP discovery and port mapping",
"versioner": "File versioning"
}
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS POST /rest/system/debug
.sp
New in version 0.12.0.
.sp
Enables or disables debugging for specified facilities. Give one or both of
\fB enable\fP and \fB disable\fP query parameters, with comma separated facility
names. To disable debugging of the beacon and discovery packages, and enable it
for config and db:
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
2015-12-01 11:24:30 +01:00
$ curl \- H X\- API\- Key:abc123 \- X POST \(aq http://localhost:8384/rest/system/debug?disable=beacon,discovery&enable=config,db\(aq
2015-11-05 16:47:06 +01:00
.ft P
.fi
.UNINDENT
.UNINDENT
2015-05-30 13:05:37 +02:00
.SS GET /rest/system/discovery
.sp
Returns the contents of the local discovery cache.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
"LGFPDIT7SKNNJVJZA4FC7QNCRKCE753K72BW5QD2FOZ7FRFEP57Q": [
"192.162.129.11:22000"
]
}
.ft P
.fi
.UNINDENT
.UNINDENT
2015-07-13 08:24:04 +02:00
.SS POST /rest/system/discovery
2015-05-30 13:05:37 +02:00
.sp
2015-11-22 16:05:20 +01:00
\fB NOTE:\fP
.INDENT 0 .0
.INDENT 3 .5
Removed in v0.12.0.
.UNINDENT
.UNINDENT
.sp
2015-05-30 13:05:37 +02:00
Post with the query parameters \fB device\fP and \fB addr\fP to add entries to
the discovery cache.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
2015-07-13 08:24:04 +02:00
curl \- X POST http://127.0.0.1:8384/rest/system/discovery?device=LGFPDIT7SKNNJVJZA4FC7QNCRKCE753K72BW5QD2FOZ7FRFEP57Q\e &addr=192.162.129.11:22000
2015-05-30 13:05:37 +02:00
# Or with the X\- API\- Key header:
2015-07-13 08:24:04 +02:00
curl \- X POST \- \- header "X\- API\- Key: TcE28kVPdtJ8COws1JdM0b2nodj77WeQ" http://127.0.0.1:8384/rest/system/discovery?device=LGFPDIT7SKNNJVJZA4FC7QNCRKCE753K72BW5QD2FOZ7FRFEP57Q\e &addr=192.162.129.11:22000
2015-05-30 13:05:37 +02:00
.ft P
.fi
.UNINDENT
.UNINDENT
.SS POST /rest/system/error/clear
.sp
Post with empty to body to remove all recent errors.
.SS GET /rest/system/error
.sp
2015-11-05 16:47:06 +01:00
\fB NOTE:\fP
.INDENT 0 .0
.INDENT 3 .5
Return format changed in 0.12.0.
.UNINDENT
.UNINDENT
.sp
2015-05-30 13:05:37 +02:00
Returns the list of recent errors.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
"errors": [
{
2015-11-05 16:47:06 +01:00
"when": "2014\- 09\- 18T12:59:26.549953186+02:00",
"message": "This is an error string"
2015-05-30 13:05:37 +02:00
}
]
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS POST /rest/system/error
.sp
Post with an error message in the body (plain text) to register a new
error. The new error will be displayed on any active GUI clients.
2015-11-05 16:47:06 +01:00
.SS GET /rest/system/log
.sp
New in version 0.12.0.
.sp
Returns the list of recent log entries.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
"messages": [
{
"when": "2014\- 09\- 18T12:59:26.549953186+02:00",
"message": "This is a log entry"
}
]
}
.ft P
.fi
.UNINDENT
.UNINDENT
2016-07-26 10:53:00 +02:00
.SS POST /rest/system/pause
.sp
2017-04-05 17:10:31 +02:00
Pause the given device or all devices.
2016-07-26 10:53:00 +02:00
.sp
2017-08-22 11:00:52 +02:00
Takes the optional parameter \fB device\fP (device ID). When omitted,
2017-04-05 17:10:31 +02:00
pauses all devices. Returns status 200 and no content upon success, or status
500 and a plain text error on failure.
2015-05-30 13:05:37 +02:00
.SS GET /rest/system/ping
.sp
Returns a \fB {"ping": "pong"}\fP object.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
"ping": "pong"
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS POST /rest/system/ping
.sp
Returns a \fB {"ping": "pong"}\fP object.
.SS POST /rest/system/reset
.sp
2015-06-14 13:52:00 +02:00
Post with empty body to erase the current index database and restart
Syncthing. With no query parameters, the entire database is erased from disk.
By specifying the \fB folder\fP parameter with a valid folder ID, only
information for that folder will be erased:
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
$ curl \- X POST \- H "X\- API\- Key: abc123" http://localhost:8384/rest/system/reset?folder=default
.ft P
.fi
.UNINDENT
.UNINDENT
2018-07-18 07:45:27 +02:00
.sp
\fB Caution\fP : See \fB \- reset\- database\fP for \fB \& .stfolder\fP creation side\- effect and caution regarding mountpoints.
2015-05-30 13:05:37 +02:00
.SS POST /rest/system/restart
.sp
Post with empty body to immediately restart Syncthing.
2016-07-26 10:53:00 +02:00
.SS POST /rest/system/resume
.sp
2017-04-05 17:10:31 +02:00
Resume the given device or all devices.
2016-07-26 10:53:00 +02:00
.sp
2017-08-22 11:00:52 +02:00
Takes the optional parameter \fB device\fP (device ID). When omitted,
2017-04-05 17:10:31 +02:00
resumes all devices. Returns status 200 and no content upon success, or status
500 and a plain text error on failure.
2015-05-30 13:05:37 +02:00
.SS POST /rest/system/shutdown
.sp
Post with empty body to cause Syncthing to exit and not restart.
.SS GET /rest/system/status
.sp
2020-03-18 07:45:30 +01:00
Returns information about current system status and resource usage. The CPU percent value has been deprecated from the API and will always report 0.
2015-05-30 13:05:37 +02:00
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
"alloc": 30618136,
2016-06-12 16:17:02 +02:00
"connectionServiceStatus": {
"dynamic+https://relays.syncthing.net/endpoint": {
2019-05-22 07:45:27 +02:00
"error": null,
2016-06-12 16:17:02 +02:00
"lanAddresses": [
"relay://23.92.71.120:443/?id=53STGR7\- YBM6FCX\- PAZ2RHM\- YPY6OEJ\- WYHVZO7\- PCKQRCK\- PZLTP7T\- 434XCAD&pingInterval=1m0s&networkTimeout=2m0s&sessionLimitBps=0&globalLimitBps=0&statusAddr=:22070&providedBy=canton7"
],
"wanAddresses": [
"relay://23.92.71.120:443/?id=53STGR7\- YBM6FCX\- PAZ2RHM\- YPY6OEJ\- WYHVZO7\- PCKQRCK\- PZLTP7T\- 434XCAD&pingInterval=1m0s&networkTimeout=2m0s&sessionLimitBps=0&globalLimitBps=0&statusAddr=:22070&providedBy=canton7"
]
},
"tcp://0.0.0.0:22000": {
2019-05-22 07:45:27 +02:00
"error": null,
2016-06-12 16:17:02 +02:00
"lanAddresses": [
"tcp://0.0.0.0:22000"
],
"wanAddresses": [
"tcp://0.0.0.0:22000"
]
}
},
2020-03-11 07:45:28 +01:00
"cpuPercent": 0,
2016-06-12 16:17:02 +02:00
"discoveryEnabled": true,
"discoveryErrors": {
"global@https://discovery\- v4\- 1.syncthing.net/v2/": "500 Internal Server Error",
"global@https://discovery\- v4\- 2.syncthing.net/v2/": "Post https://discovery\- v4\- 2.syncthing.net/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)",
"global@https://discovery\- v4\- 3.syncthing.net/v2/": "Post https://discovery\- v4\- 3.syncthing.net/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)",
"global@https://discovery\- v6\- 1.syncthing.net/v2/": "Post https://discovery\- v6\- 1.syncthing.net/v2/: dial tcp [2001:470:28:4d6::5]:443: connect: no route to host",
"global@https://discovery\- v6\- 2.syncthing.net/v2/": "Post https://discovery\- v6\- 2.syncthing.net/v2/: dial tcp [2604:a880:800:10::182:a001]:443: connect: no route to host",
"global@https://discovery\- v6\- 3.syncthing.net/v2/": "Post https://discovery\- v6\- 3.syncthing.net/v2/: dial tcp [2400:6180:0:d0::d9:d001]:443: connect: no route to host"
2015-05-30 13:05:37 +02:00
},
2016-06-12 16:17:02 +02:00
"discoveryMethods": 8,
2015-05-30 13:05:37 +02:00
"goroutines": 49,
2019-05-22 07:45:27 +02:00
"lastDialStatus": {
"tcp://10.20.30.40": {
"when": "2019\- 05\- 16T07:41:23Z",
"error": "dial tcp 10.20.30.40:22000: i/o timeout"
},
"tcp://172.16.33.3:22000": {
"when": "2019\- 05\- 16T07:40:43Z",
"ok": true
},
"tcp://83.233.120.221:22000": {
"when": "2019\- 05\- 16T07:41:13Z",
"error": "dial tcp 83.233.120.221:22000: connect: connection refused"
}
},
2015-05-30 13:05:37 +02:00
"myID": "P56IOI7\- MZJNU2Y\- IQGDREY\- DM2MGTI\- MGL3BXN\- PQ6W5BM\- TBBZ4TJ\- XZWICQ2",
"pathSeparator": "/",
2016-06-12 16:17:02 +02:00
"startTime": "2016\- 06\- 06T19:41:43.039284753+02:00",
2015-05-30 13:05:37 +02:00
"sys": 42092792,
2016-06-12 16:17:02 +02:00
"themes": [
"default",
"dark"
],
"tilde": "/Users/jb",
"uptime": 2635
2015-05-30 13:05:37 +02:00
}
.ft P
.fi
.UNINDENT
.UNINDENT
2019-05-22 07:45:27 +02:00
.sp
New in version 1.2.0: The \fB lastDialStatus\fP dictionary contains the last error (or \fB null\fP for
success) for each peer address that Syncthing has attempted to contact.
The \fB connectionServiceStatus\fP entries gained \fB "error": null\fP
attributes where previously there would be no \fB error\fP attribute at all
in the success case.
2015-05-30 13:05:37 +02:00
.SS GET /rest/system/upgrade
.sp
Checks for a possible upgrade and returns an object describing the
newest version and upgrade possibility.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
2018-05-23 07:45:25 +02:00
"latest": "v0.14.47",
"majorNewer": false,
"newer": true,
"running": "v0.14.46"
2015-05-30 13:05:37 +02:00
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS POST /rest/system/upgrade
.sp
Perform an upgrade to the newest released version and restart. Does
nothing if there is no newer version than currently running.
.SS GET /rest/system/version
.sp
Returns the current Syncthing version information.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
"arch": "amd64",
"longVersion": "syncthing v0.10.27+3\- gea8c3de (go1.4 darwin\- amd64 default) jb@syno 2015\- 03\- 16 11:01:29 UTC",
"os": "darwin",
"version": "v0.10.27+3\- gea8c3de"
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SH DATABASE ENDPOINTS
.SS GET /rest/db/browse
.sp
Returns the directory tree of the global model. Directories are always
JSON objects (map/dictionary), and files are always arrays of
modification time and size. The first integer is the files modification
time, and the second integer is the file size.
.sp
The call takes one mandatory \fB folder\fP parameter and two optional
parameters. Optional parameter \fB levels\fP defines how deep within the
tree we want to dwell down (0 based, defaults to unlimited depth)
Optional parameter \fB prefix\fP defines a prefix within the tree where to
start building the structure.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
$ curl \- s http://localhost:8384/rest/db/browse?folder=default | json_pp
{
"directory": {
"file": ["2015\- 04\- 20T22:20:45+09:00", 130940928],
"subdirectory": {
"another file": ["2015\- 04\- 20T22:20:45+09:00", 130940928]
}
},
"rootfile": ["2015\- 04\- 20T22:20:45+09:00", 130940928]
}
$ curl \- s http://localhost:8384/rest/db/browse?folder=default&levels=0 | json_pp
{
"directory": {},
"rootfile": ["2015\- 04\- 20T22:20:45+09:00", 130940928]
}
$ curl \- s http://localhost:8384/rest/db/browse?folder=default&levels=1 | json_pp
{
"directory": {
"file": ["2015\- 04\- 20T22:20:45+09:00", 130940928],
"subdirectory": {}
},
"rootfile": ["2015\- 04\- 20T22:20:45+09:00", 130940928]
}
$ curl \- s http://localhost:8384/rest/db/browse?folder=default&prefix=directory/subdirectory | json_pp
{
"another file": ["2015\- 04\- 20T22:20:45+09:00", 130940928]
}
$ curl \- s http://localhost:8384/rest/db/browse?folder=default&prefix=directory&levels=0 | json_pp
{
"file": ["2015\- 04\- 20T22:20:45+09:00", 130940928],
"subdirectory": {}
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fB NOTE:\fP
.INDENT 0 .0
.INDENT 3 .5
This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
.UNINDENT
.UNINDENT
.SS GET /rest/db/completion
.sp
Returns the completion percentage (0 to 100) for a given device and
2015-10-20 09:59:50 +02:00
folder. Takes \fB device\fP and \fB folder\fP parameters.
2015-05-30 13:05:37 +02:00
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
2017-11-22 07:45:21 +01:00
"completion": 100,
"globalBytes": 156793013575,
"needBytes": 0,
2020-04-08 07:45:32 +02:00
"needDeletes": 0,
"needItems": 0
2015-05-30 13:05:37 +02:00
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fB NOTE:\fP
.INDENT 0 .0
.INDENT 3 .5
This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
.UNINDENT
.UNINDENT
.SS GET /rest/db/file
.sp
Returns most data available about a given file, including version and
2015-07-13 08:24:04 +02:00
availability. Takes \fB folder\fP and \fB file\fP parameters.
2015-05-30 13:05:37 +02:00
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
2018-08-29 07:45:24 +02:00
"availability": [
{
"id": "ITZRNXE\- YNROGBZ\- HXTH5P7\- VK5NYE5\- QHRQGE2\- 7JQ6VNJ\- KZUEDIU\- 5PPR5AM",
"fromTemporary": false
}
],
2015-05-30 13:05:37 +02:00
"global": {
2018-05-30 07:45:27 +02:00
"deleted": false,
2018-08-29 07:45:24 +02:00
"ignored": false,
2018-05-30 07:45:27 +02:00
"invalid": false,
2018-08-29 07:45:24 +02:00
"localFlags": 0,
"modified": "2018\- 08\- 18T12:21:13.836784059+02:00",
"modifiedBy": "SYNO4VL",
"mustRescan": false,
"name": "testfile",
2018-05-30 07:45:27 +02:00
"noPermissions": false,
2015-05-30 13:05:37 +02:00
"numBlocks": 1,
2018-08-29 07:45:24 +02:00
"permissions": "0755",
"sequence": 107499,
"size": 1234,
2018-05-30 07:45:27 +02:00
"type": 0,
2015-05-30 13:05:37 +02:00
"version": [
2018-08-29 07:45:24 +02:00
"SYNO4VL:1"
2015-05-30 13:05:37 +02:00
]
},
"local": {
2018-05-30 07:45:27 +02:00
"deleted": false,
2018-08-29 07:45:24 +02:00
"ignored": false,
2018-05-30 07:45:27 +02:00
"invalid": false,
2018-08-29 07:45:24 +02:00
"localFlags": 0,
"modified": "2018\- 08\- 18T12:21:13.836784059+02:00",
"modifiedBy": "SYNO4VL",
"mustRescan": false,
"name": "testfile",
2018-05-30 07:45:27 +02:00
"noPermissions": false,
2015-05-30 13:05:37 +02:00
"numBlocks": 1,
2018-08-29 07:45:24 +02:00
"permissions": "0755",
"sequence": 111038,
"size": 1234,
2018-05-30 07:45:27 +02:00
"type": 0,
2015-05-30 13:05:37 +02:00
"version": [
2018-08-29 07:45:24 +02:00
"SYNO4VL:1"
2015-05-30 13:05:37 +02:00
]
}
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS GET /rest/db/ignores
.sp
Takes one parameter, \fB folder\fP , and returns the content of the
2016-06-12 16:17:02 +02:00
\fB \& .stignore\fP as the \fB ignore\fP field. A second field, \fB expanded\fP ,
provides a list of strings which represent globbing patterns described by gobwas/glob (based on standard wildcards) that match the patterns in \fB \& .stignore\fP and all the includes. If appropriate these globs are prepended by the following modifiers: \fB !\fP to negate the glob, \fB (?i)\fP to do case insensitive matching and \fB (?d)\fP to enable removing of ignored files in an otherwise empty directory.
2015-05-30 13:05:37 +02:00
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
"ignore": [
2016-06-12 16:17:02 +02:00
"(?i)/Backups"
2015-05-30 13:05:37 +02:00
],
2016-06-12 16:17:02 +02:00
"expanded": [
"(?i)Backups",
"(?i)Backups/**"
2015-05-30 13:05:37 +02:00
]
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS POST /rest/db/ignores
.sp
Expects a format similar to the output of \fB GET\fP call, but only
2016-07-26 10:53:00 +02:00
containing the \fB ignore\fP field (\fB expanded\fP field should be omitted).
2015-05-30 13:05:37 +02:00
It takes one parameter, \fB folder\fP , and either updates the content of
the \fB \& .stignore\fP echoing it back as a response, or returns an error.
.SS GET /rest/db/need
.sp
2016-05-21 15:44:39 +02:00
Takes one mandatory parameter, \fB folder\fP , and returns lists of files which are
2015-05-30 13:05:37 +02:00
needed by this device in order for it to become in sync.
2016-05-21 15:44:39 +02:00
.sp
Furthermore takes an optional \fB page\fP and \fB perpage\fP arguments for pagination.
Pagination happens, across the union of all needed files, that is \- across all
3 sections of the response.
For example, given the current need state is as follows:
.INDENT 0 .0
.IP 1 . 3
\fB progress\fP has 15 items
.IP 2 . 3
\fB queued\fP has 3 items
.IP 3 . 3
\fB rest\fP has 12 items
.UNINDENT
.sp
If you issue a query with \fB page=1\fP and \fB perpage=10\fP , only the \fB progress\fP
section in the response will have 10 items. If you issue a request query with
\fB page=2\fP and \fB perpage=10\fP , \fB progress\fP section will have the last 5 items,
\fB queued\fP section will have all 3 items, and \fB rest\fP section will have first
2 items. If you issue a query for \fB page=3\fP and \fB perpage=10\fP , you will only
have the last 10 items of the \fB rest\fP section.
.sp
In all these calls, \fB total\fP will be 30 to indicate the total number of
available items.
2015-05-30 13:05:37 +02:00
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
# Files currently being downloaded
"progress": [
{
"flags": "0755",
2016-08-10 11:41:46 +02:00
"sequence": 6,
2015-05-30 13:05:37 +02:00
"modified": "2015\- 04\- 20T23:06:12+09:00",
"name": "ls",
"size": 34640,
"version": [
"5157751870738175669:1"
]
}
],
# Files queued to be downloaded next (as per array order)
"queued": [
...
],
# Files to be downloaded after all queued files will be downloaded.
# This happens when we start downloading files, and new files get added while we are downloading.
"rest": [
...
2016-05-21 15:44:39 +02:00
],
"page": 1,
"perpage": 100,
"total": 2000
2015-05-30 13:05:37 +02:00
}
.ft P
.fi
.UNINDENT
.UNINDENT
2015-11-15 18:15:10 +01:00
.sp
\fB NOTE:\fP
.INDENT 0 .0
.INDENT 3 .5
This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
.UNINDENT
.UNINDENT
2016-06-26 12:48:01 +02:00
.SS POST /rest/db/override
.sp
2018-08-08 07:45:31 +02:00
Request override of a send only folder. Override means to make the local
version latest, overriding changes made on other devices. This API call does
nothing if the folder is not a send only folder.
.sp
2016-06-26 12:48:01 +02:00
Takes the mandatory parameter \fI folder\fP (folder ID).
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
2018-08-08 07:45:31 +02:00
curl \- X POST \- H X\- API\- key:... http://127.0.0.1:8384/rest/db/override?folder=default
2016-06-26 12:48:01 +02:00
.ft P
.fi
.UNINDENT
.UNINDENT
2015-05-30 13:05:37 +02:00
.SS POST /rest/db/prio
.sp
Moves the file to the top of the download queue.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
curl \- X POST http://127.0.0.1:8384/rest/db/prio?folder=default&file=foo/bar
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Response contains the same output as \fB GET /rest/db/need\fP
2018-08-08 07:45:31 +02:00
.SS POST /rest/db/revert
.sp
New in version 0.14.50.
.sp
Request revert of a receive only folder. Reverting a folder means to undo
all local changes. This API call does nothing if the folder is not a receive
only folder.
.sp
Takes the mandatory parameter \fI folder\fP (folder ID).
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
curl \- X POST \- H X\- API\- Key:... http://127.0.0.1:8384/rest/db/revert?folder=default
.ft P
.fi
.UNINDENT
.UNINDENT
2015-05-30 13:05:37 +02:00
.SS POST /rest/db/scan
.sp
2017-02-05 13:54:49 +01:00
Request immediate scan. Takes the optional parameters \fB folder\fP (folder ID),
\fB sub\fP (path relative to the folder root) and \fB next\fP (time in seconds). If
\fB folder\fP is omitted or empty all folders are scanned. If \fB sub\fP is given,
2019-03-27 07:45:25 +01:00
only this path (and children, in case it’ s a directory) is scanned. The \fB next\fP
argument delays Syncthing’ s automated rescan interval for a given amount of
2017-02-05 13:54:49 +01:00
seconds.
2015-05-30 13:05:37 +02:00
.sp
Requesting scan of a path that no longer exists, but previously did, is
valid and will result in Syncthing noticing the deletion of the path in
question.
.sp
Returns status 200 and no content upon success, or status 500 and a
plain text error if an error occurred during scanning.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
curl \- X POST http://127.0.0.1:8384/rest/db/scan?folder=default&sub=foo/bar
.ft P
.fi
.UNINDENT
.UNINDENT
.SS GET /rest/db/status
.sp
Returns information about the current status of a folder.
.sp
Parameters: \fB folder\fP , the ID of a folder.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
2018-08-08 07:45:31 +02:00
"globalBytes": 0,
"globalDeleted": 0,
"globalDirectories": 0,
"globalFiles": 0,
"globalSymlinks": 0,
2020-04-08 07:45:32 +02:00
"globalTotalItems": 0,
2018-08-08 07:45:31 +02:00
"ignorePatterns": false,
"inSyncBytes": 0,
"inSyncFiles": 0,
"invalid": "",
"localBytes": 0,
"localDeleted": 0,
"localDirectories": 0,
"localFiles": 0,
"localSymlinks": 0,
2020-04-08 07:45:32 +02:00
"localTotalItems": 0,
2015-05-30 13:05:37 +02:00
"needBytes": 0,
2018-08-08 07:45:31 +02:00
"needDeletes": 0,
"needDirectories": 0,
2015-05-30 13:05:37 +02:00
"needFiles": 0,
2018-08-08 07:45:31 +02:00
"needSymlinks": 0,
2020-04-08 07:45:32 +02:00
"needTotalItems": 0,
2018-08-08 07:45:31 +02:00
"pullErrors": 0,
"receiveOnlyChangedBytes": 0,
"receiveOnlyChangedDeletes": 0,
"receiveOnlyChangedDirectories": 0,
"receiveOnlyChangedFiles": 0,
"receiveOnlyChangedSymlinks": 0,
2020-04-08 07:45:32 +02:00
"receiveOnlyTotalItems": 0,
2018-08-08 07:45:31 +02:00
"sequence": 0,
2015-05-30 13:05:37 +02:00
"state": "idle",
2018-08-08 07:45:31 +02:00
"stateChanged": "2018\- 08\- 08T07:04:57.301064781+02:00",
"version": 0
2015-05-30 13:05:37 +02:00
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
2018-08-08 07:45:31 +02:00
The various fields have the following meaning:
.INDENT 0 .0
.TP
.B global*:
Data in the cluster latest version.
.TP
.B inSync*:
Data that is locally the same as the cluster latest version.
.TP
.B local*:
2019-03-27 07:45:25 +01:00
Data that is locally present, regardless of whether it’ s the same or different version as the cluster latest version.
2018-08-08 07:45:31 +02:00
.TP
.B need*:
Data that is needed to become up to date with the cluster latest version (i.e., data that is out of sync).
.TP
.B receiveOnlyChanged*:
Data that has changed locally in a receive only folder, and thus not been sent to the cluster.
.TP
.B invalid:
Deprecated, always empty.
.TP
.B pullErrors:
The number of files that failed to sync during the last sync operations.
.TP
.B sequence:
The current folder sequence number.
.TP
.B state:
The current folder state.
.TP
.B stateChanged:
When the folder state last changed.
.TP
.B version:
Deprecated, equivalent to the sequence number.
.UNINDENT
.sp
2015-05-30 13:05:37 +02:00
\fB NOTE:\fP
.INDENT 0 .0
.INDENT 3 .5
This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
.UNINDENT
.UNINDENT
2017-01-23 21:58:53 +01:00
.SH EVENT ENDPOINTS
2018-02-07 07:45:17 +01:00
.SS GET /rest/events
2017-01-23 21:58:53 +01:00
.sp
2018-02-07 07:45:17 +01:00
To receive events, perform a HTTP GET of \fB /rest/events\fP \& .
2017-11-22 07:45:21 +01:00
.sp
To filter the event list, in effect creating a specific subscription for
only the desired event types, add a parameter
2018-02-07 07:45:17 +01:00
\fB events=EventTypeA,EventTypeB,...\fP where the event types are any of the event\- types\& .
2017-04-05 17:10:31 +02:00
.sp
The optional parameter \fB since=<lastSeenID>\fP sets the ID of the last event
2019-03-27 07:45:25 +01:00
you’ ve already seen. Syncthing returns a JSON encoded array of event objects,
2017-04-05 17:10:31 +02:00
starting at the event just after the one with this last seen ID. The default
value is 0, which returns all events. There is a limit to the number of events
buffered, so if the rate of events is high or the time between polling calls is
long some events might be missed. This can be detected by noting a discontinuity
in the event IDs.
2017-01-23 21:58:53 +01:00
.sp
If no new events are produced since \fB <lastSeenID>\fP , the HTTP call blocks and
2017-02-23 07:47:07 +01:00
waits for new events to happen before returning. By default it times out after
60 seconds returning an empty array. The time out duration can be customized
2020-01-11 12:56:45 +01:00
with the optional parameter \fB timeout=<seconds>\fP \& .
2017-01-23 21:58:53 +01:00
.sp
2020-01-11 12:56:45 +01:00
To receive only a limited number of events, add the \fB limit=<n>\fP parameter with a
2017-01-23 21:58:53 +01:00
suitable value for \fB n\fP and only the \fI last\fP \fB n\fP events will be returned. This
can be used to catch up with the latest event ID after a disconnection for
example: \fB /rest/events?since=0&limit=1\fP \& .
2015-05-30 13:05:37 +02:00
.SH STATISTICS ENDPOINTS
.SS GET /rest/stats/device
.sp
Returns general statistics about devices. Currently, only contains the
time the device was last seen.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
$ curl \- s http://localhost:8384/rest/stats/device | json
{
"P56IOI7\- MZJNU2Y\- IQGDREY\- DM2MGTI\- MGL3BXN\- PQ6W5BM\- TBBZ4TJ\- XZWICQ2": {
"lastSeen" : "2015\- 04\- 18T11:21:31.3256277+01:00"
}
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS GET /rest/stats/folder
.sp
2016-06-03 13:02:27 +02:00
Returns general statistics about folders. Currently contains the
last scan time and the last synced file.
2015-05-30 13:05:37 +02:00
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
$ curl \- s http://localhost:8384/rest/stats/folder | json
{
"folderid" : {
2016-06-03 13:02:27 +02:00
"lastScan": "2016\- 06\- 02T13:28:01.288181412\- 04:00",
2015-05-30 13:05:37 +02:00
"lastFile" : {
"filename" : "file/name",
"at" : "2015\- 04\- 16T22:04:18.3066971+01:00"
}
}
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SH MISC SERVICES ENDPOINTS
.SS GET /rest/svc/deviceid
.sp
Verifies and formats a device ID. Accepts all currently valid formats
(52 or 56 characters with or without separators, upper or lower case,
with trivial substitutions). Takes one parameter, \fB id\fP , and returns
either a valid device ID in modern format, or an error.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
$ curl \- s http://localhost:8384/rest/svc/deviceid?id=1234 | json
{
"error": "device ID invalid: incorrect length"
}
$ curl \- s http://localhost:8384/rest/svc/deviceid?id=p56ioi7m\- \- zjnu2iq\- gdr\- eydm\- 2mgtmgl3bxnpq6w5btbbz4tjxzwicq | json
{
"id": "P56IOI7\- MZJNU2Y\- IQGDREY\- DM2MGTI\- MGL3BXN\- PQ6W5BM\- TBBZ4TJ\- XZWICQ2"
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS GET /rest/svc/lang
.sp
Returns a list of canonicalized localization codes, as picked up from
the \fB Accept\- Language\fP header sent by the browser.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
["sv_sv","sv","en_us","en"]
.ft P
.fi
.UNINDENT
.UNINDENT
2016-08-10 11:41:46 +02:00
.SS GET /rest/svc/random/string
.sp
Returns a strong random generated string (alphanumeric) of the specified length. Takes the \fB length\fP parameter.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
"random": "FdPaEaZQ56sXEKYNxpgF"
}
.ft P
.fi
.UNINDENT
.UNINDENT
2015-05-30 13:05:37 +02:00
.SS GET /rest/svc/report
.sp
Returns the data sent in the anonymous usage report.
.INDENT 0 .0
.INDENT 3 .5
.sp
.nf
.ft C
{
2015-11-15 18:15:10 +01:00
"folderMaxMiB" : 0,
"platform" : "linux\- amd64",
"totMiB" : 0,
"longVersion" : "syncthing v0.12.2 \e "Beryllium Bedbug\e " (go1.4.3 linux\- amd64 default) unknown\- user@build2.syncthing.net 2015\- 11\- 09 13:23:26 UTC",
"upgradeAllowedManual" : true,
"totFiles" : 3,
"folderUses" : {
"ignorePerms" : 0,
"autoNormalize" : 0,
2018-07-18 07:45:27 +02:00
"sendonly" : 0,
2015-11-15 18:15:10 +01:00
"ignoreDelete" : 0
},
"memoryUsageMiB" : 13,
"version" : "v0.12.2",
"sha256Perf" : 27.28,
"numFolders" : 2,
"memorySize" : 1992,
"announce" : {
"defaultServersIP" : 0,
"otherServers" : 0,
"globalEnabled" : false,
"defaultServersDNS" : 1,
"localEnabled" : false
},
"usesRateLimit" : false,
"numCPU" : 2,
"uniqueID" : "",
"urVersion" : 2,
"rescanIntvs" : [
60,
60
],
"numDevices" : 2,
"folderMaxFiles" : 3,
"relays" : {
"defaultServers" : 1,
"enabled" : true,
"otherServers" : 0
},
"deviceUses" : {
"compressMetadata" : 1,
"customCertName" : 0,
"staticAddr" : 1,
"compressAlways" : 0,
"compressNever" : 1,
"introducer" : 0,
"dynamicAddr" : 1
},
"upgradeAllowedAuto" : false
2015-05-30 13:05:37 +02:00
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SH AUTHOR
The Syncthing Authors
.SH COPYRIGHT
2019-02-13 07:45:23 +01:00
2014-2019, The Syncthing Authors
2015-05-30 13:05:37 +02:00
. \" Generated by docutils manpage writer.
.