1
0

syncthing-rest-api.7 55 KB

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