syncthing-rest-api.7 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .
  4. .nr rst2man-indent-level 0
  5. .
  6. .de1 rstReportMargin
  7. \\$1 \\n[an-margin]
  8. level \\n[rst2man-indent-level]
  9. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  10. -
  11. \\n[rst2man-indent0]
  12. \\n[rst2man-indent1]
  13. \\n[rst2man-indent2]
  14. ..
  15. .de1 INDENT
  16. .\" .rstReportMargin pre:
  17. . RS \\$1
  18. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  19. . nr rst2man-indent-level +1
  20. .\" .rstReportMargin post:
  21. ..
  22. .de UNINDENT
  23. . RE
  24. .\" indent \\n[an-margin]
  25. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  26. .nr rst2man-indent-level -1
  27. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  28. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  29. ..
  30. .TH "SYNCTHING-REST-API" "7" "Sep 14, 2022" "v1.21.0" "Syncthing"
  31. .SH NAME
  32. syncthing-rest-api \- REST API
  33. .sp
  34. Syncthing exposes a REST interface over HTTP on the GUI port. This is used by
  35. the GUI (from Javascript) and can be used by other processes wishing to control
  36. Syncthing. In most cases both the input and output data is in JSON format. The
  37. interface is subject to change.
  38. .SH API KEY
  39. .sp
  40. To use the REST API an API key must be set and used. The API key can be
  41. generated in the GUI, or set in the \fBconfiguration/gui/apikey\fP element in
  42. the configuration file. To use an API key, set the request header
  43. \fBX\-API\-Key\fP to the API key value. For example, \fBcurl \-X POST \-H
  44. "X\-API\-Key: abc123" http://localhost:8384/rest/...\fP can be used to invoke
  45. with \fBcurl\fP (add \fB\-k\fP flag when using HTTPS with a Syncthing generated or self signed certificate).
  46. .SH RESULT PAGINATION
  47. .sp
  48. Some \fIGET\fP endpoints take optional \fBpage\fP and \fBperpage\fP arguments for
  49. pagination. No more than \fBperpage\fP (defaults to 65536 if not given) result
  50. entries are returned in an array. To access further entries, passing the
  51. \fBpage\fP parameter will advance in the results by that many pages. The actually
  52. used parameters are always returned as attributes in the response object.
  53. .SH SYSTEM ENDPOINTS
  54. .SS GET /rest/system/browse
  55. .sp
  56. Returns a list of directories matching the path given by the optional parameter
  57. \fBcurrent\fP\&. The path can use \fI\%patterns as described in Go’s filepath package\fP <\fBhttps://pkg.go.dev/path/filepath#Match\fP>\&. A ‘*’ will always be appended
  58. to the given path (e.g. \fB/tmp/\fP matches all its subdirectories). If the option
  59. \fBcurrent\fP is not given, filesystem root paths are returned.
  60. .INDENT 0.0
  61. .INDENT 3.5
  62. .sp
  63. .nf
  64. .ft C
  65. $ curl \-H "X\-API\-Key: yourkey" localhost:8384/rest/system/browse | json_pp
  66. [
  67. "/"
  68. ]
  69. $ curl \-H "X\-API\-Key: yourkey" localhost:8384/rest/system/browse?current=/var/ | json_pp
  70. [
  71. "/var/backups/",
  72. "/var/cache/",
  73. "/var/lib/",
  74. "/var/local/",
  75. "/var/lock/",
  76. "/var/log/",
  77. "/var/mail/",
  78. "/var/opt/",
  79. "/var/run/",
  80. "/var/spool/",
  81. "/var/tmp/"
  82. ]
  83. $ curl \-H "X\-API\-Key: yourkey" localhost:8384/rest/system/browse?current=/var/*o | json_pp
  84. [
  85. "/var/local/",
  86. "/var/lock/",
  87. "/var/log/",
  88. "/var/opt/",
  89. "/var/spool/"
  90. ]
  91. .ft P
  92. .fi
  93. .UNINDENT
  94. .UNINDENT
  95. .SS GET /rest/system/config (DEPRECATED)
  96. .sp
  97. Deprecated since version v1.12.0: This endpoint still works as before but is deprecated. Use rest\-config
  98. instead.
  99. .sp
  100. Returns the current configuration.
  101. .INDENT 0.0
  102. .INDENT 3.5
  103. .sp
  104. .nf
  105. .ft C
  106. {
  107. "version": 35,
  108. "folders": [
  109. {
  110. "id": "default",
  111. "label": "Default Folder",
  112. "filesystemType": "basic",
  113. "path": "...",
  114. "type": "sendreceive",
  115. "devices": [
  116. {
  117. "deviceID": "...",
  118. "introducedBy": "",
  119. "encryptionPassword": ""
  120. }
  121. ],
  122. "rescanIntervalS": 3600,
  123. "fsWatcherEnabled": true,
  124. "fsWatcherDelayS": 10,
  125. "ignorePerms": false,
  126. "autoNormalize": true,
  127. "minDiskFree": {
  128. "value": 1,
  129. "unit": "%"
  130. },
  131. "versioning": {
  132. "type": "",
  133. "params": {},
  134. "cleanupIntervalS": 3600,
  135. "fsPath": "",
  136. "fsType": "basic"
  137. },
  138. "copiers": 0,
  139. "pullerMaxPendingKiB": 0,
  140. "hashers": 0,
  141. "order": "random",
  142. "ignoreDelete": false,
  143. "scanProgressIntervalS": 0,
  144. "pullerPauseS": 0,
  145. "maxConflicts": \-1,
  146. "disableSparseFiles": false,
  147. "disableTempIndexes": false,
  148. "paused": false,
  149. "weakHashThresholdPct": 25,
  150. "markerName": ".stfolder",
  151. "copyOwnershipFromParent": false,
  152. "modTimeWindowS": 0,
  153. "maxConcurrentWrites": 2,
  154. "disableFsync": false,
  155. "blockPullOrder": "standard",
  156. "copyRangeMethod": "standard",
  157. "caseSensitiveFS": false,
  158. "junctionsAsDirs": true
  159. }
  160. ],
  161. "devices": [
  162. {
  163. "deviceID": "...",
  164. "name": "Laptop",
  165. "addresses": [
  166. "dynamic",
  167. "tcp://192.168.1.2:22000"
  168. ],
  169. "compression": "metadata",
  170. "certName": "",
  171. "introducer": false,
  172. "skipIntroductionRemovals": false,
  173. "introducedBy": "",
  174. "paused": false,
  175. "allowedNetworks": [],
  176. "autoAcceptFolders": false,
  177. "maxSendKbps": 0,
  178. "maxRecvKbps": 0,
  179. "ignoredFolders": [
  180. {
  181. "time": "2022\-01\-09T19:09:52Z",
  182. "id": "br63e\-wyhb7",
  183. "label": "Foo"
  184. }
  185. ],
  186. "maxRequestKiB": 0,
  187. "untrusted": false,
  188. "remoteGUIPort": 0
  189. }
  190. ],
  191. "gui": {
  192. "enabled": true,
  193. "address": "127.0.0.1:8384",
  194. "unixSocketPermissions": "",
  195. "user": "Username",
  196. "password": "$2a$10$ZFws69T4FlvWwsqeIwL.TOo5zOYqsa/.TxlUnsGYS.j3JvjFTmxo6",
  197. "authMode": "static",
  198. "useTLS": false,
  199. "apiKey": "k1dnz1Dd0rzTBjjFFh7CXPnrF12C49B1",
  200. "insecureAdminAccess": false,
  201. "theme": "default",
  202. "debugging": false,
  203. "insecureSkipHostcheck": false,
  204. "insecureAllowFrameLoading": false
  205. },
  206. "ldap": {
  207. "address": "",
  208. "bindDN": "",
  209. "transport": "plain",
  210. "insecureSkipVerify": false,
  211. "searchBaseDN": "",
  212. "searchFilter": ""
  213. },
  214. "options": {
  215. "listenAddresses": [
  216. "default"
  217. ],
  218. "globalAnnounceServers": [
  219. "default"
  220. ],
  221. "globalAnnounceEnabled": true,
  222. "localAnnounceEnabled": true,
  223. "localAnnouncePort": 21027,
  224. "localAnnounceMCAddr": "[ff12::8384]:21027",
  225. "maxSendKbps": 0,
  226. "maxRecvKbps": 0,
  227. "reconnectionIntervalS": 60,
  228. "relaysEnabled": true,
  229. "relayReconnectIntervalM": 10,
  230. "startBrowser": true,
  231. "natEnabled": true,
  232. "natLeaseMinutes": 60,
  233. "natRenewalMinutes": 30,
  234. "natTimeoutSeconds": 10,
  235. "urAccepted": 0,
  236. "urSeen": 0,
  237. "urUniqueId": "...",
  238. "urURL": "https://data.syncthing.net/newdata",
  239. "urPostInsecurely": false,
  240. "urInitialDelayS": 1800,
  241. "restartOnWakeup": true,
  242. "autoUpgradeIntervalH": 12,
  243. "upgradeToPreReleases": false,
  244. "keepTemporariesH": 24,
  245. "cacheIgnoredFiles": false,
  246. "progressUpdateIntervalS": 5,
  247. "limitBandwidthInLan": false,
  248. "minHomeDiskFree": {
  249. "value": 1,
  250. "unit": "%"
  251. },
  252. "releasesURL": "https://upgrades.syncthing.net/meta.json",
  253. "alwaysLocalNets": [],
  254. "overwriteRemoteDeviceNamesOnConnect": false,
  255. "tempIndexMinBlocks": 10,
  256. "unackedNotificationIDs": [
  257. "authenticationUserAndPassword"
  258. ],
  259. "trafficClass": 0,
  260. "setLowPriority": true,
  261. "maxFolderConcurrency": 0,
  262. "crURL": "https://crash.syncthing.net/newcrash",
  263. "crashReportingEnabled": true,
  264. "stunKeepaliveStartS": 180,
  265. "stunKeepaliveMinS": 20,
  266. "stunServers": [
  267. "default"
  268. ],
  269. "databaseTuning": "auto",
  270. "maxConcurrentIncomingRequestKiB": 0,
  271. "announceLANAddresses": true,
  272. "sendFullIndexOnUpgrade": false,
  273. "featureFlags": [],
  274. "connectionLimitEnough": 0,
  275. "connectionLimitMax": 0,
  276. "insecureAllowOldTLSVersions": false
  277. },
  278. "remoteIgnoredDevices": [
  279. {
  280. "time": "2022\-01\-09T20:02:01Z",
  281. "deviceID": "...",
  282. "name": "...",
  283. "address": "192.168.0.20:22000"
  284. }
  285. ],
  286. "defaults": {
  287. "folder": {
  288. "id": "",
  289. "label": "",
  290. "filesystemType": "basic",
  291. "path": "~",
  292. "type": "sendreceive",
  293. "devices": [
  294. {
  295. "deviceID": "...",
  296. "introducedBy": "",
  297. "encryptionPassword": ""
  298. }
  299. ],
  300. "rescanIntervalS": 3600,
  301. "fsWatcherEnabled": true,
  302. "fsWatcherDelayS": 10,
  303. "ignorePerms": false,
  304. "autoNormalize": true,
  305. "minDiskFree": {
  306. "value": 1,
  307. "unit": "%"
  308. },
  309. "versioning": {
  310. "type": "",
  311. "params": {},
  312. "cleanupIntervalS": 3600,
  313. "fsPath": "",
  314. "fsType": "basic"
  315. },
  316. "copiers": 0,
  317. "pullerMaxPendingKiB": 0,
  318. "hashers": 0,
  319. "order": "random",
  320. "ignoreDelete": false,
  321. "scanProgressIntervalS": 0,
  322. "pullerPauseS": 0,
  323. "maxConflicts": 10,
  324. "disableSparseFiles": false,
  325. "disableTempIndexes": false,
  326. "paused": false,
  327. "weakHashThresholdPct": 25,
  328. "markerName": ".stfolder",
  329. "copyOwnershipFromParent": false,
  330. "modTimeWindowS": 0,
  331. "maxConcurrentWrites": 2,
  332. "disableFsync": false,
  333. "blockPullOrder": "standard",
  334. "copyRangeMethod": "standard",
  335. "caseSensitiveFS": false,
  336. "junctionsAsDirs": false
  337. },
  338. "device": {
  339. "deviceID": "",
  340. "name": "",
  341. "addresses": [
  342. "dynamic"
  343. ],
  344. "compression": "metadata",
  345. "certName": "",
  346. "introducer": false,
  347. "skipIntroductionRemovals": false,
  348. "introducedBy": "",
  349. "paused": false,
  350. "allowedNetworks": [],
  351. "autoAcceptFolders": false,
  352. "maxSendKbps": 0,
  353. "maxRecvKbps": 0,
  354. "ignoredFolders": [],
  355. "maxRequestKiB": 0,
  356. "untrusted": false,
  357. "remoteGUIPort": 0
  358. }
  359. }
  360. }
  361. .ft P
  362. .fi
  363. .UNINDENT
  364. .UNINDENT
  365. .SS GET /rest/system/config/insync (DEPRECATED)
  366. .sp
  367. Deprecated since version v1.12.0: This endpoint still works as before but is deprecated. Use
  368. rest\-config\-insync instead.
  369. .sp
  370. Returns whether the config is in sync, i.e. whether the running
  371. configuration is the same as that on disk.
  372. .INDENT 0.0
  373. .INDENT 3.5
  374. .sp
  375. .nf
  376. .ft C
  377. {
  378. "configInSync": true
  379. }
  380. .ft P
  381. .fi
  382. .UNINDENT
  383. .UNINDENT
  384. .SS POST /rest/system/config (DEPRECATED)
  385. .sp
  386. Deprecated since version v1.12.0: This endpoint still works as before but is deprecated. Use config
  387. instead.
  388. .sp
  389. Post the full contents of the configuration, in the same format as returned by
  390. the corresponding GET request. When posting the configuration succeeds,
  391. the posted configuration is immediately applied, except for changes that require a restart. Query
  392. rest\-config\-insync to check if a restart is required.
  393. .sp
  394. This endpoint is the main point to control Syncthing, even if the change only
  395. concerns a very small part of the config: The usual workflow is to get the
  396. config, modify the needed parts and post it again.
  397. .SS GET /rest/system/connections
  398. .sp
  399. \fBNOTE:\fP
  400. .INDENT 0.0
  401. .INDENT 3.5
  402. Return format changed in versions 0.13.0 and 1.19.0.
  403. .UNINDENT
  404. .UNINDENT
  405. .sp
  406. Returns the list of configured devices and some metadata associated
  407. with them. The list also contains the local device itself as not connected.
  408. .sp
  409. The connection types are \fBTCP (Client)\fP, \fBTCP (Server)\fP, \fBRelay (Client)\fP and \fBRelay (Server)\fP\&.
  410. .INDENT 0.0
  411. .INDENT 3.5
  412. .sp
  413. .nf
  414. .ft C
  415. {
  416. "total" : {
  417. "at" : "2015\-11\-07T17:29:47.691637262+01:00",
  418. "inBytesTotal" : 1479,
  419. "outBytesTotal" : 1318,
  420. },
  421. "connections" : {
  422. "YZJBJFX\-RDBL7WY\-6ZGKJ2D\-4MJB4E7\-ZATSDUY\-LD6Y3L3\-MLFUYWE\-AEMXJAC" : {
  423. "connected" : true,
  424. "inBytesTotal" : 556,
  425. "paused" : false,
  426. "at" : "2015\-11\-07T17:29:47.691548971+01:00",
  427. "startedAt" : "2015\-11\-07T00:09:47Z",
  428. "clientVersion" : "v0.12.1",
  429. "address" : "127.0.0.1:22002",
  430. "type" : "TCP (Client)",
  431. "outBytesTotal" : 550
  432. },
  433. "DOVII4U\-SQEEESM\-VZ2CVTC\-CJM4YN5\-QNV7DCU\-5U3ASRL\-YVFG6TH\-W5DV5AA" : {
  434. "outBytesTotal" : 0,
  435. "type" : "",
  436. "address" : "",
  437. "at" : "0001\-01\-01T00:00:00Z",
  438. "startedAt" : "0001\-01\-01T00:00:00Z",
  439. "clientVersion" : "",
  440. "paused" : false,
  441. "inBytesTotal" : 0,
  442. "connected" : false
  443. },
  444. "UYGDMA4\-TPHOFO5\-2VQYDCC\-7CWX7XW\-INZINQT\-LE4B42N\-4JUZTSM\-IWCSXA4" : {
  445. "address" : "",
  446. "type" : "",
  447. "outBytesTotal" : 0,
  448. "connected" : false,
  449. "inBytesTotal" : 0,
  450. "paused" : false,
  451. "at" : "0001\-01\-01T00:00:00Z",
  452. "startedAt" : "0001\-01\-01T00:00:00Z",
  453. "clientVersion" : ""
  454. }
  455. }
  456. }
  457. .ft P
  458. .fi
  459. .UNINDENT
  460. .UNINDENT
  461. .SS GET /rest/system/debug
  462. .sp
  463. New in version 0.12.0.
  464. .sp
  465. Returns the set of debug facilities and which of them are currently enabled.
  466. .INDENT 0.0
  467. .INDENT 3.5
  468. .sp
  469. .nf
  470. .ft C
  471. {
  472. "enabled": [
  473. "beacon"
  474. ],
  475. "facilities": {
  476. "beacon": "Multicast and broadcast discovery",
  477. "config": "Configuration loading and saving",
  478. "connections": "Connection handling",
  479. "db": "The database layer",
  480. "dialer": "Dialing connections",
  481. "discover": "Remote device discovery",
  482. "events": "Event generation and logging",
  483. "http": "REST API",
  484. "main": "Main package",
  485. "model": "The root hub",
  486. "protocol": "The BEP protocol",
  487. "relay": "Relay connection handling",
  488. "scanner": "File change detection and hashing",
  489. "stats": "Persistent device and folder statistics",
  490. "sync": "Mutexes",
  491. "upgrade": "Binary upgrades",
  492. "upnp": "UPnP discovery and port mapping",
  493. "versioner": "File versioning"
  494. }
  495. }
  496. .ft P
  497. .fi
  498. .UNINDENT
  499. .UNINDENT
  500. .SS POST /rest/system/debug
  501. .sp
  502. New in version 0.12.0.
  503. .sp
  504. Enables or disables debugging for specified facilities. Give one or both of
  505. \fBenable\fP and \fBdisable\fP query parameters, with comma separated facility
  506. names. To disable debugging of the beacon and discovery packages, and enable it
  507. for config and db:
  508. .INDENT 0.0
  509. .INDENT 3.5
  510. .sp
  511. .nf
  512. .ft C
  513. $ curl \-H X\-API\-Key:abc123 \-X POST \(aqhttp://localhost:8384/rest/system/debug?disable=beacon,discovery&enable=config,db\(aq
  514. .ft P
  515. .fi
  516. .UNINDENT
  517. .UNINDENT
  518. .SS GET /rest/system/discovery
  519. .sp
  520. Returns the contents of the local discovery cache.
  521. .INDENT 0.0
  522. .INDENT 3.5
  523. .sp
  524. .nf
  525. .ft C
  526. {
  527. "LGFPDIT7SKNNJVJZA4FC7QNCRKCE753K72BW5QD2FOZ7FRFEP57Q": [
  528. "192.162.129.11:22000"
  529. ]
  530. }
  531. .ft P
  532. .fi
  533. .UNINDENT
  534. .UNINDENT
  535. .SS POST /rest/system/discovery
  536. .sp
  537. \fBNOTE:\fP
  538. .INDENT 0.0
  539. .INDENT 3.5
  540. Removed in v0.12.0.
  541. .UNINDENT
  542. .UNINDENT
  543. .sp
  544. Post with the query parameters \fBdevice\fP and \fBaddr\fP to add entries to
  545. the discovery cache.
  546. .INDENT 0.0
  547. .INDENT 3.5
  548. .sp
  549. .nf
  550. .ft C
  551. curl \-X POST http://127.0.0.1:8384/rest/system/discovery?device=LGFPDIT7SKNNJVJZA4FC7QNCRKCE753K72BW5QD2FOZ7FRFEP57Q\e&addr=192.162.129.11:22000
  552. # Or with the X\-API\-Key header:
  553. 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
  554. .ft P
  555. .fi
  556. .UNINDENT
  557. .UNINDENT
  558. .SS POST /rest/system/error/clear
  559. .sp
  560. Post with empty to body to remove all recent errors.
  561. .SS GET /rest/system/error
  562. .sp
  563. \fBNOTE:\fP
  564. .INDENT 0.0
  565. .INDENT 3.5
  566. Return format changed in 0.12.0.
  567. .UNINDENT
  568. .UNINDENT
  569. .sp
  570. Returns the list of recent errors.
  571. .INDENT 0.0
  572. .INDENT 3.5
  573. .sp
  574. .nf
  575. .ft C
  576. {
  577. "errors": [
  578. {
  579. "when": "2014\-09\-18T12:59:26.549953186+02:00",
  580. "message": "This is an error string"
  581. }
  582. ]
  583. }
  584. .ft P
  585. .fi
  586. .UNINDENT
  587. .UNINDENT
  588. .SS POST /rest/system/error
  589. .sp
  590. Post with an error message in the body (plain text) to register a new
  591. error. The new error will be displayed on any active GUI clients.
  592. .SS GET /rest/system/log
  593. .sp
  594. New in version 0.12.0.
  595. .sp
  596. Returns the list of recent log entries. The optional \fBsince\fP parameter limits
  597. the results to message newer than the given timestamp in \fI\%RFC 3339\fP <\fBhttps://datatracker.ietf.org/doc/html/rfc3339.html\fP> format.
  598. .INDENT 0.0
  599. .INDENT 3.5
  600. .sp
  601. .nf
  602. .ft C
  603. {
  604. "messages": [
  605. {
  606. "when": "2014\-09\-18T12:59:26.549953186+02:00",
  607. "message": "This is a log entry"
  608. }
  609. ]
  610. }
  611. .ft P
  612. .fi
  613. .UNINDENT
  614. .UNINDENT
  615. .SS GET /rest/system/log.txt
  616. .sp
  617. Returns the same information, formatted as a text log instead of a JSON object.
  618. .SS GET /rest/system/paths
  619. .sp
  620. New in version 1.21.0.
  621. .sp
  622. Returns the path locations used internally for storing configuration, database,
  623. and others.
  624. .INDENT 0.0
  625. .INDENT 3.5
  626. .sp
  627. .nf
  628. .ft C
  629. {
  630. "auditLog": "/home/user/.local/share/syncthing/audit\-${timestamp}.log",
  631. "baseDir\-config": "/home/user/.config/syncthing",
  632. "baseDir\-data": "/home/user/.local/share/syncthing",
  633. "baseDir\-userHome": "/home/user",
  634. "certFile": "/home/user/.config/syncthing/cert.pem",
  635. "config": "/home/user/.config/syncthing/config.xml",
  636. "csrfTokens": "/home/user/.config/syncthing/csrftokens.txt",
  637. "database": "/home/user/.local/share/syncthing/index\-v0.14.0.db",
  638. "defFolder": "/home/user/Sync",
  639. "guiAssets": "/home/user/src/syncthing/gui",
  640. "httpsCertFile": "/home/user/.config/syncthing/https\-cert.pem",
  641. "httpsKeyFile": "/home/user/.config/syncthing/https\-key.pem",
  642. "keyFile": "/home/user/.config/syncthing/key.pem",
  643. "logFile": "\-",
  644. "panicLog": "/home/user/.local/share/syncthing/panic\-${timestamp}.log"
  645. }
  646. .ft P
  647. .fi
  648. .UNINDENT
  649. .UNINDENT
  650. .SS POST /rest/system/pause
  651. .sp
  652. Pause the given device or all devices.
  653. .sp
  654. Takes the optional parameter \fBdevice\fP (device ID). When omitted,
  655. pauses all devices. Returns status 200 and no content upon success, or status
  656. 500 and a plain text error on failure.
  657. .SS GET /rest/system/ping
  658. .sp
  659. Returns a \fB{"ping": "pong"}\fP object.
  660. .INDENT 0.0
  661. .INDENT 3.5
  662. .sp
  663. .nf
  664. .ft C
  665. {
  666. "ping": "pong"
  667. }
  668. .ft P
  669. .fi
  670. .UNINDENT
  671. .UNINDENT
  672. .SS POST /rest/system/ping
  673. .sp
  674. Returns a \fB{"ping": "pong"}\fP object.
  675. .SS POST /rest/system/reset
  676. .sp
  677. Post with empty body to erase the current index database and restart
  678. Syncthing. With no query parameters, the entire database is erased from disk.
  679. By specifying the \fBfolder\fP parameter with a valid folder ID, only
  680. information for that folder will be erased:
  681. .INDENT 0.0
  682. .INDENT 3.5
  683. .sp
  684. .nf
  685. .ft C
  686. curl \-X POST \-H "X\-API\-Key: abc123" http://localhost:8384/rest/system/reset?folder=ab1c2\-def3g
  687. .ft P
  688. .fi
  689. .UNINDENT
  690. .UNINDENT
  691. .sp
  692. \fBCaution\fP: See \fB\-\-reset\-database\fP for \fB\&.stfolder\fP creation
  693. side\-effect and caution regarding mountpoints.
  694. .SS POST /rest/system/restart
  695. .sp
  696. Post with empty body to immediately restart Syncthing.
  697. .SS POST /rest/system/resume
  698. .sp
  699. Resume the given device or all devices.
  700. .sp
  701. Takes the optional parameter \fBdevice\fP (device ID). When omitted,
  702. resumes all devices. Returns status 200 and no content upon success, or status
  703. 500 and a plain text error on failure.
  704. .SS POST /rest/system/shutdown
  705. .sp
  706. Post with empty body to cause Syncthing to exit and not restart.
  707. .SS GET /rest/system/status
  708. .sp
  709. Returns information about current system status and resource usage. The CPU percent value has been deprecated from the API and will always report 0.
  710. .INDENT 0.0
  711. .INDENT 3.5
  712. .sp
  713. .nf
  714. .ft C
  715. {
  716. "alloc": 30618136,
  717. "connectionServiceStatus": {
  718. "dynamic+https://relays.syncthing.net/endpoint": {
  719. "error": null,
  720. "lanAddresses": [
  721. "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"
  722. ],
  723. "wanAddresses": [
  724. "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"
  725. ]
  726. },
  727. "tcp://0.0.0.0:22000": {
  728. "error": null,
  729. "lanAddresses": [
  730. "tcp://0.0.0.0:22000"
  731. ],
  732. "wanAddresses": [
  733. "tcp://0.0.0.0:22000"
  734. ]
  735. }
  736. },
  737. "cpuPercent": 0,
  738. "discoveryEnabled": true,
  739. "discoveryErrors": {
  740. "global@https://discovery\-v4\-1.syncthing.net/v2/": "500 Internal Server Error",
  741. "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)",
  742. "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)",
  743. "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",
  744. "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",
  745. "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"
  746. },
  747. "discoveryStatus": {
  748. "IPv4 local": {
  749. "error": null
  750. },
  751. "IPv6 local": {
  752. "error": null
  753. },
  754. "global@https://discovery\-v4\-1.syncthing.net/v2/": {
  755. "error": "500 Internal Server Error"
  756. },
  757. "global@https://discovery\-v4\-2.syncthing.net/v2/": {
  758. "error": "Post https://discovery\-v4\-2.syncthing.net/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
  759. },
  760. "global@https://discovery\-v4\-3.syncthing.net/v2/": {
  761. "error": "Post https://discovery\-v4\-3.syncthing.net/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
  762. },
  763. "global@https://discovery\-v6\-1.syncthing.net/v2/": {
  764. "error": "Post https://discovery\-v6\-1.syncthing.net/v2/: dial tcp [2001:470:28:4d6::5]:443: connect: no route to host"
  765. },
  766. "global@https://discovery\-v6\-2.syncthing.net/v2/": {
  767. "error": "Post https://discovery\-v6\-2.syncthing.net/v2/: dial tcp [2604:a880:800:10::182:a001]:443: connect: no route to host"
  768. },
  769. "global@https://discovery\-v6\-3.syncthing.net/v2/": {
  770. "error": "Post https://discovery\-v6\-3.syncthing.net/v2/: dial tcp [2400:6180:0:d0::d9:d001]:443: connect: no route to host"
  771. }
  772. },
  773. "discoveryMethods": 8,
  774. "goroutines": 49,
  775. "lastDialStatus": {
  776. "tcp://10.20.30.40": {
  777. "when": "2019\-05\-16T07:41:23Z",
  778. "error": "dial tcp 10.20.30.40:22000: i/o timeout"
  779. },
  780. "tcp://172.16.33.3:22000": {
  781. "when": "2019\-05\-16T07:40:43Z",
  782. "ok": true
  783. },
  784. "tcp://83.233.120.221:22000": {
  785. "when": "2019\-05\-16T07:41:13Z",
  786. "error": "dial tcp 83.233.120.221:22000: connect: connection refused"
  787. }
  788. },
  789. "myID": "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2",
  790. "pathSeparator": "/",
  791. "startTime": "2016\-06\-06T19:41:43.039284753+02:00",
  792. "sys": 42092792,
  793. "themes": [
  794. "default",
  795. "dark"
  796. ],
  797. "tilde": "/Users/jb",
  798. "uptime": 2635
  799. }
  800. .ft P
  801. .fi
  802. .UNINDENT
  803. .UNINDENT
  804. .sp
  805. New in version 1.2.0: The \fBlastDialStatus\fP dictionary contains the last error (or \fBnull\fP for
  806. success) for each peer address that Syncthing has attempted to contact.
  807. The \fBconnectionServiceStatus\fP entries gained \fB"error": null\fP
  808. attributes where previously there would be no \fBerror\fP attribute at all
  809. in the success case.
  810. .sp
  811. New in version 1.18.0: The \fBdiscoveryStatus\fP dictionary lists all configured discovery methods, not
  812. only failed ones like the now deprecated \fBdiscoveryErrors\fP\&. Each entry is
  813. an object itself (for consistency with other fields), where a \fBnull\fP value
  814. for the \fBerror\fP attribute means the method is running successfully. This
  815. effectively deprecates the \fBdiscoveryMethods\fP attribute as well, which now
  816. always matches the number of entries in \fBdiscoveryStatus\fP\&.
  817. .SS GET /rest/system/upgrade
  818. .sp
  819. Checks for a possible upgrade and returns an object describing the
  820. newest version and upgrade possibility.
  821. .INDENT 0.0
  822. .INDENT 3.5
  823. .sp
  824. .nf
  825. .ft C
  826. {
  827. "latest": "v0.14.47",
  828. "majorNewer": false,
  829. "newer": true,
  830. "running": "v0.14.46"
  831. }
  832. .ft P
  833. .fi
  834. .UNINDENT
  835. .UNINDENT
  836. .SS POST /rest/system/upgrade
  837. .sp
  838. Perform an upgrade to the newest released version and restart. Does
  839. nothing if there is no newer version than currently running.
  840. .SS GET /rest/system/version
  841. .sp
  842. Returns the current Syncthing version information.
  843. .INDENT 0.0
  844. .INDENT 3.5
  845. .sp
  846. .nf
  847. .ft C
  848. {
  849. "arch": "amd64",
  850. "longVersion": "syncthing v0.10.27+3\-gea8c3de (go1.4 darwin\-amd64 default) jb@syno 2015\-03\-16 11:01:29 UTC",
  851. "os": "darwin",
  852. "version": "v0.10.27+3\-gea8c3de"
  853. }
  854. .ft P
  855. .fi
  856. .UNINDENT
  857. .UNINDENT
  858. .SH CONFIG ENDPOINTS
  859. .SS Config Endpoints
  860. .sp
  861. New in version 1.12.0.
  862. .sp
  863. These endpoints facilitate access and modification of the configuration in a granular way. Config sent to the endpoints must be in the
  864. same format as returned by the corresponding GET request. When posting the
  865. configuration succeeds, the posted configuration is immediately applied, except
  866. for changes that require a restart. Query \fI\%/rest/config/restart\-required\fP to check if
  867. a restart is required.
  868. .sp
  869. For all endpoints supporting \fBPATCH\fP, it takes the existing config and
  870. unmarshals the given JSON object on top of it. This means all child objects will
  871. replace the existing objects, not extend them. For example for
  872. \fBRawListenAddresses\fP in options, which is an array of strings, sending
  873. \fB{RawListenAddresses: ["tcp://10.0.0.2"]}\fP will replace all existing listen
  874. addresses.
  875. .SS /rest/config
  876. .sp
  877. \fBGET\fP returns the entire config and \fBPUT\fP replaces it.
  878. .SS /rest/config/restart\-required
  879. .sp
  880. \fBGET\fP returns whether a restart of Syncthing is required for the current
  881. config to take effect.
  882. .SS /rest/config/folders, /rest/config/devices
  883. .sp
  884. \fBGET\fP returns all folders respectively devices as an array. \fBPUT\fP takes an array and
  885. \fBPOST\fP a single object. In both cases if a given folder/device already exists,
  886. it’s replaced, otherwise a new one is added.
  887. .SS /rest/config/folders/*id*, /rest/config/devices/*id*
  888. .sp
  889. Put the desired folder\- respectively device\-ID in place of *id*. \fBGET\fP
  890. returns the folder/device for the given ID, \fBPUT\fP replaces the entire config,
  891. \fBPATCH\fP replaces only the given child objects and \fBDELETE\fP removes the
  892. folder/device.
  893. .SS /rest/config/defaults/folder, /rest/config/defaults/device
  894. .sp
  895. \fBGET\fP returns a template folder / device configuration object with all default
  896. values, which only needs a unique ID to be applied. \fBPUT\fP replaces the
  897. default config (omitted values are reset to the hard\-coded defaults), \fBPATCH\fP
  898. replaces only the given child objects.
  899. .SS /rest/config/defaults/ignores
  900. .sp
  901. New in version 1.19.0.
  902. .sp
  903. \fBGET\fP returns an object with a single \fBlines\fP attribute listing ignore
  904. patterns to be used by default on folders, as an array of single\-line strings.
  905. \fBPUT\fP replaces the default ignore patterns from an object of the same format.
  906. .SS /rest/config/options, /rest/config/ldap, /rest/config/gui
  907. .sp
  908. \fBGET\fP returns the respective object, \fBPUT\fP replaces the entire object and
  909. \fBPATCH\fP replaces only the given child objects.
  910. .SH CLUSTER ENDPOINTS
  911. .sp
  912. Concerns the mesh network structure.
  913. .SS DELETE /rest/cluster/pending/devices
  914. .sp
  915. New in version 1.18.0.
  916. .sp
  917. Remove records about a pending remote device which tried to connect. Valid
  918. values for the \fBdevice\fP parameter are those from the corresponding
  919. cluster\-pending\-devices\-get endpoint.
  920. .INDENT 0.0
  921. .INDENT 3.5
  922. .sp
  923. .nf
  924. .ft C
  925. $ curl \-X DELETE \-H "X\-API\-Key: abc123" http://localhost:8384/rest/cluster/pending/devices?device=P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2
  926. .ft P
  927. .fi
  928. .UNINDENT
  929. .UNINDENT
  930. .sp
  931. Returns status 200 and no content upon success, or status 500 and a
  932. plain text error on failure. A /events/pendingdeviceschanged
  933. event will be generated in response.
  934. .sp
  935. For a more permanent effect, also for future connections from the same
  936. device ID, the device should be ignored in the configuration instead.
  937. .SS GET /rest/cluster/pending/devices
  938. .sp
  939. New in version 1.13.0.
  940. .sp
  941. Lists remote devices which have tried to connect, but are not yet
  942. configured in our instance.
  943. .INDENT 0.0
  944. .INDENT 3.5
  945. .sp
  946. .nf
  947. .ft C
  948. {
  949. "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2": {
  950. "time": "2020\-03\-18T11:43:07Z",
  951. "name": "Friend Joe",
  952. "address": "192.168.1.2:22000"
  953. }
  954. }
  955. .ft P
  956. .fi
  957. .UNINDENT
  958. .UNINDENT
  959. .SS DELETE /rest/cluster/pending/folders
  960. .sp
  961. New in version 1.18.0.
  962. .sp
  963. Remove records about a pending folder announced from a remote device. Valid
  964. values for the \fBfolder\fP and \fBdevice\fP parameters are those from the
  965. corresponding cluster\-pending\-folders\-get endpoint. The \fBdevice\fP
  966. parameter is optional and affects announcements of this folder from the given
  967. device, or from \fIany\fP device if omitted.
  968. .INDENT 0.0
  969. .INDENT 3.5
  970. .sp
  971. .nf
  972. .ft C
  973. $ curl \-X DELETE \-H "X\-API\-Key: abc123" http://localhost:8384/rest/cluster/pending/folders?folder=cpkn4\-57ysy&device=P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2
  974. .ft P
  975. .fi
  976. .UNINDENT
  977. .UNINDENT
  978. .sp
  979. Returns status 200 and no content upon success, or status 500 and a plain text
  980. error on failure. A /events/pendingfolderschanged event will be
  981. generated in response.
  982. .sp
  983. For a more permanent effect, also for future announcements of the same folder
  984. ID, the folder should be ignored in the configuration
  985. instead.
  986. .SS GET /rest/cluster/pending/folders
  987. .sp
  988. New in version 1.13.0.
  989. .sp
  990. Lists folders which remote devices have offered to us, but are not yet
  991. shared from our instance to them. Takes the optional \fBdevice\fP
  992. parameter to only return folders offered by a specific remote device.
  993. Other offering devices are also omitted from the result.
  994. .INDENT 0.0
  995. .INDENT 3.5
  996. .sp
  997. .nf
  998. .ft C
  999. {
  1000. "cpkn4\-57ysy": {
  1001. "offeredBy": {
  1002. "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2": {
  1003. "time": "2020\-03\-18T11:43:07Z",
  1004. "label": "Joe\(aqs folder",
  1005. "receiveEncrypted": true,
  1006. "remoteEncrypted": false
  1007. },
  1008. "DOVII4U\-SQEEESM\-VZ2CVTC\-CJM4YN5\-QNV7DCU\-5U3ASRL\-YVFG6TH\-W5DV5AA": {
  1009. "time": "2020\-03\-01T10:12:13Z",
  1010. "label": "Jane\(aqs and Joe\(aqs folder",
  1011. "receiveEncrypted": false,
  1012. "remoteEncrypted": false
  1013. }
  1014. }
  1015. },
  1016. "abcde\-fghij": {
  1017. "offeredBy": {
  1018. "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2": {
  1019. "time": "2020\-03\-18T11:43:07Z",
  1020. "label": "MyPics",
  1021. "receiveEncrypted": false,
  1022. "remoteEncrypted": false
  1023. }
  1024. }
  1025. }
  1026. }
  1027. .ft P
  1028. .fi
  1029. .UNINDENT
  1030. .UNINDENT
  1031. .SH FOLDER ENDPOINTS
  1032. .sp
  1033. Runtime state of the individual shared folders.
  1034. .SS GET /rest/folder/errors
  1035. .sp
  1036. New in version 0.14.53.
  1037. .sp
  1038. Takes one mandatory parameter, \fBfolder\fP, and returns the list of errors
  1039. encountered during scanning or pulling.
  1040. .sp
  1041. The results can be paginated using the common pagination parameters\&.
  1042. .INDENT 0.0
  1043. .INDENT 3.5
  1044. .sp
  1045. .nf
  1046. .ft C
  1047. {
  1048. "folder": "nnhic\-sxuae",
  1049. "errors": [
  1050. {
  1051. "path": "noperm.txt",
  1052. "error": "hashing: open /path/to/folder/noperm.txt: permission denied"
  1053. }
  1054. ],
  1055. "page": 1,
  1056. "perpage": 100
  1057. }
  1058. .ft P
  1059. .fi
  1060. .UNINDENT
  1061. .UNINDENT
  1062. .SS GET /rest/folder/pullerrors (DEPRECATED)
  1063. .sp
  1064. Deprecated since version v0.14.53: This endpoint still works as before but is deprecated. Use
  1065. folder\-errors\-get instead, which returns the same information.
  1066. .sp
  1067. See \fI\%d510e3cca3d5caae42121fa206b3decc981ae59e\fP <\fBhttps://github.com/syncthing/syncthing/commit/d510e3cca3d5caae42121fa206b3decc981ae59e\fP>
  1068. .SS GET /rest/folder/versions
  1069. .sp
  1070. New in version 0.14.44.
  1071. .sp
  1072. Takes one mandatory parameter, \fBfolder\fP, and returns the list of archived
  1073. files that could be recovered. How many versions are available depends on the
  1074. /users/versioning configuration. Each entry specifies when the file
  1075. version was archived as the \fBversionTime\fP, the \fBmodTime\fP when it was last
  1076. modified before being archived, and the size in bytes.
  1077. .INDENT 0.0
  1078. .INDENT 3.5
  1079. .sp
  1080. .nf
  1081. .ft C
  1082. {
  1083. "dir1/dir2/bar": [
  1084. {
  1085. "versionTime": "2022\-02\-06T20:44:12+01:00",
  1086. "modTime": "2021\-01\-14T13:21:22+01:00",
  1087. "size": 4
  1088. }
  1089. ],
  1090. "baz": [
  1091. {
  1092. "versionTime": "2022\-02\-06T20:44:20+01:00",
  1093. "modTime": "2021\-01\-14T13:23:49+01:00",
  1094. "size": 4
  1095. }
  1096. ],
  1097. "foo": [
  1098. {
  1099. "versionTime": "2022\-02\-06T20:55:31+01:00",
  1100. "modTime": "2022\-02\-06T20:44:13+01:00",
  1101. "size": 4
  1102. },
  1103. {
  1104. "versionTime": "2022\-02\-06T20:44:20+01:00",
  1105. "modTime": "2021\-01\-14T13:21:16+01:00",
  1106. "size": 4
  1107. }
  1108. ]
  1109. }
  1110. .ft P
  1111. .fi
  1112. .UNINDENT
  1113. .UNINDENT
  1114. .SS POST /rest/folder/versions
  1115. .sp
  1116. Restore archived versions of a given set of files. Expects an object with
  1117. attributes named after the relative file paths, with timestamps as values
  1118. matching valid \fBversionTime\fP entries in the corresponding
  1119. folder\-versions\-get response object.
  1120. .sp
  1121. Takes the mandatory parameter \fBfolder\fP (folder ID). Returns an object
  1122. containing any error messages that occurred during restoration of the file, with
  1123. the file path as attribute name.
  1124. .INDENT 0.0
  1125. .INDENT 3.5
  1126. .sp
  1127. .nf
  1128. .ft C
  1129. curl \-X POST \-H X\-API\-key:... http://127.0.0.1:8384/rest/folder/versions?folder=default \-d \(aq{
  1130. "dir1/dir2/bar": "2022\-02\-06T20:44:12+01:00",
  1131. "baz": "2022\-02\-06T20:44:20+01:00"
  1132. }\(aq
  1133. .ft P
  1134. .fi
  1135. .UNINDENT
  1136. .UNINDENT
  1137. .SH DATABASE ENDPOINTS
  1138. .SS GET /rest/db/browse
  1139. .sp
  1140. Returns the directory tree of the global model. Directories are always
  1141. JSON objects (map/dictionary), and files are always arrays of
  1142. modification time and size. The first integer is the files modification
  1143. time, and the second integer is the file size.
  1144. .sp
  1145. The call takes one mandatory \fBfolder\fP parameter and two optional
  1146. parameters. Optional parameter \fBlevels\fP defines how deep within the
  1147. tree we want to dwell down (0 based, defaults to unlimited depth)
  1148. Optional parameter \fBprefix\fP defines a prefix within the tree where to
  1149. start building the structure.
  1150. .INDENT 0.0
  1151. .INDENT 3.5
  1152. .sp
  1153. .nf
  1154. .ft C
  1155. $ curl \-s http://localhost:8384/rest/db/browse?folder=j663y\-3ct3e&prefix=DCIM&levels=2
  1156. [
  1157. {
  1158. "modTime" : "2020\-10\-02T23:48:52.076996974+02:00",
  1159. "name" : "100ANDRO",
  1160. "size" : 128,
  1161. "type" : "FILE_INFO_TYPE_DIRECTORY"
  1162. },
  1163. {
  1164. "children" : [
  1165. {
  1166. "modTime" : "2020\-12\-16T23:31:34.5009668+01:00",
  1167. "name" : "IMG_20201114_124821.jpg",
  1168. "size" : 10682189,
  1169. "type" : "FILE_INFO_TYPE_FILE"
  1170. },
  1171. {
  1172. "modTime" : "2020\-12\-16T23:31:35.0106367+01:00",
  1173. "name" : "IMG_20201213_122451.jpg",
  1174. "size" : 7936351,
  1175. "type" : "FILE_INFO_TYPE_FILE"
  1176. },
  1177. {
  1178. "modTime" : "2020\-12\-13T12:25:05.017097469+01:00",
  1179. "name" : "IMG_20201213_122504.jpg",
  1180. "size" : 8406507,
  1181. "type" : "FILE_INFO_TYPE_FILE"
  1182. },
  1183. {
  1184. "modTime" : "2020\-12\-13T12:25:06.127097469+01:00",
  1185. "name" : "IMG_20201213_122505.jpg",
  1186. "size" : 8381931,
  1187. "type" : "FILE_INFO_TYPE_FILE"
  1188. },
  1189. {
  1190. "modTime" : "2020\-12\-13T12:53:29.707298401+01:00",
  1191. "name" : "IMG_20201213_125329.jpg",
  1192. "size" : 4388331,
  1193. "type" : "FILE_INFO_TYPE_FILE"
  1194. },
  1195. ],
  1196. "modTime" : "2020\-10\-09T13:04:42.4410738+02:00",
  1197. "name" : "Camera",
  1198. "size" : 128,
  1199. "type" : "FILE_INFO_TYPE_DIRECTORY"
  1200. },
  1201. ]
  1202. .ft P
  1203. .fi
  1204. .UNINDENT
  1205. .UNINDENT
  1206. .sp
  1207. \fBNOTE:\fP
  1208. .INDENT 0.0
  1209. .INDENT 3.5
  1210. This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
  1211. .UNINDENT
  1212. .UNINDENT
  1213. .SS GET /rest/db/completion
  1214. .sp
  1215. Returns the completion percentage (0 to 100) and byte / item counts. Takes
  1216. optional \fBdevice\fP and \fBfolder\fP parameters:
  1217. .INDENT 0.0
  1218. .IP \(bu 2
  1219. \fBfolder\fP specifies the folder ID to calculate completion for. An empty
  1220. or absent \fBfolder\fP parameter means all folders as an aggregate.
  1221. .IP \(bu 2
  1222. \fBdevice\fP specifies the device ID to calculate completion for. An empty
  1223. or absent \fBdevice\fP parameter means the local device.
  1224. .UNINDENT
  1225. .sp
  1226. If a device is specified but no folder, completion is calculated for all
  1227. folders shared with that device.
  1228. .SS Example Queries
  1229. .sp
  1230. Completion status for folder \fBabcd\-1234\fP on device \fBI6KAH76\-...\-3PSROAU\fP:
  1231. .INDENT 0.0
  1232. .INDENT 3.5
  1233. .sp
  1234. .nf
  1235. .ft C
  1236. /rest/db/completion?folder=abcd\-1234&device=I6KAH76\-...\-3PSROAU
  1237. .ft P
  1238. .fi
  1239. .UNINDENT
  1240. .UNINDENT
  1241. .sp
  1242. Aggregated completion status for device \fBI6KAH76\-...\-3PSROAU\fP (all folders shared with them):
  1243. .INDENT 0.0
  1244. .INDENT 3.5
  1245. .sp
  1246. .nf
  1247. .ft C
  1248. /rest/db/completion?device=I6KAH76\-...\-3PSROAU
  1249. .ft P
  1250. .fi
  1251. .UNINDENT
  1252. .UNINDENT
  1253. .sp
  1254. Completion status for folder \fBabcd\-1234\fP on the local device:
  1255. .INDENT 0.0
  1256. .INDENT 3.5
  1257. .sp
  1258. .nf
  1259. .ft C
  1260. /rest/db/completion?folder=abcd\-1234
  1261. .ft P
  1262. .fi
  1263. .UNINDENT
  1264. .UNINDENT
  1265. .sp
  1266. Aggregated completion status for all folders on the local device:
  1267. .INDENT 0.0
  1268. .INDENT 3.5
  1269. .sp
  1270. .nf
  1271. .ft C
  1272. /rest/db/completion
  1273. .ft P
  1274. .fi
  1275. .UNINDENT
  1276. .UNINDENT
  1277. .SS Example Response
  1278. .INDENT 0.0
  1279. .INDENT 3.5
  1280. .sp
  1281. .nf
  1282. .ft C
  1283. {
  1284. "completion": 99.9937565835,
  1285. "globalBytes": 156793013575,
  1286. "needBytes": 9789241,
  1287. "globalItems": 7823,
  1288. "needItems": 412,
  1289. "needDeletes": 0,
  1290. "remoteState": "valid",
  1291. "sequence": 12
  1292. }
  1293. .ft P
  1294. .fi
  1295. .UNINDENT
  1296. .UNINDENT
  1297. .sp
  1298. New in version 1.8.0: The ability to aggregate multiple folders by leaving out the folder ID.
  1299. Querying data for the local device by leaving out the device ID. Returning
  1300. the \fBglobalItems\fP counter in the response.
  1301. .sp
  1302. New in version 1.20.0: Indication whether the remote device has accepted the folder (shares it with
  1303. us) as well, and whether it is paused. The \fBremoteState\fP field is
  1304. meaningless for aggregated responses, \fBunknown\fP when the remote device is
  1305. not connected. Otherwise it can be either \fBpaused\fP, \fBnotSharing\fP, or
  1306. \fBvalid\fP if the remote is sharing back.
  1307. .SS GET /rest/db/file
  1308. .sp
  1309. Returns most data available about a given file, including version and
  1310. availability. Takes \fBfolder\fP and \fBfile\fP parameters.
  1311. .INDENT 0.0
  1312. .INDENT 3.5
  1313. .sp
  1314. .nf
  1315. .ft C
  1316. {
  1317. "availability": [
  1318. {
  1319. "id": "ITZRNXE\-YNROGBZ\-HXTH5P7\-VK5NYE5\-QHRQGE2\-7JQ6VNJ\-KZUEDIU\-5PPR5AM",
  1320. "fromTemporary": false
  1321. }
  1322. ],
  1323. "global": {
  1324. "deleted": false,
  1325. "ignored": false,
  1326. "invalid": false,
  1327. "localFlags": 0,
  1328. "modified": "2018\-08\-18T12:21:13.836784059+02:00",
  1329. "modifiedBy": "SYNO4VL",
  1330. "mustRescan": false,
  1331. "name": "testfile",
  1332. "noPermissions": false,
  1333. "numBlocks": 1,
  1334. "permissions": "0755",
  1335. "sequence": 107499,
  1336. "size": 1234,
  1337. "type": 0,
  1338. "version": [
  1339. "SYNO4VL:1"
  1340. ]
  1341. },
  1342. "local": {
  1343. "deleted": false,
  1344. "ignored": false,
  1345. "invalid": false,
  1346. "localFlags": 0,
  1347. "modified": "2018\-08\-18T12:21:13.836784059+02:00",
  1348. "modifiedBy": "SYNO4VL",
  1349. "mustRescan": false,
  1350. "name": "testfile",
  1351. "noPermissions": false,
  1352. "numBlocks": 1,
  1353. "permissions": "0755",
  1354. "sequence": 111038,
  1355. "size": 1234,
  1356. "type": 0,
  1357. "version": [
  1358. "SYNO4VL:1"
  1359. ]
  1360. }
  1361. }
  1362. .ft P
  1363. .fi
  1364. .UNINDENT
  1365. .UNINDENT
  1366. .SS GET /rest/db/ignores
  1367. .sp
  1368. Takes one parameter, \fBfolder\fP, and returns the content of the
  1369. \fB\&.stignore\fP as the \fBignore\fP field. A second field, \fBexpanded\fP,
  1370. 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.
  1371. .INDENT 0.0
  1372. .INDENT 3.5
  1373. .sp
  1374. .nf
  1375. .ft C
  1376. {
  1377. "ignore": [
  1378. "(?i)/Backups"
  1379. ],
  1380. "expanded": [
  1381. "(?i)Backups",
  1382. "(?i)Backups/**"
  1383. ]
  1384. }
  1385. .ft P
  1386. .fi
  1387. .UNINDENT
  1388. .UNINDENT
  1389. .SS POST /rest/db/ignores
  1390. .sp
  1391. Expects a format similar to the output of db\-ignores\-get call, but only
  1392. containing the \fBignore\fP field (\fBexpanded\fP field should be omitted).
  1393. It takes one parameter, \fBfolder\fP, and either updates the content of
  1394. the \fB\&.stignore\fP echoing it back as a response, or returns an error.
  1395. .SS GET /rest/db/localchanged
  1396. .sp
  1397. New in version 0.14.55.
  1398. .sp
  1399. Takes one mandatory parameter, \fBfolder\fP, and returns the list of files which
  1400. were changed locally in a receive\-only folder. Thus they differ from the global
  1401. state and could be reverted by pulling from remote devices again, see
  1402. db\-revert\-post\&.
  1403. .sp
  1404. The results can be paginated using the common pagination parameters\&.
  1405. .INDENT 0.0
  1406. .INDENT 3.5
  1407. .sp
  1408. .nf
  1409. .ft C
  1410. {
  1411. "files": [
  1412. {
  1413. "flags": "0755",
  1414. "sequence": 6,
  1415. "modified": "2015\-04\-20T23:06:12+09:00",
  1416. "name": "ls",
  1417. "size": 34640,
  1418. "version": [
  1419. "5157751870738175669:1"
  1420. ]
  1421. }
  1422. ],
  1423. "page": 1,
  1424. "perpage": 100
  1425. }
  1426. .ft P
  1427. .fi
  1428. .UNINDENT
  1429. .UNINDENT
  1430. .sp
  1431. \fBNOTE:\fP
  1432. .INDENT 0.0
  1433. .INDENT 3.5
  1434. This is an expensive call, increasing CPU and RAM usage on the device.
  1435. Use sparingly.
  1436. .UNINDENT
  1437. .UNINDENT
  1438. .SS GET /rest/db/need
  1439. .sp
  1440. Takes one mandatory parameter, \fBfolder\fP, and returns lists of files which are
  1441. needed by this device in order for it to become in sync.
  1442. .sp
  1443. The results can be paginated using the common pagination parameters\&. Pagination happens, across the union of all needed files,
  1444. that is \- across all 3 sections of the response. For example, given the current
  1445. need state is as follows:
  1446. .INDENT 0.0
  1447. .IP 1. 3
  1448. \fBprogress\fP has 15 items
  1449. .IP 2. 3
  1450. \fBqueued\fP has 3 items
  1451. .IP 3. 3
  1452. \fBrest\fP has 12 items
  1453. .UNINDENT
  1454. .sp
  1455. If you issue a query with \fBpage=1\fP and \fBperpage=10\fP, only the \fBprogress\fP
  1456. section in the response will have 10 items. If you issue a request query with
  1457. \fBpage=2\fP and \fBperpage=10\fP, \fBprogress\fP section will have the last 5 items,
  1458. \fBqueued\fP section will have all 3 items, and \fBrest\fP section will have first
  1459. 2 items. If you issue a query for \fBpage=3\fP and \fBperpage=10\fP, you will only
  1460. have the last 10 items of the \fBrest\fP section.
  1461. .sp
  1462. \fBNOTE:\fP
  1463. .INDENT 0.0
  1464. .INDENT 3.5
  1465. Return format changed in version 0.14.43, removing the \fBtotal\fP count
  1466. attribute.
  1467. .UNINDENT
  1468. .UNINDENT
  1469. .INDENT 0.0
  1470. .INDENT 3.5
  1471. .sp
  1472. .nf
  1473. .ft C
  1474. {
  1475. # Files currently being downloaded
  1476. "progress": [
  1477. {
  1478. "flags": "0755",
  1479. "sequence": 6,
  1480. "modified": "2015\-04\-20T23:06:12+09:00",
  1481. "name": "ls",
  1482. "size": 34640,
  1483. "version": [
  1484. "5157751870738175669:1"
  1485. ]
  1486. }
  1487. ],
  1488. # Files queued to be downloaded next (as per array order)
  1489. "queued": [
  1490. ...
  1491. ],
  1492. # Files to be downloaded after all queued files will be downloaded.
  1493. # This happens when we start downloading files, and new files get added while we are downloading.
  1494. "rest": [
  1495. ...
  1496. ],
  1497. "page": 1,
  1498. "perpage": 100
  1499. }
  1500. .ft P
  1501. .fi
  1502. .UNINDENT
  1503. .UNINDENT
  1504. .sp
  1505. \fBNOTE:\fP
  1506. .INDENT 0.0
  1507. .INDENT 3.5
  1508. This is an expensive call, increasing CPU and RAM usage on the device.
  1509. Use sparingly.
  1510. .UNINDENT
  1511. .UNINDENT
  1512. .SS POST /rest/db/override
  1513. .sp
  1514. Request override of a send only folder. Override means to make the local
  1515. version latest, overriding changes made on other devices. This API call does
  1516. nothing if the folder is not a send only folder.
  1517. .sp
  1518. Takes the mandatory parameter \fIfolder\fP (folder ID).
  1519. .INDENT 0.0
  1520. .INDENT 3.5
  1521. .sp
  1522. .nf
  1523. .ft C
  1524. curl \-X POST \-H X\-API\-key:... http://127.0.0.1:8384/rest/db/override?folder=default
  1525. .ft P
  1526. .fi
  1527. .UNINDENT
  1528. .UNINDENT
  1529. .SS POST /rest/db/prio
  1530. .sp
  1531. Moves the file to the top of the download queue.
  1532. .INDENT 0.0
  1533. .INDENT 3.5
  1534. .sp
  1535. .nf
  1536. .ft C
  1537. curl \-X POST http://127.0.0.1:8384/rest/db/prio?folder=default&file=foo/bar
  1538. .ft P
  1539. .fi
  1540. .UNINDENT
  1541. .UNINDENT
  1542. .sp
  1543. Response contains the same output as db\-need\-get\&.
  1544. .SS GET /rest/db/remoteneed
  1545. .sp
  1546. New in version 0.14.43.
  1547. .sp
  1548. Takes the mandatory parameters \fBfolder\fP and \fBdevice\fP, and returns the list
  1549. of files which are needed by that remote device in order for it to become in
  1550. sync with the shared folder.
  1551. .sp
  1552. The results can be paginated using the common pagination parameters\&.
  1553. .INDENT 0.0
  1554. .INDENT 3.5
  1555. .sp
  1556. .nf
  1557. .ft C
  1558. {
  1559. "files": [
  1560. {
  1561. "flags": "0755",
  1562. "sequence": 6,
  1563. "modified": "2015\-04\-20T23:06:12+09:00",
  1564. "name": "ls",
  1565. "size": 34640,
  1566. "version": [
  1567. "5157751870738175669:1"
  1568. ]
  1569. }
  1570. ],
  1571. "page": 1,
  1572. "perpage": 100
  1573. }
  1574. .ft P
  1575. .fi
  1576. .UNINDENT
  1577. .UNINDENT
  1578. .sp
  1579. \fBNOTE:\fP
  1580. .INDENT 0.0
  1581. .INDENT 3.5
  1582. This is an expensive call, increasing CPU and RAM usage on the device.
  1583. Use sparingly.
  1584. .UNINDENT
  1585. .UNINDENT
  1586. .SS POST /rest/db/revert
  1587. .sp
  1588. New in version 0.14.50.
  1589. .sp
  1590. Request revert of a receive only folder. Reverting a folder means to undo
  1591. all local changes. This API call does nothing if the folder is not a receive
  1592. only folder.
  1593. .sp
  1594. Takes the mandatory parameter \fIfolder\fP (folder ID).
  1595. .INDENT 0.0
  1596. .INDENT 3.5
  1597. .sp
  1598. .nf
  1599. .ft C
  1600. curl \-X POST \-H X\-API\-Key:... http://127.0.0.1:8384/rest/db/revert?folder=default
  1601. .ft P
  1602. .fi
  1603. .UNINDENT
  1604. .UNINDENT
  1605. .SS POST /rest/db/scan
  1606. .sp
  1607. Request immediate scan. Takes the optional parameters \fBfolder\fP (folder ID),
  1608. \fBsub\fP (path relative to the folder root) and \fBnext\fP (time in seconds). If
  1609. \fBfolder\fP is omitted or empty all folders are scanned. If \fBsub\fP is given,
  1610. only this path (and children, in case it’s a directory) is scanned. The \fBnext\fP
  1611. argument delays Syncthing’s automated rescan interval for a given amount of
  1612. seconds.
  1613. .sp
  1614. Requesting scan of a path that no longer exists, but previously did, is
  1615. valid and will result in Syncthing noticing the deletion of the path in
  1616. question.
  1617. .sp
  1618. Returns status 200 and no content upon success, or status 500 and a
  1619. plain text error if an error occurred during scanning.
  1620. .INDENT 0.0
  1621. .INDENT 3.5
  1622. .sp
  1623. .nf
  1624. .ft C
  1625. curl \-X POST http://127.0.0.1:8384/rest/db/scan?folder=default&sub=foo/bar
  1626. .ft P
  1627. .fi
  1628. .UNINDENT
  1629. .UNINDENT
  1630. .SS GET /rest/db/status
  1631. .sp
  1632. Returns information about the current status of a folder.
  1633. .sp
  1634. Parameters: \fBfolder\fP, the ID of a folder.
  1635. .INDENT 0.0
  1636. .INDENT 3.5
  1637. .sp
  1638. .nf
  1639. .ft C
  1640. {
  1641. "globalBytes": 0,
  1642. "globalDeleted": 0,
  1643. "globalDirectories": 0,
  1644. "globalFiles": 0,
  1645. "globalSymlinks": 0,
  1646. "globalTotalItems": 0,
  1647. "ignorePatterns": false,
  1648. "inSyncBytes": 0,
  1649. "inSyncFiles": 0,
  1650. "invalid": "",
  1651. "localBytes": 0,
  1652. "localDeleted": 0,
  1653. "localDirectories": 0,
  1654. "localFiles": 0,
  1655. "localSymlinks": 0,
  1656. "localTotalItems": 0,
  1657. "needBytes": 0,
  1658. "needDeletes": 0,
  1659. "needDirectories": 0,
  1660. "needFiles": 0,
  1661. "needSymlinks": 0,
  1662. "needTotalItems": 0,
  1663. "pullErrors": 0,
  1664. "receiveOnlyChangedBytes": 0,
  1665. "receiveOnlyChangedDeletes": 0,
  1666. "receiveOnlyChangedDirectories": 0,
  1667. "receiveOnlyChangedFiles": 0,
  1668. "receiveOnlyChangedSymlinks": 0,
  1669. "receiveOnlyTotalItems": 0,
  1670. "sequence": 0,
  1671. "state": "idle",
  1672. "stateChanged": "2018\-08\-08T07:04:57.301064781+02:00",
  1673. "version": 0
  1674. }
  1675. .ft P
  1676. .fi
  1677. .UNINDENT
  1678. .UNINDENT
  1679. .sp
  1680. The various fields have the following meaning:
  1681. .INDENT 0.0
  1682. .TP
  1683. .B global*:
  1684. Data in the cluster latest version.
  1685. .TP
  1686. .B inSync*:
  1687. Data that is locally the same as the cluster latest version.
  1688. .TP
  1689. .B local*:
  1690. Data that is locally present, regardless of whether it’s the same or different version as the cluster latest version.
  1691. .TP
  1692. .B need*:
  1693. Data that is needed to become up to date with the cluster latest version (i.e., data that is out of sync).
  1694. .TP
  1695. .B receiveOnlyChanged*:
  1696. Data that has changed locally in a receive only folder, and thus not been sent to the cluster.
  1697. .TP
  1698. .B invalid:
  1699. Deprecated, always empty.
  1700. .TP
  1701. .B pullErrors:
  1702. The number of files that failed to sync during the last sync operations.
  1703. .TP
  1704. .B sequence:
  1705. The current folder sequence number.
  1706. .TP
  1707. .B state:
  1708. The current folder state.
  1709. .TP
  1710. .B stateChanged:
  1711. When the folder state last changed.
  1712. .TP
  1713. .B version:
  1714. Deprecated, equivalent to the sequence number.
  1715. .UNINDENT
  1716. .sp
  1717. \fBNOTE:\fP
  1718. .INDENT 0.0
  1719. .INDENT 3.5
  1720. This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
  1721. .UNINDENT
  1722. .UNINDENT
  1723. .SH EVENT ENDPOINTS
  1724. .SS GET /rest/events
  1725. .sp
  1726. To receive events, perform a HTTP GET of \fB/rest/events\fP\&.
  1727. .sp
  1728. To filter the event list, in effect creating a specific subscription for only
  1729. the desired event types, add a parameter \fBevents=EventTypeA,EventTypeB,...\fP
  1730. where the event types are any of the event\-types\&. If no filter is
  1731. specified, all events \fIexcept\fP /events/localchangedetected and
  1732. /events/remotechangedetected are included.
  1733. .sp
  1734. The optional parameter \fBsince=<lastSeenID>\fP sets the ID of the last event
  1735. you’ve already seen. Syncthing returns a JSON encoded array of event objects,
  1736. starting at the event just after the one with this last seen ID. The default
  1737. value is 0, which returns all events. There is a limit to the number of events
  1738. buffered, so if the rate of events is high or the time between polling calls is
  1739. long some events might be missed. This can be detected by noting a discontinuity
  1740. in the event IDs.
  1741. .sp
  1742. If no new events are produced since \fB<lastSeenID>\fP, the HTTP call blocks and
  1743. waits for new events to happen before returning. By default it times out after
  1744. 60 seconds returning an empty array. The time out duration can be customized
  1745. with the optional parameter \fBtimeout=<seconds>\fP\&.
  1746. .sp
  1747. To receive only a limited number of events, add the \fBlimit=<n>\fP parameter with a
  1748. suitable value for \fBn\fP and only the \fIlast\fP \fBn\fP events will be returned. This
  1749. can be used to catch up with the latest event ID after a disconnection for
  1750. example: \fB/rest/events?since=0&limit=1\fP\&.
  1751. .SS GET /rest/events/disk
  1752. .sp
  1753. This convenience endpoint provides the same event stream, but pre\-filtered to show
  1754. only /events/localchangedetected and /events/remotechangedetected
  1755. event types. The \fBevents\fP parameter is not used.
  1756. .SH STATISTICS ENDPOINTS
  1757. .SS GET /rest/stats/device
  1758. .sp
  1759. Returns general statistics about devices. Currently, only contains the
  1760. time the device was last seen.
  1761. .INDENT 0.0
  1762. .INDENT 3.5
  1763. .sp
  1764. .nf
  1765. .ft C
  1766. $ curl \-s http://localhost:8384/rest/stats/device | json
  1767. {
  1768. "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2": {
  1769. "lastSeen" : "2015\-04\-18T11:21:31.3256277+01:00"
  1770. }
  1771. }
  1772. .ft P
  1773. .fi
  1774. .UNINDENT
  1775. .UNINDENT
  1776. .SS GET /rest/stats/folder
  1777. .sp
  1778. Returns general statistics about folders. Currently contains the
  1779. last scan time and the last synced file.
  1780. .INDENT 0.0
  1781. .INDENT 3.5
  1782. .sp
  1783. .nf
  1784. .ft C
  1785. {
  1786. "folderid": {
  1787. "lastScan": "2016\-06\-02T13:28:01.288181412\-04:00",
  1788. "lastFile": {
  1789. "filename": "file/name",
  1790. "at": "2015\-04\-16T22:04:18.3066971+01:00"
  1791. }
  1792. }
  1793. }
  1794. .ft P
  1795. .fi
  1796. .UNINDENT
  1797. .UNINDENT
  1798. .SH MISC SERVICES ENDPOINTS
  1799. .SS GET /rest/svc/deviceid
  1800. .sp
  1801. Verifies and formats a device ID. Accepts all currently valid formats
  1802. (52 or 56 characters with or without separators, upper or lower case,
  1803. with trivial substitutions). Takes one parameter, \fBid\fP, and returns
  1804. either a valid device ID in modern format, or an error.
  1805. .INDENT 0.0
  1806. .INDENT 3.5
  1807. .sp
  1808. .nf
  1809. .ft C
  1810. $ curl \-s http://localhost:8384/rest/svc/deviceid?id=1234 | json
  1811. {
  1812. "error": "device ID invalid: incorrect length"
  1813. }
  1814. $ curl \-s http://localhost:8384/rest/svc/deviceid?id=p56ioi7m\-\-zjnu2iq\-gdr\-eydm\-2mgtmgl3bxnpq6w5btbbz4tjxzwicq | json
  1815. {
  1816. "id": "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2"
  1817. }
  1818. .ft P
  1819. .fi
  1820. .UNINDENT
  1821. .UNINDENT
  1822. .SS GET /rest/svc/lang
  1823. .sp
  1824. Returns a list of canonicalized localization codes, as picked up from
  1825. the \fBAccept\-Language\fP header sent by the browser.
  1826. .INDENT 0.0
  1827. .INDENT 3.5
  1828. .sp
  1829. .nf
  1830. .ft C
  1831. ["sv_sv","sv","en_us","en"]
  1832. .ft P
  1833. .fi
  1834. .UNINDENT
  1835. .UNINDENT
  1836. .SS GET /rest/svc/random/string
  1837. .sp
  1838. Returns a strong random generated string (alphanumeric) of the specified length. Takes the \fBlength\fP parameter.
  1839. .INDENT 0.0
  1840. .INDENT 3.5
  1841. .sp
  1842. .nf
  1843. .ft C
  1844. {
  1845. "random": "FdPaEaZQ56sXEKYNxpgF"
  1846. }
  1847. .ft P
  1848. .fi
  1849. .UNINDENT
  1850. .UNINDENT
  1851. .SS GET /rest/svc/report
  1852. .sp
  1853. Returns the data sent in the anonymous usage report.
  1854. .INDENT 0.0
  1855. .INDENT 3.5
  1856. .sp
  1857. .nf
  1858. .ft C
  1859. {
  1860. "folderMaxMiB" : 0,
  1861. "platform" : "linux\-amd64",
  1862. "totMiB" : 0,
  1863. "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",
  1864. "upgradeAllowedManual" : true,
  1865. "totFiles" : 3,
  1866. "folderUses" : {
  1867. "ignorePerms" : 0,
  1868. "autoNormalize" : 0,
  1869. "sendonly" : 0,
  1870. "ignoreDelete" : 0
  1871. },
  1872. "memoryUsageMiB" : 13,
  1873. "version" : "v0.12.2",
  1874. "sha256Perf" : 27.28,
  1875. "numFolders" : 2,
  1876. "memorySize" : 1992,
  1877. "announce" : {
  1878. "defaultServersIP" : 0,
  1879. "otherServers" : 0,
  1880. "globalEnabled" : false,
  1881. "defaultServersDNS" : 1,
  1882. "localEnabled" : false
  1883. },
  1884. "usesRateLimit" : false,
  1885. "numCPU" : 2,
  1886. "uniqueID" : "",
  1887. "urVersion" : 2,
  1888. "rescanIntvs" : [
  1889. 60,
  1890. 60
  1891. ],
  1892. "numDevices" : 2,
  1893. "folderMaxFiles" : 3,
  1894. "relays" : {
  1895. "defaultServers" : 1,
  1896. "enabled" : true,
  1897. "otherServers" : 0
  1898. },
  1899. "deviceUses" : {
  1900. "compressMetadata" : 1,
  1901. "customCertName" : 0,
  1902. "staticAddr" : 1,
  1903. "compressAlways" : 0,
  1904. "compressNever" : 1,
  1905. "introducer" : 0,
  1906. "dynamicAddr" : 1
  1907. },
  1908. "upgradeAllowedAuto" : false
  1909. }
  1910. .ft P
  1911. .fi
  1912. .UNINDENT
  1913. .UNINDENT
  1914. .SH DEBUG ENDPOINTS
  1915. .SS Debug Endpoints
  1916. .sp
  1917. These endpoints require the \fBgui.debugging\fP configuration option to
  1918. be enabled and yield an access denied error code otherwise.
  1919. .SS GET /rest/debug/peerCompletion
  1920. .sp
  1921. Summarizes the completion precentage for each remote device. Returns an object
  1922. with device IDs as keys and an integer percentage as values.
  1923. .SS GET /rest/debug/httpmetrics
  1924. .sp
  1925. Returns statistics about each served REST API endpoint, to diagnose how much
  1926. time was spent generating the responses.
  1927. .SS GET /rest/debug/cpuprof
  1928. .sp
  1929. Used to capture a profile of what Syncthing is doing on the CPU. See
  1930. /users/profiling\&.
  1931. .SS GET /rest/debug/heapprof
  1932. .sp
  1933. Used to capture a profile of what Syncthing is doing with the heap memory. See
  1934. /users/profiling\&.
  1935. .SS GET /rest/debug/support
  1936. .sp
  1937. Collects information about the running instance for troubleshooting purposes.
  1938. Returns a “support bundle” as a zipped archive, which should be sent to the
  1939. developers after verifying it contains no sensitive personal information.
  1940. Credentials for the web GUI and the API key are automatically redacted already.
  1941. .SS GET /rest/debug/file
  1942. .sp
  1943. Shows diagnostics about a certain file in a shared folder. Takes the \fBfolder\fP
  1944. (folder ID) and \fBfile\fP (folder relative path) parameters.
  1945. .INDENT 0.0
  1946. .INDENT 3.5
  1947. .sp
  1948. .nf
  1949. .ft C
  1950. $ curl \-H X\-API\-Key:... "http://localhost:8384/rest/debug/file?folder=default&file=foo/bar"
  1951. .ft P
  1952. .fi
  1953. .UNINDENT
  1954. .UNINDENT
  1955. .sp
  1956. The returned object contains the same info as db\-file\-get, plus a summary
  1957. of \fBglobalVersions\fP\&.
  1958. .SH AUTHOR
  1959. The Syncthing Authors
  1960. .SH COPYRIGHT
  1961. 2014-2019, The Syncthing Authors
  1962. .\" Generated by docutils manpage writer.
  1963. .