syncthing-rest-api.7 53 KB

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