syncthing-rest-api.7 55 KB

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