syncthing-rest-api.7 55 KB

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