syncthing-rest-api.7 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948
  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" "Apr 05, 2022" "v1.19.2" "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 POST /rest/system/pause
  619. .sp
  620. Pause the given device or all devices.
  621. .sp
  622. Takes the optional parameter \fBdevice\fP (device ID). When omitted,
  623. pauses all devices. Returns status 200 and no content upon success, or status
  624. 500 and a plain text error on failure.
  625. .SS GET /rest/system/ping
  626. .sp
  627. Returns a \fB{"ping": "pong"}\fP object.
  628. .INDENT 0.0
  629. .INDENT 3.5
  630. .sp
  631. .nf
  632. .ft C
  633. {
  634. "ping": "pong"
  635. }
  636. .ft P
  637. .fi
  638. .UNINDENT
  639. .UNINDENT
  640. .SS POST /rest/system/ping
  641. .sp
  642. Returns a \fB{"ping": "pong"}\fP object.
  643. .SS POST /rest/system/reset
  644. .sp
  645. Post with empty body to erase the current index database and restart
  646. Syncthing. With no query parameters, the entire database is erased from disk.
  647. By specifying the \fBfolder\fP parameter with a valid folder ID, only
  648. information for that folder will be erased:
  649. .INDENT 0.0
  650. .INDENT 3.5
  651. .sp
  652. .nf
  653. .ft C
  654. curl \-X POST \-H "X\-API\-Key: abc123" http://localhost:8384/rest/system/reset?folder=ab1c2\-def3g
  655. .ft P
  656. .fi
  657. .UNINDENT
  658. .UNINDENT
  659. .sp
  660. \fBCaution\fP: See \fB\-\-reset\-database\fP for \fB\&.stfolder\fP creation
  661. side\-effect and caution regarding mountpoints.
  662. .SS POST /rest/system/restart
  663. .sp
  664. Post with empty body to immediately restart Syncthing.
  665. .SS POST /rest/system/resume
  666. .sp
  667. Resume the given device or all devices.
  668. .sp
  669. Takes the optional parameter \fBdevice\fP (device ID). When omitted,
  670. resumes all devices. Returns status 200 and no content upon success, or status
  671. 500 and a plain text error on failure.
  672. .SS POST /rest/system/shutdown
  673. .sp
  674. Post with empty body to cause Syncthing to exit and not restart.
  675. .SS GET /rest/system/status
  676. .sp
  677. Returns information about current system status and resource usage. The CPU percent value has been deprecated from the API and will always report 0.
  678. .INDENT 0.0
  679. .INDENT 3.5
  680. .sp
  681. .nf
  682. .ft C
  683. {
  684. "alloc": 30618136,
  685. "connectionServiceStatus": {
  686. "dynamic+https://relays.syncthing.net/endpoint": {
  687. "error": null,
  688. "lanAddresses": [
  689. "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"
  690. ],
  691. "wanAddresses": [
  692. "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"
  693. ]
  694. },
  695. "tcp://0.0.0.0:22000": {
  696. "error": null,
  697. "lanAddresses": [
  698. "tcp://0.0.0.0:22000"
  699. ],
  700. "wanAddresses": [
  701. "tcp://0.0.0.0:22000"
  702. ]
  703. }
  704. },
  705. "cpuPercent": 0,
  706. "discoveryEnabled": true,
  707. "discoveryErrors": {
  708. "global@https://discovery\-v4\-1.syncthing.net/v2/": "500 Internal Server Error",
  709. "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)",
  710. "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)",
  711. "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",
  712. "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",
  713. "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"
  714. },
  715. "discoveryStatus": {
  716. "IPv4 local": {
  717. "error": null
  718. },
  719. "IPv6 local": {
  720. "error": null
  721. },
  722. "global@https://discovery\-v4\-1.syncthing.net/v2/": {
  723. "error": "500 Internal Server Error"
  724. },
  725. "global@https://discovery\-v4\-2.syncthing.net/v2/": {
  726. "error": "Post https://discovery\-v4\-2.syncthing.net/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
  727. },
  728. "global@https://discovery\-v4\-3.syncthing.net/v2/": {
  729. "error": "Post https://discovery\-v4\-3.syncthing.net/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
  730. },
  731. "global@https://discovery\-v6\-1.syncthing.net/v2/": {
  732. "error": "Post https://discovery\-v6\-1.syncthing.net/v2/: dial tcp [2001:470:28:4d6::5]:443: connect: no route to host"
  733. },
  734. "global@https://discovery\-v6\-2.syncthing.net/v2/": {
  735. "error": "Post https://discovery\-v6\-2.syncthing.net/v2/: dial tcp [2604:a880:800:10::182:a001]:443: connect: no route to host"
  736. },
  737. "global@https://discovery\-v6\-3.syncthing.net/v2/": {
  738. "error": "Post https://discovery\-v6\-3.syncthing.net/v2/: dial tcp [2400:6180:0:d0::d9:d001]:443: connect: no route to host"
  739. }
  740. },
  741. "discoveryMethods": 8,
  742. "goroutines": 49,
  743. "lastDialStatus": {
  744. "tcp://10.20.30.40": {
  745. "when": "2019\-05\-16T07:41:23Z",
  746. "error": "dial tcp 10.20.30.40:22000: i/o timeout"
  747. },
  748. "tcp://172.16.33.3:22000": {
  749. "when": "2019\-05\-16T07:40:43Z",
  750. "ok": true
  751. },
  752. "tcp://83.233.120.221:22000": {
  753. "when": "2019\-05\-16T07:41:13Z",
  754. "error": "dial tcp 83.233.120.221:22000: connect: connection refused"
  755. }
  756. },
  757. "myID": "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2",
  758. "pathSeparator": "/",
  759. "startTime": "2016\-06\-06T19:41:43.039284753+02:00",
  760. "sys": 42092792,
  761. "themes": [
  762. "default",
  763. "dark"
  764. ],
  765. "tilde": "/Users/jb",
  766. "uptime": 2635
  767. }
  768. .ft P
  769. .fi
  770. .UNINDENT
  771. .UNINDENT
  772. .sp
  773. New in version 1.2.0: The \fBlastDialStatus\fP dictionary contains the last error (or \fBnull\fP for
  774. success) for each peer address that Syncthing has attempted to contact.
  775. The \fBconnectionServiceStatus\fP entries gained \fB"error": null\fP
  776. attributes where previously there would be no \fBerror\fP attribute at all
  777. in the success case.
  778. .sp
  779. New in version 1.18.0: The \fBdiscoveryStatus\fP dictionary lists all configured discovery methods, not
  780. only failed ones like the now deprecated \fBdiscoveryErrors\fP\&. Each entry is
  781. an object itself (for consistency with other fields), where a \fBnull\fP value
  782. for the \fBerror\fP attribute means the method is running successfully. This
  783. effectively deprecates the \fBdiscoveryMethods\fP attribute as well, which now
  784. always matches the number of entries in \fBdiscoveryStatus\fP\&.
  785. .SS GET /rest/system/upgrade
  786. .sp
  787. Checks for a possible upgrade and returns an object describing the
  788. newest version and upgrade possibility.
  789. .INDENT 0.0
  790. .INDENT 3.5
  791. .sp
  792. .nf
  793. .ft C
  794. {
  795. "latest": "v0.14.47",
  796. "majorNewer": false,
  797. "newer": true,
  798. "running": "v0.14.46"
  799. }
  800. .ft P
  801. .fi
  802. .UNINDENT
  803. .UNINDENT
  804. .SS POST /rest/system/upgrade
  805. .sp
  806. Perform an upgrade to the newest released version and restart. Does
  807. nothing if there is no newer version than currently running.
  808. .SS GET /rest/system/version
  809. .sp
  810. Returns the current Syncthing version information.
  811. .INDENT 0.0
  812. .INDENT 3.5
  813. .sp
  814. .nf
  815. .ft C
  816. {
  817. "arch": "amd64",
  818. "longVersion": "syncthing v0.10.27+3\-gea8c3de (go1.4 darwin\-amd64 default) jb@syno 2015\-03\-16 11:01:29 UTC",
  819. "os": "darwin",
  820. "version": "v0.10.27+3\-gea8c3de"
  821. }
  822. .ft P
  823. .fi
  824. .UNINDENT
  825. .UNINDENT
  826. .SH CONFIG ENDPOINTS
  827. .SS Config Endpoints
  828. .sp
  829. New in version 1.12.0.
  830. .sp
  831. These endpoints facilitate access and modification of the configuration in a granular way. Config sent to the endpoints must be in the
  832. same format as returned by the corresponding GET request. When posting the
  833. configuration succeeds, the posted configuration is immediately applied, except
  834. for changes that require a restart. Query \fI\%/rest/config/restart\-required\fP to check if
  835. a restart is required.
  836. .sp
  837. For all endpoints supporting \fBPATCH\fP, it takes the existing config and
  838. unmarshals the given JSON object on top of it. This means all child objects will
  839. replace the existing objects, not extend them. For example for
  840. \fBRawListenAddresses\fP in options, which is an array of strings, sending
  841. \fB{RawListenAddresses: ["tcp://10.0.0.2"]}\fP will replace all existing listen
  842. addresses.
  843. .SS /rest/config
  844. .sp
  845. \fBGET\fP returns the entire config and \fBPUT\fP replaces it.
  846. .SS /rest/config/restart\-required
  847. .sp
  848. \fBGET\fP returns whether a restart of Syncthing is required for the current
  849. config to take effect.
  850. .SS /rest/config/folders, /rest/config/devices
  851. .sp
  852. \fBGET\fP returns all folders respectively devices as an array. \fBPUT\fP takes an array and
  853. \fBPOST\fP a single object. In both cases if a given folder/device already exists,
  854. it’s replaced, otherwise a new one is added.
  855. .SS /rest/config/folders/*id*, /rest/config/devices/*id*
  856. .sp
  857. Put the desired folder\- respectively device\-ID in place of *id*. \fBGET\fP
  858. returns the folder/device for the given ID, \fBPUT\fP replaces the entire config,
  859. \fBPATCH\fP replaces only the given child objects and \fBDELETE\fP removes the
  860. folder/device.
  861. .SS /rest/config/defaults/folder, /rest/config/defaults/device
  862. .sp
  863. \fBGET\fP returns a template folder / device configuration object with all default
  864. values, which only needs a unique ID to be applied. \fBPUT\fP replaces the
  865. default config (omitted values are reset to the hard\-coded defaults), \fBPATCH\fP
  866. replaces only the given child objects.
  867. .SS /rest/config/defaults/ignores
  868. .sp
  869. New in version 1.19.0.
  870. .sp
  871. \fBGET\fP returns an object with a single \fBlines\fP attribute listing ignore
  872. patterns to be used by default on folders, as an array of single\-line strings.
  873. \fBPUT\fP replaces the default ignore patterns from an object of the same format.
  874. .SS /rest/config/options, /rest/config/ldap, /rest/config/gui
  875. .sp
  876. \fBGET\fP returns the respective object, \fBPUT\fP replaces the entire object and
  877. \fBPATCH\fP replaces only the given child objects.
  878. .SH CLUSTER ENDPOINTS
  879. .sp
  880. Concerns the mesh network structure.
  881. .SS DELETE /rest/cluster/pending/devices
  882. .sp
  883. New in version 1.18.0.
  884. .sp
  885. Remove records about a pending remote device which tried to connect. Valid
  886. values for the \fBdevice\fP parameter are those from the corresponding
  887. cluster\-pending\-devices\-get endpoint.
  888. .INDENT 0.0
  889. .INDENT 3.5
  890. .sp
  891. .nf
  892. .ft C
  893. $ curl \-X DELETE \-H "X\-API\-Key: abc123" http://localhost:8384/rest/cluster/pending/devices?device=P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2
  894. .ft P
  895. .fi
  896. .UNINDENT
  897. .UNINDENT
  898. .sp
  899. Returns status 200 and no content upon success, or status 500 and a
  900. plain text error on failure. A /events/pendingdeviceschanged
  901. event will be generated in response.
  902. .sp
  903. For a more permanent effect, also for future connections from the same
  904. device ID, the device should be ignored in the configuration instead.
  905. .SS GET /rest/cluster/pending/devices
  906. .sp
  907. New in version 1.13.0.
  908. .sp
  909. Lists remote devices which have tried to connect, but are not yet
  910. configured in our instance.
  911. .INDENT 0.0
  912. .INDENT 3.5
  913. .sp
  914. .nf
  915. .ft C
  916. {
  917. "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2": {
  918. "time": "2020\-03\-18T11:43:07Z",
  919. "name": "Friend Joe",
  920. "address": "192.168.1.2:22000"
  921. }
  922. }
  923. .ft P
  924. .fi
  925. .UNINDENT
  926. .UNINDENT
  927. .SS DELETE /rest/cluster/pending/folders
  928. .sp
  929. New in version 1.18.0.
  930. .sp
  931. Remove records about a pending folder announced from a remote device. Valid
  932. values for the \fBfolder\fP and \fBdevice\fP parameters are those from the
  933. corresponding cluster\-pending\-folders\-get endpoint. The \fBdevice\fP
  934. parameter is optional and affects announcements of this folder from the given
  935. device, or from \fIany\fP device if omitted.
  936. .INDENT 0.0
  937. .INDENT 3.5
  938. .sp
  939. .nf
  940. .ft C
  941. $ 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
  942. .ft P
  943. .fi
  944. .UNINDENT
  945. .UNINDENT
  946. .sp
  947. Returns status 200 and no content upon success, or status 500 and a plain text
  948. error on failure. A /events/pendingfolderschanged event will be
  949. generated in response.
  950. .sp
  951. For a more permanent effect, also for future announcements of the same folder
  952. ID, the folder should be ignored in the configuration
  953. instead.
  954. .SS GET /rest/cluster/pending/folders
  955. .sp
  956. New in version 1.13.0.
  957. .sp
  958. Lists folders which remote devices have offered to us, but are not yet
  959. shared from our instance to them. Takes the optional \fBdevice\fP
  960. parameter to only return folders offered by a specific remote device.
  961. Other offering devices are also omitted from the result.
  962. .INDENT 0.0
  963. .INDENT 3.5
  964. .sp
  965. .nf
  966. .ft C
  967. {
  968. "cpkn4\-57ysy": {
  969. "offeredBy": {
  970. "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2": {
  971. "time": "2020\-03\-18T11:43:07Z",
  972. "label": "Joe\(aqs folder",
  973. "receiveEncrypted": true,
  974. "remoteEncrypted": false
  975. },
  976. "DOVII4U\-SQEEESM\-VZ2CVTC\-CJM4YN5\-QNV7DCU\-5U3ASRL\-YVFG6TH\-W5DV5AA": {
  977. "time": "2020\-03\-01T10:12:13Z",
  978. "label": "Jane\(aqs and Joe\(aqs folder",
  979. "receiveEncrypted": false,
  980. "remoteEncrypted": false
  981. }
  982. }
  983. },
  984. "abcde\-fghij": {
  985. "offeredBy": {
  986. "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2": {
  987. "time": "2020\-03\-18T11:43:07Z",
  988. "label": "MyPics",
  989. "receiveEncrypted": false,
  990. "remoteEncrypted": false
  991. }
  992. }
  993. }
  994. }
  995. .ft P
  996. .fi
  997. .UNINDENT
  998. .UNINDENT
  999. .SH FOLDER ENDPOINTS
  1000. .sp
  1001. Runtime state of the individual shared folders.
  1002. .SS GET /rest/folder/errors
  1003. .sp
  1004. New in version 0.14.53.
  1005. .sp
  1006. Takes one mandatory parameter, \fBfolder\fP, and returns the list of errors
  1007. encountered during scanning or pulling.
  1008. .sp
  1009. The results can be paginated using the common pagination parameters\&.
  1010. .INDENT 0.0
  1011. .INDENT 3.5
  1012. .sp
  1013. .nf
  1014. .ft C
  1015. {
  1016. "folder": "nnhic\-sxuae",
  1017. "errors": [
  1018. {
  1019. "path": "noperm.txt",
  1020. "error": "hashing: open /path/to/folder/noperm.txt: permission denied"
  1021. }
  1022. ],
  1023. "page": 1,
  1024. "perpage": 100
  1025. }
  1026. .ft P
  1027. .fi
  1028. .UNINDENT
  1029. .UNINDENT
  1030. .SS GET /rest/folder/pullerrors (DEPRECATED)
  1031. .sp
  1032. Deprecated since version v0.14.53: This endpoint still works as before but is deprecated. Use
  1033. folder\-errors\-get instead, which returns the same information.
  1034. .sp
  1035. See \fI\%d510e3cca3d5caae42121fa206b3decc981ae59e\fP <\fBhttps://github.com/syncthing/syncthing/commit/d510e3cca3d5caae42121fa206b3decc981ae59e\fP>
  1036. .SS GET /rest/folder/versions
  1037. .sp
  1038. New in version 0.14.44.
  1039. .sp
  1040. Takes one mandatory parameter, \fBfolder\fP, and returns the list of archived
  1041. files that could be recovered. How many versions are available depends on the
  1042. /users/versioning configuration. Each entry specifies when the file
  1043. version was archived as the \fBversionTime\fP, the \fBmodTime\fP when it was last
  1044. modified before being archived, and the size in bytes.
  1045. .INDENT 0.0
  1046. .INDENT 3.5
  1047. .sp
  1048. .nf
  1049. .ft C
  1050. {
  1051. "dir1/dir2/bar": [
  1052. {
  1053. "versionTime": "2022\-02\-06T20:44:12+01:00",
  1054. "modTime": "2021\-01\-14T13:21:22+01:00",
  1055. "size": 4
  1056. }
  1057. ],
  1058. "baz": [
  1059. {
  1060. "versionTime": "2022\-02\-06T20:44:20+01:00",
  1061. "modTime": "2021\-01\-14T13:23:49+01:00",
  1062. "size": 4
  1063. }
  1064. ],
  1065. "foo": [
  1066. {
  1067. "versionTime": "2022\-02\-06T20:55:31+01:00",
  1068. "modTime": "2022\-02\-06T20:44:13+01:00",
  1069. "size": 4
  1070. },
  1071. {
  1072. "versionTime": "2022\-02\-06T20:44:20+01:00",
  1073. "modTime": "2021\-01\-14T13:21:16+01:00",
  1074. "size": 4
  1075. }
  1076. ]
  1077. }
  1078. .ft P
  1079. .fi
  1080. .UNINDENT
  1081. .UNINDENT
  1082. .SS POST /rest/folder/versions
  1083. .sp
  1084. Restore archived versions of a given set of files. Expects an object with
  1085. attributes named after the relative file paths, with timestamps as values
  1086. matching valid \fBversionTime\fP entries in the corresponding
  1087. folder\-versions\-get response object.
  1088. .sp
  1089. Takes the mandatory parameter \fBfolder\fP (folder ID). Returns an object
  1090. containing any error messages that occurred during restoration of the file, with
  1091. the file path as attribute name.
  1092. .INDENT 0.0
  1093. .INDENT 3.5
  1094. .sp
  1095. .nf
  1096. .ft C
  1097. curl \-X POST \-H X\-API\-key:... http://127.0.0.1:8384/rest/folder/versions?folder=default \-d \(aq{
  1098. "dir1/dir2/bar": "2022\-02\-06T20:44:12+01:00",
  1099. "baz": "2022\-02\-06T20:44:20+01:00"
  1100. }\(aq
  1101. .ft P
  1102. .fi
  1103. .UNINDENT
  1104. .UNINDENT
  1105. .SH DATABASE ENDPOINTS
  1106. .SS GET /rest/db/browse
  1107. .sp
  1108. Returns the directory tree of the global model. Directories are always
  1109. JSON objects (map/dictionary), and files are always arrays of
  1110. modification time and size. The first integer is the files modification
  1111. time, and the second integer is the file size.
  1112. .sp
  1113. The call takes one mandatory \fBfolder\fP parameter and two optional
  1114. parameters. Optional parameter \fBlevels\fP defines how deep within the
  1115. tree we want to dwell down (0 based, defaults to unlimited depth)
  1116. Optional parameter \fBprefix\fP defines a prefix within the tree where to
  1117. start building the structure.
  1118. .INDENT 0.0
  1119. .INDENT 3.5
  1120. .sp
  1121. .nf
  1122. .ft C
  1123. $ curl \-s http://localhost:8384/rest/db/browse?folder=j663y\-3ct3e&prefix=DCIM&levels=2
  1124. [
  1125. {
  1126. "modTime" : "2020\-10\-02T23:48:52.076996974+02:00",
  1127. "name" : "100ANDRO",
  1128. "size" : 128,
  1129. "type" : "FILE_INFO_TYPE_DIRECTORY"
  1130. },
  1131. {
  1132. "children" : [
  1133. {
  1134. "modTime" : "2020\-12\-16T23:31:34.5009668+01:00",
  1135. "name" : "IMG_20201114_124821.jpg",
  1136. "size" : 10682189,
  1137. "type" : "FILE_INFO_TYPE_FILE"
  1138. },
  1139. {
  1140. "modTime" : "2020\-12\-16T23:31:35.0106367+01:00",
  1141. "name" : "IMG_20201213_122451.jpg",
  1142. "size" : 7936351,
  1143. "type" : "FILE_INFO_TYPE_FILE"
  1144. },
  1145. {
  1146. "modTime" : "2020\-12\-13T12:25:05.017097469+01:00",
  1147. "name" : "IMG_20201213_122504.jpg",
  1148. "size" : 8406507,
  1149. "type" : "FILE_INFO_TYPE_FILE"
  1150. },
  1151. {
  1152. "modTime" : "2020\-12\-13T12:25:06.127097469+01:00",
  1153. "name" : "IMG_20201213_122505.jpg",
  1154. "size" : 8381931,
  1155. "type" : "FILE_INFO_TYPE_FILE"
  1156. },
  1157. {
  1158. "modTime" : "2020\-12\-13T12:53:29.707298401+01:00",
  1159. "name" : "IMG_20201213_125329.jpg",
  1160. "size" : 4388331,
  1161. "type" : "FILE_INFO_TYPE_FILE"
  1162. },
  1163. ],
  1164. "modTime" : "2020\-10\-09T13:04:42.4410738+02:00",
  1165. "name" : "Camera",
  1166. "size" : 128,
  1167. "type" : "FILE_INFO_TYPE_DIRECTORY"
  1168. },
  1169. ]
  1170. .ft P
  1171. .fi
  1172. .UNINDENT
  1173. .UNINDENT
  1174. .sp
  1175. \fBNOTE:\fP
  1176. .INDENT 0.0
  1177. .INDENT 3.5
  1178. This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
  1179. .UNINDENT
  1180. .UNINDENT
  1181. .SS GET /rest/db/completion
  1182. .sp
  1183. Returns the completion percentage (0 to 100) and byte / item counts. Takes
  1184. optional \fBdevice\fP and \fBfolder\fP parameters:
  1185. .INDENT 0.0
  1186. .IP \(bu 2
  1187. \fBfolder\fP specifies the folder ID to calculate completion for. An empty
  1188. or absent \fBfolder\fP parameter means all folders as an aggregate.
  1189. .IP \(bu 2
  1190. \fBdevice\fP specifies the device ID to calculate completion for. An empty
  1191. or absent \fBdevice\fP parameter means the local device.
  1192. .UNINDENT
  1193. .sp
  1194. If a device is specified but no folder, completion is calculated for all
  1195. folders shared with that device.
  1196. .SS Example Queries
  1197. .sp
  1198. Completion status for folder \fBabcd\-1234\fP on device \fBI6KAH76\-...\-3PSROAU\fP:
  1199. .INDENT 0.0
  1200. .INDENT 3.5
  1201. .sp
  1202. .nf
  1203. .ft C
  1204. /rest/db/completion?folder=abcd\-1234&device=I6KAH76\-...\-3PSROAU
  1205. .ft P
  1206. .fi
  1207. .UNINDENT
  1208. .UNINDENT
  1209. .sp
  1210. Aggregated completion status for device \fBI6KAH76\-...\-3PSROAU\fP (all folders shared with them):
  1211. .INDENT 0.0
  1212. .INDENT 3.5
  1213. .sp
  1214. .nf
  1215. .ft C
  1216. /rest/db/completion?device=I6KAH76\-...\-3PSROAU
  1217. .ft P
  1218. .fi
  1219. .UNINDENT
  1220. .UNINDENT
  1221. .sp
  1222. Completion status for folder \fBabcd\-1234\fP on the local device:
  1223. .INDENT 0.0
  1224. .INDENT 3.5
  1225. .sp
  1226. .nf
  1227. .ft C
  1228. /rest/db/completion?folder=abcd\-1234
  1229. .ft P
  1230. .fi
  1231. .UNINDENT
  1232. .UNINDENT
  1233. .sp
  1234. Aggregated completion status for all folders on the local device:
  1235. .INDENT 0.0
  1236. .INDENT 3.5
  1237. .sp
  1238. .nf
  1239. .ft C
  1240. /rest/db/completion
  1241. .ft P
  1242. .fi
  1243. .UNINDENT
  1244. .UNINDENT
  1245. .SS Example Response
  1246. .INDENT 0.0
  1247. .INDENT 3.5
  1248. .sp
  1249. .nf
  1250. .ft C
  1251. {
  1252. "completion": 99.9937565835,
  1253. "globalBytes": 156793013575,
  1254. "needBytes": 9789241,
  1255. "globalItems": 7823,
  1256. "needItems": 412,
  1257. "needDeletes": 0,
  1258. "sequence": 12
  1259. }
  1260. .ft P
  1261. .fi
  1262. .UNINDENT
  1263. .UNINDENT
  1264. .sp
  1265. New in version 1.8.0: The ability to aggregate multiple folders by leaving out the folder ID.
  1266. Querying data for the local device by leaving out the device ID. Returning
  1267. the \fBglobalItems\fP counter in the response.
  1268. .SS GET /rest/db/file
  1269. .sp
  1270. Returns most data available about a given file, including version and
  1271. availability. Takes \fBfolder\fP and \fBfile\fP parameters.
  1272. .INDENT 0.0
  1273. .INDENT 3.5
  1274. .sp
  1275. .nf
  1276. .ft C
  1277. {
  1278. "availability": [
  1279. {
  1280. "id": "ITZRNXE\-YNROGBZ\-HXTH5P7\-VK5NYE5\-QHRQGE2\-7JQ6VNJ\-KZUEDIU\-5PPR5AM",
  1281. "fromTemporary": false
  1282. }
  1283. ],
  1284. "global": {
  1285. "deleted": false,
  1286. "ignored": false,
  1287. "invalid": false,
  1288. "localFlags": 0,
  1289. "modified": "2018\-08\-18T12:21:13.836784059+02:00",
  1290. "modifiedBy": "SYNO4VL",
  1291. "mustRescan": false,
  1292. "name": "testfile",
  1293. "noPermissions": false,
  1294. "numBlocks": 1,
  1295. "permissions": "0755",
  1296. "sequence": 107499,
  1297. "size": 1234,
  1298. "type": 0,
  1299. "version": [
  1300. "SYNO4VL:1"
  1301. ]
  1302. },
  1303. "local": {
  1304. "deleted": false,
  1305. "ignored": false,
  1306. "invalid": false,
  1307. "localFlags": 0,
  1308. "modified": "2018\-08\-18T12:21:13.836784059+02:00",
  1309. "modifiedBy": "SYNO4VL",
  1310. "mustRescan": false,
  1311. "name": "testfile",
  1312. "noPermissions": false,
  1313. "numBlocks": 1,
  1314. "permissions": "0755",
  1315. "sequence": 111038,
  1316. "size": 1234,
  1317. "type": 0,
  1318. "version": [
  1319. "SYNO4VL:1"
  1320. ]
  1321. }
  1322. }
  1323. .ft P
  1324. .fi
  1325. .UNINDENT
  1326. .UNINDENT
  1327. .SS GET /rest/db/ignores
  1328. .sp
  1329. Takes one parameter, \fBfolder\fP, and returns the content of the
  1330. \fB\&.stignore\fP as the \fBignore\fP field. A second field, \fBexpanded\fP,
  1331. 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.
  1332. .INDENT 0.0
  1333. .INDENT 3.5
  1334. .sp
  1335. .nf
  1336. .ft C
  1337. {
  1338. "ignore": [
  1339. "(?i)/Backups"
  1340. ],
  1341. "expanded": [
  1342. "(?i)Backups",
  1343. "(?i)Backups/**"
  1344. ]
  1345. }
  1346. .ft P
  1347. .fi
  1348. .UNINDENT
  1349. .UNINDENT
  1350. .SS POST /rest/db/ignores
  1351. .sp
  1352. Expects a format similar to the output of db\-ignores\-get call, but only
  1353. containing the \fBignore\fP field (\fBexpanded\fP field should be omitted).
  1354. It takes one parameter, \fBfolder\fP, and either updates the content of
  1355. the \fB\&.stignore\fP echoing it back as a response, or returns an error.
  1356. .SS GET /rest/db/localchanged
  1357. .sp
  1358. New in version 0.14.55.
  1359. .sp
  1360. Takes one mandatory parameter, \fBfolder\fP, and returns the list of files which
  1361. were changed locally in a receive\-only folder. Thus they differ from the global
  1362. state and could be reverted by pulling from remote devices again, see
  1363. db\-revert\-post\&.
  1364. .sp
  1365. The results can be paginated using the common pagination parameters\&.
  1366. .INDENT 0.0
  1367. .INDENT 3.5
  1368. .sp
  1369. .nf
  1370. .ft C
  1371. {
  1372. "files": [
  1373. {
  1374. "flags": "0755",
  1375. "sequence": 6,
  1376. "modified": "2015\-04\-20T23:06:12+09:00",
  1377. "name": "ls",
  1378. "size": 34640,
  1379. "version": [
  1380. "5157751870738175669:1"
  1381. ]
  1382. }
  1383. ],
  1384. "page": 1,
  1385. "perpage": 100
  1386. }
  1387. .ft P
  1388. .fi
  1389. .UNINDENT
  1390. .UNINDENT
  1391. .sp
  1392. \fBNOTE:\fP
  1393. .INDENT 0.0
  1394. .INDENT 3.5
  1395. This is an expensive call, increasing CPU and RAM usage on the device.
  1396. Use sparingly.
  1397. .UNINDENT
  1398. .UNINDENT
  1399. .SS GET /rest/db/need
  1400. .sp
  1401. Takes one mandatory parameter, \fBfolder\fP, and returns lists of files which are
  1402. needed by this device in order for it to become in sync.
  1403. .sp
  1404. The results can be paginated using the common pagination parameters\&. Pagination happens, across the union of all needed files,
  1405. that is \- across all 3 sections of the response. For example, given the current
  1406. need state is as follows:
  1407. .INDENT 0.0
  1408. .IP 1. 3
  1409. \fBprogress\fP has 15 items
  1410. .IP 2. 3
  1411. \fBqueued\fP has 3 items
  1412. .IP 3. 3
  1413. \fBrest\fP has 12 items
  1414. .UNINDENT
  1415. .sp
  1416. If you issue a query with \fBpage=1\fP and \fBperpage=10\fP, only the \fBprogress\fP
  1417. section in the response will have 10 items. If you issue a request query with
  1418. \fBpage=2\fP and \fBperpage=10\fP, \fBprogress\fP section will have the last 5 items,
  1419. \fBqueued\fP section will have all 3 items, and \fBrest\fP section will have first
  1420. 2 items. If you issue a query for \fBpage=3\fP and \fBperpage=10\fP, you will only
  1421. have the last 10 items of the \fBrest\fP section.
  1422. .sp
  1423. \fBNOTE:\fP
  1424. .INDENT 0.0
  1425. .INDENT 3.5
  1426. Return format changed in version 0.14.43, removing the \fBtotal\fP count
  1427. attribute.
  1428. .UNINDENT
  1429. .UNINDENT
  1430. .INDENT 0.0
  1431. .INDENT 3.5
  1432. .sp
  1433. .nf
  1434. .ft C
  1435. {
  1436. # Files currently being downloaded
  1437. "progress": [
  1438. {
  1439. "flags": "0755",
  1440. "sequence": 6,
  1441. "modified": "2015\-04\-20T23:06:12+09:00",
  1442. "name": "ls",
  1443. "size": 34640,
  1444. "version": [
  1445. "5157751870738175669:1"
  1446. ]
  1447. }
  1448. ],
  1449. # Files queued to be downloaded next (as per array order)
  1450. "queued": [
  1451. ...
  1452. ],
  1453. # Files to be downloaded after all queued files will be downloaded.
  1454. # This happens when we start downloading files, and new files get added while we are downloading.
  1455. "rest": [
  1456. ...
  1457. ],
  1458. "page": 1,
  1459. "perpage": 100
  1460. }
  1461. .ft P
  1462. .fi
  1463. .UNINDENT
  1464. .UNINDENT
  1465. .sp
  1466. \fBNOTE:\fP
  1467. .INDENT 0.0
  1468. .INDENT 3.5
  1469. This is an expensive call, increasing CPU and RAM usage on the device.
  1470. Use sparingly.
  1471. .UNINDENT
  1472. .UNINDENT
  1473. .SS POST /rest/db/override
  1474. .sp
  1475. Request override of a send only folder. Override means to make the local
  1476. version latest, overriding changes made on other devices. This API call does
  1477. nothing if the folder is not a send only folder.
  1478. .sp
  1479. Takes the mandatory parameter \fIfolder\fP (folder ID).
  1480. .INDENT 0.0
  1481. .INDENT 3.5
  1482. .sp
  1483. .nf
  1484. .ft C
  1485. curl \-X POST \-H X\-API\-key:... http://127.0.0.1:8384/rest/db/override?folder=default
  1486. .ft P
  1487. .fi
  1488. .UNINDENT
  1489. .UNINDENT
  1490. .SS POST /rest/db/prio
  1491. .sp
  1492. Moves the file to the top of the download queue.
  1493. .INDENT 0.0
  1494. .INDENT 3.5
  1495. .sp
  1496. .nf
  1497. .ft C
  1498. curl \-X POST http://127.0.0.1:8384/rest/db/prio?folder=default&file=foo/bar
  1499. .ft P
  1500. .fi
  1501. .UNINDENT
  1502. .UNINDENT
  1503. .sp
  1504. Response contains the same output as db\-need\-get\&.
  1505. .SS GET /rest/db/remoteneed
  1506. .sp
  1507. New in version 0.14.43.
  1508. .sp
  1509. Takes the mandatory parameters \fBfolder\fP and \fBdevice\fP, and returns the list
  1510. of files which are needed by that remote device in order for it to become in
  1511. sync with the shared folder.
  1512. .sp
  1513. The results can be paginated using the common pagination parameters\&.
  1514. .INDENT 0.0
  1515. .INDENT 3.5
  1516. .sp
  1517. .nf
  1518. .ft C
  1519. {
  1520. "files": [
  1521. {
  1522. "flags": "0755",
  1523. "sequence": 6,
  1524. "modified": "2015\-04\-20T23:06:12+09:00",
  1525. "name": "ls",
  1526. "size": 34640,
  1527. "version": [
  1528. "5157751870738175669:1"
  1529. ]
  1530. }
  1531. ],
  1532. "page": 1,
  1533. "perpage": 100
  1534. }
  1535. .ft P
  1536. .fi
  1537. .UNINDENT
  1538. .UNINDENT
  1539. .sp
  1540. \fBNOTE:\fP
  1541. .INDENT 0.0
  1542. .INDENT 3.5
  1543. This is an expensive call, increasing CPU and RAM usage on the device.
  1544. Use sparingly.
  1545. .UNINDENT
  1546. .UNINDENT
  1547. .SS POST /rest/db/revert
  1548. .sp
  1549. New in version 0.14.50.
  1550. .sp
  1551. Request revert of a receive only folder. Reverting a folder means to undo
  1552. all local changes. This API call does nothing if the folder is not a receive
  1553. only folder.
  1554. .sp
  1555. Takes the mandatory parameter \fIfolder\fP (folder ID).
  1556. .INDENT 0.0
  1557. .INDENT 3.5
  1558. .sp
  1559. .nf
  1560. .ft C
  1561. curl \-X POST \-H X\-API\-Key:... http://127.0.0.1:8384/rest/db/revert?folder=default
  1562. .ft P
  1563. .fi
  1564. .UNINDENT
  1565. .UNINDENT
  1566. .SS POST /rest/db/scan
  1567. .sp
  1568. Request immediate scan. Takes the optional parameters \fBfolder\fP (folder ID),
  1569. \fBsub\fP (path relative to the folder root) and \fBnext\fP (time in seconds). If
  1570. \fBfolder\fP is omitted or empty all folders are scanned. If \fBsub\fP is given,
  1571. only this path (and children, in case it’s a directory) is scanned. The \fBnext\fP
  1572. argument delays Syncthing’s automated rescan interval for a given amount of
  1573. seconds.
  1574. .sp
  1575. Requesting scan of a path that no longer exists, but previously did, is
  1576. valid and will result in Syncthing noticing the deletion of the path in
  1577. question.
  1578. .sp
  1579. Returns status 200 and no content upon success, or status 500 and a
  1580. plain text error if an error occurred during scanning.
  1581. .INDENT 0.0
  1582. .INDENT 3.5
  1583. .sp
  1584. .nf
  1585. .ft C
  1586. curl \-X POST http://127.0.0.1:8384/rest/db/scan?folder=default&sub=foo/bar
  1587. .ft P
  1588. .fi
  1589. .UNINDENT
  1590. .UNINDENT
  1591. .SS GET /rest/db/status
  1592. .sp
  1593. Returns information about the current status of a folder.
  1594. .sp
  1595. Parameters: \fBfolder\fP, the ID of a folder.
  1596. .INDENT 0.0
  1597. .INDENT 3.5
  1598. .sp
  1599. .nf
  1600. .ft C
  1601. {
  1602. "globalBytes": 0,
  1603. "globalDeleted": 0,
  1604. "globalDirectories": 0,
  1605. "globalFiles": 0,
  1606. "globalSymlinks": 0,
  1607. "globalTotalItems": 0,
  1608. "ignorePatterns": false,
  1609. "inSyncBytes": 0,
  1610. "inSyncFiles": 0,
  1611. "invalid": "",
  1612. "localBytes": 0,
  1613. "localDeleted": 0,
  1614. "localDirectories": 0,
  1615. "localFiles": 0,
  1616. "localSymlinks": 0,
  1617. "localTotalItems": 0,
  1618. "needBytes": 0,
  1619. "needDeletes": 0,
  1620. "needDirectories": 0,
  1621. "needFiles": 0,
  1622. "needSymlinks": 0,
  1623. "needTotalItems": 0,
  1624. "pullErrors": 0,
  1625. "receiveOnlyChangedBytes": 0,
  1626. "receiveOnlyChangedDeletes": 0,
  1627. "receiveOnlyChangedDirectories": 0,
  1628. "receiveOnlyChangedFiles": 0,
  1629. "receiveOnlyChangedSymlinks": 0,
  1630. "receiveOnlyTotalItems": 0,
  1631. "sequence": 0,
  1632. "state": "idle",
  1633. "stateChanged": "2018\-08\-08T07:04:57.301064781+02:00",
  1634. "version": 0
  1635. }
  1636. .ft P
  1637. .fi
  1638. .UNINDENT
  1639. .UNINDENT
  1640. .sp
  1641. The various fields have the following meaning:
  1642. .INDENT 0.0
  1643. .TP
  1644. .B global*:
  1645. Data in the cluster latest version.
  1646. .TP
  1647. .B inSync*:
  1648. Data that is locally the same as the cluster latest version.
  1649. .TP
  1650. .B local*:
  1651. Data that is locally present, regardless of whether it’s the same or different version as the cluster latest version.
  1652. .TP
  1653. .B need*:
  1654. Data that is needed to become up to date with the cluster latest version (i.e., data that is out of sync).
  1655. .TP
  1656. .B receiveOnlyChanged*:
  1657. Data that has changed locally in a receive only folder, and thus not been sent to the cluster.
  1658. .TP
  1659. .B invalid:
  1660. Deprecated, always empty.
  1661. .TP
  1662. .B pullErrors:
  1663. The number of files that failed to sync during the last sync operations.
  1664. .TP
  1665. .B sequence:
  1666. The current folder sequence number.
  1667. .TP
  1668. .B state:
  1669. The current folder state.
  1670. .TP
  1671. .B stateChanged:
  1672. When the folder state last changed.
  1673. .TP
  1674. .B version:
  1675. Deprecated, equivalent to the sequence number.
  1676. .UNINDENT
  1677. .sp
  1678. \fBNOTE:\fP
  1679. .INDENT 0.0
  1680. .INDENT 3.5
  1681. This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
  1682. .UNINDENT
  1683. .UNINDENT
  1684. .SH EVENT ENDPOINTS
  1685. .SS GET /rest/events
  1686. .sp
  1687. To receive events, perform a HTTP GET of \fB/rest/events\fP\&.
  1688. .sp
  1689. To filter the event list, in effect creating a specific subscription for only
  1690. the desired event types, add a parameter \fBevents=EventTypeA,EventTypeB,...\fP
  1691. where the event types are any of the event\-types\&. If no filter is
  1692. specified, all events \fIexcept\fP /events/localchangedetected and
  1693. /events/remotechangedetected are included.
  1694. .sp
  1695. The optional parameter \fBsince=<lastSeenID>\fP sets the ID of the last event
  1696. you’ve already seen. Syncthing returns a JSON encoded array of event objects,
  1697. starting at the event just after the one with this last seen ID. The default
  1698. value is 0, which returns all events. There is a limit to the number of events
  1699. buffered, so if the rate of events is high or the time between polling calls is
  1700. long some events might be missed. This can be detected by noting a discontinuity
  1701. in the event IDs.
  1702. .sp
  1703. If no new events are produced since \fB<lastSeenID>\fP, the HTTP call blocks and
  1704. waits for new events to happen before returning. By default it times out after
  1705. 60 seconds returning an empty array. The time out duration can be customized
  1706. with the optional parameter \fBtimeout=<seconds>\fP\&.
  1707. .sp
  1708. To receive only a limited number of events, add the \fBlimit=<n>\fP parameter with a
  1709. suitable value for \fBn\fP and only the \fIlast\fP \fBn\fP events will be returned. This
  1710. can be used to catch up with the latest event ID after a disconnection for
  1711. example: \fB/rest/events?since=0&limit=1\fP\&.
  1712. .SS GET /rest/events/disk
  1713. .sp
  1714. This convenience endpoint provides the same event stream, but pre\-filtered to show
  1715. only /events/localchangedetected and /events/remotechangedetected
  1716. event types. The \fBevents\fP parameter is not used.
  1717. .SH STATISTICS ENDPOINTS
  1718. .SS GET /rest/stats/device
  1719. .sp
  1720. Returns general statistics about devices. Currently, only contains the
  1721. time the device was last seen.
  1722. .INDENT 0.0
  1723. .INDENT 3.5
  1724. .sp
  1725. .nf
  1726. .ft C
  1727. $ curl \-s http://localhost:8384/rest/stats/device | json
  1728. {
  1729. "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2": {
  1730. "lastSeen" : "2015\-04\-18T11:21:31.3256277+01:00"
  1731. }
  1732. }
  1733. .ft P
  1734. .fi
  1735. .UNINDENT
  1736. .UNINDENT
  1737. .SS GET /rest/stats/folder
  1738. .sp
  1739. Returns general statistics about folders. Currently contains the
  1740. last scan time and the last synced file.
  1741. .INDENT 0.0
  1742. .INDENT 3.5
  1743. .sp
  1744. .nf
  1745. .ft C
  1746. {
  1747. "folderid": {
  1748. "lastScan": "2016\-06\-02T13:28:01.288181412\-04:00",
  1749. "lastFile": {
  1750. "filename": "file/name",
  1751. "at": "2015\-04\-16T22:04:18.3066971+01:00"
  1752. }
  1753. }
  1754. }
  1755. .ft P
  1756. .fi
  1757. .UNINDENT
  1758. .UNINDENT
  1759. .SH MISC SERVICES ENDPOINTS
  1760. .SS GET /rest/svc/deviceid
  1761. .sp
  1762. Verifies and formats a device ID. Accepts all currently valid formats
  1763. (52 or 56 characters with or without separators, upper or lower case,
  1764. with trivial substitutions). Takes one parameter, \fBid\fP, and returns
  1765. either a valid device ID in modern format, or an error.
  1766. .INDENT 0.0
  1767. .INDENT 3.5
  1768. .sp
  1769. .nf
  1770. .ft C
  1771. $ curl \-s http://localhost:8384/rest/svc/deviceid?id=1234 | json
  1772. {
  1773. "error": "device ID invalid: incorrect length"
  1774. }
  1775. $ curl \-s http://localhost:8384/rest/svc/deviceid?id=p56ioi7m\-\-zjnu2iq\-gdr\-eydm\-2mgtmgl3bxnpq6w5btbbz4tjxzwicq | json
  1776. {
  1777. "id": "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2"
  1778. }
  1779. .ft P
  1780. .fi
  1781. .UNINDENT
  1782. .UNINDENT
  1783. .SS GET /rest/svc/lang
  1784. .sp
  1785. Returns a list of canonicalized localization codes, as picked up from
  1786. the \fBAccept\-Language\fP header sent by the browser.
  1787. .INDENT 0.0
  1788. .INDENT 3.5
  1789. .sp
  1790. .nf
  1791. .ft C
  1792. ["sv_sv","sv","en_us","en"]
  1793. .ft P
  1794. .fi
  1795. .UNINDENT
  1796. .UNINDENT
  1797. .SS GET /rest/svc/random/string
  1798. .sp
  1799. Returns a strong random generated string (alphanumeric) of the specified length. Takes the \fBlength\fP parameter.
  1800. .INDENT 0.0
  1801. .INDENT 3.5
  1802. .sp
  1803. .nf
  1804. .ft C
  1805. {
  1806. "random": "FdPaEaZQ56sXEKYNxpgF"
  1807. }
  1808. .ft P
  1809. .fi
  1810. .UNINDENT
  1811. .UNINDENT
  1812. .SS GET /rest/svc/report
  1813. .sp
  1814. Returns the data sent in the anonymous usage report.
  1815. .INDENT 0.0
  1816. .INDENT 3.5
  1817. .sp
  1818. .nf
  1819. .ft C
  1820. {
  1821. "folderMaxMiB" : 0,
  1822. "platform" : "linux\-amd64",
  1823. "totMiB" : 0,
  1824. "longVersion" : "syncthing v0.12.2 \e"Beryllium Bedbug\e" (go1.4.3 linux\-amd64 default) unknown\[email protected] 2015\-11\-09 13:23:26 UTC",
  1825. "upgradeAllowedManual" : true,
  1826. "totFiles" : 3,
  1827. "folderUses" : {
  1828. "ignorePerms" : 0,
  1829. "autoNormalize" : 0,
  1830. "sendonly" : 0,
  1831. "ignoreDelete" : 0
  1832. },
  1833. "memoryUsageMiB" : 13,
  1834. "version" : "v0.12.2",
  1835. "sha256Perf" : 27.28,
  1836. "numFolders" : 2,
  1837. "memorySize" : 1992,
  1838. "announce" : {
  1839. "defaultServersIP" : 0,
  1840. "otherServers" : 0,
  1841. "globalEnabled" : false,
  1842. "defaultServersDNS" : 1,
  1843. "localEnabled" : false
  1844. },
  1845. "usesRateLimit" : false,
  1846. "numCPU" : 2,
  1847. "uniqueID" : "",
  1848. "urVersion" : 2,
  1849. "rescanIntvs" : [
  1850. 60,
  1851. 60
  1852. ],
  1853. "numDevices" : 2,
  1854. "folderMaxFiles" : 3,
  1855. "relays" : {
  1856. "defaultServers" : 1,
  1857. "enabled" : true,
  1858. "otherServers" : 0
  1859. },
  1860. "deviceUses" : {
  1861. "compressMetadata" : 1,
  1862. "customCertName" : 0,
  1863. "staticAddr" : 1,
  1864. "compressAlways" : 0,
  1865. "compressNever" : 1,
  1866. "introducer" : 0,
  1867. "dynamicAddr" : 1
  1868. },
  1869. "upgradeAllowedAuto" : false
  1870. }
  1871. .ft P
  1872. .fi
  1873. .UNINDENT
  1874. .UNINDENT
  1875. .SH DEBUG ENDPOINTS
  1876. .SS Debug Endpoints
  1877. .sp
  1878. These endpoints require the \fBgui.debugging\fP configuration option to
  1879. be enabled and yield an access denied error code otherwise.
  1880. .SS GET /rest/debug/peerCompletion
  1881. .sp
  1882. Summarizes the completion precentage for each remote device. Returns an object
  1883. with device IDs as keys and an integer percentage as values.
  1884. .SS GET /rest/debug/httpmetrics
  1885. .sp
  1886. Returns statistics about each served REST API endpoint, to diagnose how much
  1887. time was spent generating the responses.
  1888. .SS GET /rest/debug/cpuprof
  1889. .sp
  1890. Used to capture a profile of what Syncthing is doing on the CPU. See
  1891. /users/profiling\&.
  1892. .SS GET /rest/debug/heapprof
  1893. .sp
  1894. Used to capture a profile of what Syncthing is doing with the heap memory. See
  1895. /users/profiling\&.
  1896. .SS GET /rest/debug/support
  1897. .sp
  1898. Collects information about the running instance for troubleshooting purposes.
  1899. Returns a “support bundle” as a zipped archive, which should be sent to the
  1900. developers after verifying it contains no sensitive personal information.
  1901. Credentials for the web GUI and the API key are automatically redacted already.
  1902. .SS GET /rest/debug/file
  1903. .sp
  1904. Shows diagnostics about a certain file in a shared folder. Takes the \fBfolder\fP
  1905. (folder ID) and \fBfile\fP (folder relative path) parameters.
  1906. .INDENT 0.0
  1907. .INDENT 3.5
  1908. .sp
  1909. .nf
  1910. .ft C
  1911. $ curl \-H X\-API\-Key:... "http://localhost:8384/rest/debug/file?folder=default&file=foo/bar"
  1912. .ft P
  1913. .fi
  1914. .UNINDENT
  1915. .UNINDENT
  1916. .sp
  1917. The returned object contains the same info as db\-file\-get, plus a summary
  1918. of \fBglobalVersions\fP\&.
  1919. .SH AUTHOR
  1920. The Syncthing Authors
  1921. .SH COPYRIGHT
  1922. 2014-2019, The Syncthing Authors
  1923. .\" Generated by docutils manpage writer.
  1924. .