syncthing-rest-api.7 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .TH "SYNCTHING-REST-API" "7" "Nov 02, 2020" "v1" "Syncthing"
  4. .SH NAME
  5. syncthing-rest-api \- REST API
  6. .
  7. .nr rst2man-indent-level 0
  8. .
  9. .de1 rstReportMargin
  10. \\$1 \\n[an-margin]
  11. level \\n[rst2man-indent-level]
  12. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  13. -
  14. \\n[rst2man-indent0]
  15. \\n[rst2man-indent1]
  16. \\n[rst2man-indent2]
  17. ..
  18. .de1 INDENT
  19. .\" .rstReportMargin pre:
  20. . RS \\$1
  21. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  22. . nr rst2man-indent-level +1
  23. .\" .rstReportMargin post:
  24. ..
  25. .de UNINDENT
  26. . RE
  27. .\" indent \\n[an-margin]
  28. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  29. .nr rst2man-indent-level -1
  30. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  31. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  32. ..
  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 SYSTEM ENDPOINTS
  47. .SS GET /rest/system/browse
  48. .sp
  49. Returns a list of directories matching the path given by the optional parameter
  50. \fBcurrent\fP\&. The path can use \fI\%patterns as described in Go’s filepath package\fP <\fBhttps://golang.org/pkg/path/filepath/#Match\fP>\&. A ‘*’ will always be appended
  51. to the given path (e.g. \fB/tmp/\fP matches all its subdirectories). If the option
  52. \fBcurrent\fP is not given, filesystem root paths are returned.
  53. .INDENT 0.0
  54. .INDENT 3.5
  55. .sp
  56. .nf
  57. .ft C
  58. $ curl \-H "X\-API\-Key: yourkey" localhost:8384/rest/system/browse | json_pp
  59. [
  60. "/"
  61. ]
  62. $ curl \-H "X\-API\-Key: yourkey" localhost:8384/rest/system/browse?current=/var/ | json_pp
  63. [
  64. "/var/backups/",
  65. "/var/cache/",
  66. "/var/lib/",
  67. "/var/local/",
  68. "/var/lock/",
  69. "/var/log/",
  70. "/var/mail/",
  71. "/var/opt/",
  72. "/var/run/",
  73. "/var/spool/",
  74. "/var/tmp/"
  75. ]
  76. $ curl \-H "X\-API\-Key: yourkey" localhost:8384/rest/system/browse?current=/var/*o | json_pp
  77. [
  78. "/var/local/",
  79. "/var/lock/",
  80. "/var/log/",
  81. "/var/opt/",
  82. "/var/spool/"
  83. ]
  84. .ft P
  85. .fi
  86. .UNINDENT
  87. .UNINDENT
  88. .SS GET /rest/system/config
  89. .sp
  90. Deprecated since version v1.12.0: This endpoint still works as before but is deprecated. Use rest\-config
  91. instead.
  92. .sp
  93. Returns the current configuration.
  94. .INDENT 0.0
  95. .INDENT 3.5
  96. .sp
  97. .nf
  98. .ft C
  99. {
  100. "version": 30,
  101. "folders": [
  102. {
  103. "id": "GXWxf\-3zgnU",
  104. "label": "MyFolder",
  105. "filesystemType": "basic",
  106. "path": "...",
  107. "type": "sendreceive",
  108. "devices": [
  109. {
  110. "deviceID": "...",
  111. "introducedBy": ""
  112. }
  113. ],
  114. "rescanIntervalS": 60,
  115. "fsWatcherEnabled": false,
  116. "fsWatcherDelayS": 10,
  117. "ignorePerms": false,
  118. "autoNormalize": true,
  119. "minDiskFree": {
  120. "value": 1,
  121. "unit": "%"
  122. },
  123. "versioning": {
  124. "type": "simple",
  125. "params": {
  126. "keep": "5"
  127. }
  128. },
  129. "copiers": 0,
  130. "pullerMaxPendingKiB": 0,
  131. "hashers": 0,
  132. "order": "random",
  133. "ignoreDelete": false,
  134. "scanProgressIntervalS": 0,
  135. "pullerPauseS": 0,
  136. "maxConflicts": 10,
  137. "disableSparseFiles": false,
  138. "disableTempIndexes": false,
  139. "paused": false,
  140. "weakHashThresholdPct": 25,
  141. "markerName": ".stfolder",
  142. "copyOwnershipFromParent": false,
  143. "modTimeWindowS": 0
  144. }
  145. ],
  146. "devices": [
  147. {
  148. "deviceID": "...",
  149. "name": "Laptop",
  150. "addresses": [
  151. "dynamic",
  152. "tcp://192.168.1.2:22000"
  153. ],
  154. "compression": "metadata",
  155. "certName": "",
  156. "introducer": false,
  157. "skipIntroductionRemovals": false,
  158. "introducedBy": "",
  159. "paused": false,
  160. "allowedNetworks": [],
  161. "autoAcceptFolders": false,
  162. "maxSendKbps": 0,
  163. "maxRecvKbps": 0,
  164. "ignoredFolders": [],
  165. "pendingFolders": [
  166. {
  167. "time": "2019\-06\-05T10:21:22+02:00",
  168. "id": "cpkn4\-57ysy",
  169. "label": "SomeonesFolder"
  170. }
  171. ],
  172. "maxRequestKiB": 0
  173. }
  174. ],
  175. "gui": {
  176. "enabled": true,
  177. "address": "127.0.0.1:8384",
  178. "user": "Username",
  179. "password": "$2a$10$ZFws69T4FlvWwsqeIwL.TOo5zOYqsa/.TxlUnsGYS.j3JvjFTmxo6",
  180. "authMode": "static",
  181. "useTLS": false,
  182. "apiKey": "pGahcht56664QU5eoFQW6szbEG6Ec2Cr",
  183. "insecureAdminAccess": false,
  184. "theme": "default",
  185. "debugging": false,
  186. "insecureSkipHostcheck": false,
  187. "insecureAllowFrameLoading": false
  188. },
  189. "ldap": {
  190. "address": "",
  191. "bindDN": "",
  192. "transport": "plain",
  193. "insecureSkipVerify": false
  194. },
  195. "options": {
  196. "listenAddresses": [
  197. "default"
  198. ],
  199. "globalAnnounceServers": [
  200. "default"
  201. ],
  202. "globalAnnounceEnabled": true,
  203. "localAnnounceEnabled": true,
  204. "localAnnouncePort": 21027,
  205. "localAnnounceMCAddr": "[ff12::8384]:21027",
  206. "maxSendKbps": 0,
  207. "maxRecvKbps": 0,
  208. "reconnectionIntervalS": 60,
  209. "relaysEnabled": true,
  210. "relayReconnectIntervalM": 10,
  211. "startBrowser": false,
  212. "natEnabled": true,
  213. "natLeaseMinutes": 60,
  214. "natRenewalMinutes": 30,
  215. "natTimeoutSeconds": 10,
  216. "urAccepted": \-1,
  217. "urSeen": 2,
  218. "urUniqueId": "",
  219. "urURL": "https://data.syncthing.net/newdata",
  220. "urPostInsecurely": false,
  221. "urInitialDelayS": 1800,
  222. "restartOnWakeup": true,
  223. "autoUpgradeIntervalH": 12,
  224. "upgradeToPreReleases": false,
  225. "keepTemporariesH": 24,
  226. "cacheIgnoredFiles": false,
  227. "progressUpdateIntervalS": 5,
  228. "limitBandwidthInLan": false,
  229. "minHomeDiskFree": {
  230. "value": 1,
  231. "unit": "%"
  232. },
  233. "releasesURL": "https://upgrades.syncthing.net/meta.json",
  234. "alwaysLocalNets": [],
  235. "overwriteRemoteDeviceNamesOnConnect": false,
  236. "tempIndexMinBlocks": 10,
  237. "unackedNotificationIDs": [],
  238. "trafficClass": 0,
  239. "defaultFolderPath": "~",
  240. "setLowPriority": true,
  241. "maxFolderConcurrency": 0,
  242. "crURL": "https://crash.syncthing.net/newcrash",
  243. "crashReportingEnabled": true,
  244. "stunKeepaliveStartS": 180,
  245. "stunKeepaliveMinS": 20,
  246. "stunServers": [
  247. "default"
  248. ],
  249. "databaseTuning": "auto",
  250. "maxConcurrentIncomingRequestKiB": 0
  251. },
  252. "remoteIgnoredDevices": [],
  253. "pendingDevices": []
  254. }
  255. .ft P
  256. .fi
  257. .UNINDENT
  258. .UNINDENT
  259. .SS GET /rest/system/config/insync
  260. .sp
  261. Deprecated since version v1.12.0: This endpoint still works as before but is deprecated. Use
  262. rest\-config\-insync instead.
  263. .sp
  264. Returns whether the config is in sync, i.e. whether the running
  265. configuration is the same as that on disk.
  266. .INDENT 0.0
  267. .INDENT 3.5
  268. .sp
  269. .nf
  270. .ft C
  271. {
  272. "configInSync": true
  273. }
  274. .ft P
  275. .fi
  276. .UNINDENT
  277. .UNINDENT
  278. .SS POST /rest/system/config
  279. .sp
  280. Deprecated since version v1.12.0: This endpoint still works as before but is deprecated. Use rest\-config
  281. instead.
  282. .sp
  283. Post the full contents of the configuration, in the same format as returned by
  284. the corresponding GET request. When posting the configuration succeeds,
  285. the posted configuration is immediately applied, except for changes that require a restart. Query
  286. rest\-config\-insync to check if a restart is required.
  287. .sp
  288. This endpoint is the main point to control Syncthing, even if the change only
  289. concerns a very small part of the config: The usual workflow is to get the
  290. config, modify the needed parts and post it again.
  291. .SS GET /rest/system/connections
  292. .sp
  293. \fBNOTE:\fP
  294. .INDENT 0.0
  295. .INDENT 3.5
  296. Return format changed in 0.13.0.
  297. .UNINDENT
  298. .UNINDENT
  299. .sp
  300. Returns the list of configured devices and some metadata associated
  301. with them. The list also contains the local device itself as not connected.
  302. .sp
  303. The connection types are \fBTCP (Client)\fP, \fBTCP (Server)\fP, \fBRelay (Client)\fP and \fBRelay (Server)\fP\&.
  304. .INDENT 0.0
  305. .INDENT 3.5
  306. .sp
  307. .nf
  308. .ft C
  309. {
  310. "total" : {
  311. "paused" : false,
  312. "clientVersion" : "",
  313. "at" : "2015\-11\-07T17:29:47.691637262+01:00",
  314. "connected" : false,
  315. "inBytesTotal" : 1479,
  316. "type" : "",
  317. "outBytesTotal" : 1318,
  318. "address" : ""
  319. },
  320. "connections" : {
  321. "YZJBJFX\-RDBL7WY\-6ZGKJ2D\-4MJB4E7\-ZATSDUY\-LD6Y3L3\-MLFUYWE\-AEMXJAC" : {
  322. "connected" : true,
  323. "inBytesTotal" : 556,
  324. "paused" : false,
  325. "at" : "2015\-11\-07T17:29:47.691548971+01:00",
  326. "clientVersion" : "v0.12.1",
  327. "address" : "127.0.0.1:22002",
  328. "type" : "TCP (Client)",
  329. "outBytesTotal" : 550
  330. },
  331. "DOVII4U\-SQEEESM\-VZ2CVTC\-CJM4YN5\-QNV7DCU\-5U3ASRL\-YVFG6TH\-W5DV5AA" : {
  332. "outBytesTotal" : 0,
  333. "type" : "",
  334. "address" : "",
  335. "at" : "0001\-01\-01T00:00:00Z",
  336. "clientVersion" : "",
  337. "paused" : false,
  338. "inBytesTotal" : 0,
  339. "connected" : false
  340. },
  341. "UYGDMA4\-TPHOFO5\-2VQYDCC\-7CWX7XW\-INZINQT\-LE4B42N\-4JUZTSM\-IWCSXA4" : {
  342. "address" : "",
  343. "type" : "",
  344. "outBytesTotal" : 0,
  345. "connected" : false,
  346. "inBytesTotal" : 0,
  347. "paused" : false,
  348. "at" : "0001\-01\-01T00:00:00Z",
  349. "clientVersion" : ""
  350. }
  351. }
  352. }
  353. .ft P
  354. .fi
  355. .UNINDENT
  356. .UNINDENT
  357. .SS GET /rest/system/debug
  358. .sp
  359. New in version 0.12.0.
  360. .sp
  361. Returns the set of debug facilities and which of them are currently enabled.
  362. .INDENT 0.0
  363. .INDENT 3.5
  364. .sp
  365. .nf
  366. .ft C
  367. {
  368. "enabled": [
  369. "beacon"
  370. ],
  371. "facilities": {
  372. "beacon": "Multicast and broadcast discovery",
  373. "config": "Configuration loading and saving",
  374. "connections": "Connection handling",
  375. "db": "The database layer",
  376. "dialer": "Dialing connections",
  377. "discover": "Remote device discovery",
  378. "events": "Event generation and logging",
  379. "http": "REST API",
  380. "main": "Main package",
  381. "model": "The root hub",
  382. "protocol": "The BEP protocol",
  383. "relay": "Relay connection handling",
  384. "scanner": "File change detection and hashing",
  385. "stats": "Persistent device and folder statistics",
  386. "sync": "Mutexes",
  387. "upgrade": "Binary upgrades",
  388. "upnp": "UPnP discovery and port mapping",
  389. "versioner": "File versioning"
  390. }
  391. }
  392. .ft P
  393. .fi
  394. .UNINDENT
  395. .UNINDENT
  396. .SS POST /rest/system/debug
  397. .sp
  398. New in version 0.12.0.
  399. .sp
  400. Enables or disables debugging for specified facilities. Give one or both of
  401. \fBenable\fP and \fBdisable\fP query parameters, with comma separated facility
  402. names. To disable debugging of the beacon and discovery packages, and enable it
  403. for config and db:
  404. .INDENT 0.0
  405. .INDENT 3.5
  406. .sp
  407. .nf
  408. .ft C
  409. $ curl \-H X\-API\-Key:abc123 \-X POST \(aqhttp://localhost:8384/rest/system/debug?disable=beacon,discovery&enable=config,db\(aq
  410. .ft P
  411. .fi
  412. .UNINDENT
  413. .UNINDENT
  414. .SS GET /rest/system/discovery
  415. .sp
  416. Returns the contents of the local discovery cache.
  417. .INDENT 0.0
  418. .INDENT 3.5
  419. .sp
  420. .nf
  421. .ft C
  422. {
  423. "LGFPDIT7SKNNJVJZA4FC7QNCRKCE753K72BW5QD2FOZ7FRFEP57Q": [
  424. "192.162.129.11:22000"
  425. ]
  426. }
  427. .ft P
  428. .fi
  429. .UNINDENT
  430. .UNINDENT
  431. .SS POST /rest/system/discovery
  432. .sp
  433. \fBNOTE:\fP
  434. .INDENT 0.0
  435. .INDENT 3.5
  436. Removed in v0.12.0.
  437. .UNINDENT
  438. .UNINDENT
  439. .sp
  440. Post with the query parameters \fBdevice\fP and \fBaddr\fP to add entries to
  441. the discovery cache.
  442. .INDENT 0.0
  443. .INDENT 3.5
  444. .sp
  445. .nf
  446. .ft C
  447. curl \-X POST http://127.0.0.1:8384/rest/system/discovery?device=LGFPDIT7SKNNJVJZA4FC7QNCRKCE753K72BW5QD2FOZ7FRFEP57Q\e&addr=192.162.129.11:22000
  448. # Or with the X\-API\-Key header:
  449. 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
  450. .ft P
  451. .fi
  452. .UNINDENT
  453. .UNINDENT
  454. .SS POST /rest/system/error/clear
  455. .sp
  456. Post with empty to body to remove all recent errors.
  457. .SS GET /rest/system/error
  458. .sp
  459. \fBNOTE:\fP
  460. .INDENT 0.0
  461. .INDENT 3.5
  462. Return format changed in 0.12.0.
  463. .UNINDENT
  464. .UNINDENT
  465. .sp
  466. Returns the list of recent errors.
  467. .INDENT 0.0
  468. .INDENT 3.5
  469. .sp
  470. .nf
  471. .ft C
  472. {
  473. "errors": [
  474. {
  475. "when": "2014\-09\-18T12:59:26.549953186+02:00",
  476. "message": "This is an error string"
  477. }
  478. ]
  479. }
  480. .ft P
  481. .fi
  482. .UNINDENT
  483. .UNINDENT
  484. .SS POST /rest/system/error
  485. .sp
  486. Post with an error message in the body (plain text) to register a new
  487. error. The new error will be displayed on any active GUI clients.
  488. .SS GET /rest/system/log
  489. .sp
  490. New in version 0.12.0.
  491. .sp
  492. Returns the list of recent log entries.
  493. .INDENT 0.0
  494. .INDENT 3.5
  495. .sp
  496. .nf
  497. .ft C
  498. {
  499. "messages": [
  500. {
  501. "when": "2014\-09\-18T12:59:26.549953186+02:00",
  502. "message": "This is a log entry"
  503. }
  504. ]
  505. }
  506. .ft P
  507. .fi
  508. .UNINDENT
  509. .UNINDENT
  510. .SS POST /rest/system/pause
  511. .sp
  512. Pause the given device or all devices.
  513. .sp
  514. Takes the optional parameter \fBdevice\fP (device ID). When omitted,
  515. pauses all devices. Returns status 200 and no content upon success, or status
  516. 500 and a plain text error on failure.
  517. .SS GET /rest/system/ping
  518. .sp
  519. Returns a \fB{"ping": "pong"}\fP object.
  520. .INDENT 0.0
  521. .INDENT 3.5
  522. .sp
  523. .nf
  524. .ft C
  525. {
  526. "ping": "pong"
  527. }
  528. .ft P
  529. .fi
  530. .UNINDENT
  531. .UNINDENT
  532. .SS POST /rest/system/ping
  533. .sp
  534. Returns a \fB{"ping": "pong"}\fP object.
  535. .SS POST /rest/system/reset
  536. .sp
  537. Post with empty body to erase the current index database and restart
  538. Syncthing. With no query parameters, the entire database is erased from disk.
  539. By specifying the \fBfolder\fP parameter with a valid folder ID, only
  540. information for that folder will be erased:
  541. .INDENT 0.0
  542. .INDENT 3.5
  543. .sp
  544. .nf
  545. .ft C
  546. $ curl \-X POST \-H "X\-API\-Key: abc123" http://localhost:8384/rest/system/reset?folder=default
  547. .ft P
  548. .fi
  549. .UNINDENT
  550. .UNINDENT
  551. .sp
  552. \fBCaution\fP: See \fB\-reset\-database\fP for \fB\&.stfolder\fP creation side\-effect and caution regarding mountpoints.
  553. .SS POST /rest/system/restart
  554. .sp
  555. Post with empty body to immediately restart Syncthing.
  556. .SS POST /rest/system/resume
  557. .sp
  558. Resume the given device or all devices.
  559. .sp
  560. Takes the optional parameter \fBdevice\fP (device ID). When omitted,
  561. resumes all devices. Returns status 200 and no content upon success, or status
  562. 500 and a plain text error on failure.
  563. .SS POST /rest/system/shutdown
  564. .sp
  565. Post with empty body to cause Syncthing to exit and not restart.
  566. .SS GET /rest/system/status
  567. .sp
  568. Returns information about current system status and resource usage. The CPU percent value has been deprecated from the API and will always report 0.
  569. .INDENT 0.0
  570. .INDENT 3.5
  571. .sp
  572. .nf
  573. .ft C
  574. {
  575. "alloc": 30618136,
  576. "connectionServiceStatus": {
  577. "dynamic+https://relays.syncthing.net/endpoint": {
  578. "error": null,
  579. "lanAddresses": [
  580. "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"
  581. ],
  582. "wanAddresses": [
  583. "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"
  584. ]
  585. },
  586. "tcp://0.0.0.0:22000": {
  587. "error": null,
  588. "lanAddresses": [
  589. "tcp://0.0.0.0:22000"
  590. ],
  591. "wanAddresses": [
  592. "tcp://0.0.0.0:22000"
  593. ]
  594. }
  595. },
  596. "cpuPercent": 0,
  597. "discoveryEnabled": true,
  598. "discoveryErrors": {
  599. "global@https://discovery\-v4\-1.syncthing.net/v2/": "500 Internal Server Error",
  600. "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)",
  601. "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)",
  602. "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",
  603. "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",
  604. "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"
  605. },
  606. "discoveryMethods": 8,
  607. "goroutines": 49,
  608. "lastDialStatus": {
  609. "tcp://10.20.30.40": {
  610. "when": "2019\-05\-16T07:41:23Z",
  611. "error": "dial tcp 10.20.30.40:22000: i/o timeout"
  612. },
  613. "tcp://172.16.33.3:22000": {
  614. "when": "2019\-05\-16T07:40:43Z",
  615. "ok": true
  616. },
  617. "tcp://83.233.120.221:22000": {
  618. "when": "2019\-05\-16T07:41:13Z",
  619. "error": "dial tcp 83.233.120.221:22000: connect: connection refused"
  620. }
  621. },
  622. "myID": "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2",
  623. "pathSeparator": "/",
  624. "startTime": "2016\-06\-06T19:41:43.039284753+02:00",
  625. "sys": 42092792,
  626. "themes": [
  627. "default",
  628. "dark"
  629. ],
  630. "tilde": "/Users/jb",
  631. "uptime": 2635
  632. }
  633. .ft P
  634. .fi
  635. .UNINDENT
  636. .UNINDENT
  637. .sp
  638. New in version 1.2.0: The \fBlastDialStatus\fP dictionary contains the last error (or \fBnull\fP for
  639. success) for each peer address that Syncthing has attempted to contact.
  640. The \fBconnectionServiceStatus\fP entries gained \fB"error": null\fP
  641. attributes where previously there would be no \fBerror\fP attribute at all
  642. in the success case.
  643. .SS GET /rest/system/upgrade
  644. .sp
  645. Checks for a possible upgrade and returns an object describing the
  646. newest version and upgrade possibility.
  647. .INDENT 0.0
  648. .INDENT 3.5
  649. .sp
  650. .nf
  651. .ft C
  652. {
  653. "latest": "v0.14.47",
  654. "majorNewer": false,
  655. "newer": true,
  656. "running": "v0.14.46"
  657. }
  658. .ft P
  659. .fi
  660. .UNINDENT
  661. .UNINDENT
  662. .SS POST /rest/system/upgrade
  663. .sp
  664. Perform an upgrade to the newest released version and restart. Does
  665. nothing if there is no newer version than currently running.
  666. .SS GET /rest/system/version
  667. .sp
  668. Returns the current Syncthing version information.
  669. .INDENT 0.0
  670. .INDENT 3.5
  671. .sp
  672. .nf
  673. .ft C
  674. {
  675. "arch": "amd64",
  676. "longVersion": "syncthing v0.10.27+3\-gea8c3de (go1.4 darwin\-amd64 default) jb@syno 2015\-03\-16 11:01:29 UTC",
  677. "os": "darwin",
  678. "version": "v0.10.27+3\-gea8c3de"
  679. }
  680. .ft P
  681. .fi
  682. .UNINDENT
  683. .UNINDENT
  684. .SH CONFIG ENDPOINTS
  685. .SS Config Endpoints
  686. .sp
  687. New in version 1.12.0.
  688. .sp
  689. These endpoints facilitate access and modification of the configuration in a granular way. Config sent to the endpoints must be in the same
  690. format as returned by the corresponding GET request. When posting the
  691. configuration succeeds, the posted configuration is immediately applied, except
  692. for changes that require a restart. Query \fI\%/rest/system/config/insync\fP to check if
  693. a restart is required.
  694. .sp
  695. For all endpoints supporting \fBPATCH\fP, it takes the existing config and
  696. unmarshals the given JSON object on top of it. This means all child objects will
  697. replace the existing objects, not extend them. For example for
  698. \fBRawListenAddresses\(ga in options, which is an array of strings, sending
  699. \(ga\(ga{RawListenAddresses: ["tcp://10.0.0.2"]\fP will replace all existing listen
  700. addresses.
  701. .SS /rest/config
  702. .sp
  703. \fBGET\fP returns the entire config and \fBPUT\fP replaces it.
  704. .SS /rest/system/config/insync
  705. .sp
  706. \fBGET\fP returns whether the config is in sync, i.e. whether the running configuration is
  707. the same as that on disk or if a restart is required.
  708. .SS /rest/config/folders, /rest/config/devices
  709. .sp
  710. \fBGET\fP returns all folders respectively devices as an array. \fBPUT\fP takes an array and
  711. \fBPOST\fP a single object. In both cases if a given folder/device already exists,
  712. it’s replaced, otherwise a new one is added.
  713. .SS /rest/config/folders/*id*, /rest/config/devices/*id*
  714. .sp
  715. Put the desired folder\- respectively device\-ID in place of *id*. \fBGET\fP
  716. returns the folder/device for the given ID, \fBPUT\fP replaces the entire config
  717. and \fBPATCH\fP replaces only the given child objects.
  718. .SS /rest/config/options, /rest/config/ldap, /rest/config/gui
  719. .sp
  720. \fBGET\fP returns the respective object, \fBPUT\fP replaces the entire object and
  721. \fBPATCH\fP replaces only the given child objects.
  722. .SH DATABASE ENDPOINTS
  723. .SS GET /rest/db/browse
  724. .sp
  725. Returns the directory tree of the global model. Directories are always
  726. JSON objects (map/dictionary), and files are always arrays of
  727. modification time and size. The first integer is the files modification
  728. time, and the second integer is the file size.
  729. .sp
  730. The call takes one mandatory \fBfolder\fP parameter and two optional
  731. parameters. Optional parameter \fBlevels\fP defines how deep within the
  732. tree we want to dwell down (0 based, defaults to unlimited depth)
  733. Optional parameter \fBprefix\fP defines a prefix within the tree where to
  734. start building the structure.
  735. .INDENT 0.0
  736. .INDENT 3.5
  737. .sp
  738. .nf
  739. .ft C
  740. $ curl \-s http://localhost:8384/rest/db/browse?folder=default | json_pp
  741. {
  742. "directory": {
  743. "file": ["2015\-04\-20T22:20:45+09:00", 130940928],
  744. "subdirectory": {
  745. "another file": ["2015\-04\-20T22:20:45+09:00", 130940928]
  746. }
  747. },
  748. "rootfile": ["2015\-04\-20T22:20:45+09:00", 130940928]
  749. }
  750. $ curl \-s http://localhost:8384/rest/db/browse?folder=default&levels=0 | json_pp
  751. {
  752. "directory": {},
  753. "rootfile": ["2015\-04\-20T22:20:45+09:00", 130940928]
  754. }
  755. $ curl \-s http://localhost:8384/rest/db/browse?folder=default&levels=1 | json_pp
  756. {
  757. "directory": {
  758. "file": ["2015\-04\-20T22:20:45+09:00", 130940928],
  759. "subdirectory": {}
  760. },
  761. "rootfile": ["2015\-04\-20T22:20:45+09:00", 130940928]
  762. }
  763. $ curl \-s http://localhost:8384/rest/db/browse?folder=default&prefix=directory/subdirectory | json_pp
  764. {
  765. "another file": ["2015\-04\-20T22:20:45+09:00", 130940928]
  766. }
  767. $ curl \-s http://localhost:8384/rest/db/browse?folder=default&prefix=directory&levels=0 | json_pp
  768. {
  769. "file": ["2015\-04\-20T22:20:45+09:00", 130940928],
  770. "subdirectory": {}
  771. }
  772. .ft P
  773. .fi
  774. .UNINDENT
  775. .UNINDENT
  776. .sp
  777. \fBNOTE:\fP
  778. .INDENT 0.0
  779. .INDENT 3.5
  780. This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
  781. .UNINDENT
  782. .UNINDENT
  783. .SS GET /rest/db/completion
  784. .sp
  785. Returns the completion percentage (0 to 100) and byte / item counts. Takes
  786. optional \fBdevice\fP and \fBfolder\fP parameters:
  787. .INDENT 0.0
  788. .IP \(bu 2
  789. \fBfolder\fP specifies the folder ID to calculate completion for. An empty
  790. or absent \fBfolder\fP parameter means all folders as an aggregate.
  791. .IP \(bu 2
  792. \fBdevice\fP specifies the device ID to calculate completion for. An empty
  793. or absent \fBdevice\fP parameter means the local device.
  794. .UNINDENT
  795. .sp
  796. If a device is specified but no folder, completion is calculated for all
  797. folders shared with that device.
  798. .SS Example Queries
  799. .sp
  800. Completion status for folder \fBabcd\-1234\fP on device \fBI6KAH76\-...\-3PSROAU\fP:
  801. .INDENT 0.0
  802. .INDENT 3.5
  803. .sp
  804. .nf
  805. .ft C
  806. /rest/db/completion?folder=abcd\-1234&device=I6KAH76\-...\-3PSROAU
  807. .ft P
  808. .fi
  809. .UNINDENT
  810. .UNINDENT
  811. .sp
  812. Aggregated completion status for device \fBI6KAH76\-...\-3PSROAU\fP (all folders shared with them):
  813. .INDENT 0.0
  814. .INDENT 3.5
  815. .sp
  816. .nf
  817. .ft C
  818. /rest/db/completion?device=I6KAH76\-...\-3PSROAU
  819. .ft P
  820. .fi
  821. .UNINDENT
  822. .UNINDENT
  823. .sp
  824. Completion status for folder \fBabcd\-1234\fP on the local device:
  825. .INDENT 0.0
  826. .INDENT 3.5
  827. .sp
  828. .nf
  829. .ft C
  830. /rest/db/completion?folder=abcd\-1234
  831. .ft P
  832. .fi
  833. .UNINDENT
  834. .UNINDENT
  835. .sp
  836. Aggregated completion status for all folders on the local device:
  837. .INDENT 0.0
  838. .INDENT 3.5
  839. .sp
  840. .nf
  841. .ft C
  842. /rest/db/completion
  843. .ft P
  844. .fi
  845. .UNINDENT
  846. .UNINDENT
  847. .SS Example Response
  848. .INDENT 0.0
  849. .INDENT 3.5
  850. .sp
  851. .nf
  852. .ft C
  853. {
  854. "completion": 99.9937565835,
  855. "globalBytes": 156793013575,
  856. "needBytes": 9789241,
  857. "globalItems": 7823,
  858. "needItems": 412,
  859. "needDeletes": 0
  860. }
  861. .ft P
  862. .fi
  863. .UNINDENT
  864. .UNINDENT
  865. .sp
  866. New in version 1.8.0: The ability to aggregate multiple folders by leaving out the folder ID.
  867. Querying data for the local device by leaving out the device ID. Returning
  868. the \fBglobalItems\fP counter in the response.
  869. .SS GET /rest/db/file
  870. .sp
  871. Returns most data available about a given file, including version and
  872. availability. Takes \fBfolder\fP and \fBfile\fP parameters.
  873. .INDENT 0.0
  874. .INDENT 3.5
  875. .sp
  876. .nf
  877. .ft C
  878. {
  879. "availability": [
  880. {
  881. "id": "ITZRNXE\-YNROGBZ\-HXTH5P7\-VK5NYE5\-QHRQGE2\-7JQ6VNJ\-KZUEDIU\-5PPR5AM",
  882. "fromTemporary": false
  883. }
  884. ],
  885. "global": {
  886. "deleted": false,
  887. "ignored": false,
  888. "invalid": false,
  889. "localFlags": 0,
  890. "modified": "2018\-08\-18T12:21:13.836784059+02:00",
  891. "modifiedBy": "SYNO4VL",
  892. "mustRescan": false,
  893. "name": "testfile",
  894. "noPermissions": false,
  895. "numBlocks": 1,
  896. "permissions": "0755",
  897. "sequence": 107499,
  898. "size": 1234,
  899. "type": 0,
  900. "version": [
  901. "SYNO4VL:1"
  902. ]
  903. },
  904. "local": {
  905. "deleted": false,
  906. "ignored": false,
  907. "invalid": false,
  908. "localFlags": 0,
  909. "modified": "2018\-08\-18T12:21:13.836784059+02:00",
  910. "modifiedBy": "SYNO4VL",
  911. "mustRescan": false,
  912. "name": "testfile",
  913. "noPermissions": false,
  914. "numBlocks": 1,
  915. "permissions": "0755",
  916. "sequence": 111038,
  917. "size": 1234,
  918. "type": 0,
  919. "version": [
  920. "SYNO4VL:1"
  921. ]
  922. }
  923. }
  924. .ft P
  925. .fi
  926. .UNINDENT
  927. .UNINDENT
  928. .SS GET /rest/db/ignores
  929. .sp
  930. Takes one parameter, \fBfolder\fP, and returns the content of the
  931. \fB\&.stignore\fP as the \fBignore\fP field. A second field, \fBexpanded\fP,
  932. 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.
  933. .INDENT 0.0
  934. .INDENT 3.5
  935. .sp
  936. .nf
  937. .ft C
  938. {
  939. "ignore": [
  940. "(?i)/Backups"
  941. ],
  942. "expanded": [
  943. "(?i)Backups",
  944. "(?i)Backups/**"
  945. ]
  946. }
  947. .ft P
  948. .fi
  949. .UNINDENT
  950. .UNINDENT
  951. .SS POST /rest/db/ignores
  952. .sp
  953. Expects a format similar to the output of \fBGET\fP call, but only
  954. containing the \fBignore\fP field (\fBexpanded\fP field should be omitted).
  955. It takes one parameter, \fBfolder\fP, and either updates the content of
  956. the \fB\&.stignore\fP echoing it back as a response, or returns an error.
  957. .SS GET /rest/db/need
  958. .sp
  959. Takes one mandatory parameter, \fBfolder\fP, and returns lists of files which are
  960. needed by this device in order for it to become in sync.
  961. .sp
  962. Furthermore takes an optional \fBpage\fP and \fBperpage\fP arguments for pagination.
  963. Pagination happens, across the union of all needed files, that is \- across all
  964. 3 sections of the response.
  965. For example, given the current need state is as follows:
  966. .INDENT 0.0
  967. .IP 1. 3
  968. \fBprogress\fP has 15 items
  969. .IP 2. 3
  970. \fBqueued\fP has 3 items
  971. .IP 3. 3
  972. \fBrest\fP has 12 items
  973. .UNINDENT
  974. .sp
  975. If you issue a query with \fBpage=1\fP and \fBperpage=10\fP, only the \fBprogress\fP
  976. section in the response will have 10 items. If you issue a request query with
  977. \fBpage=2\fP and \fBperpage=10\fP, \fBprogress\fP section will have the last 5 items,
  978. \fBqueued\fP section will have all 3 items, and \fBrest\fP section will have first
  979. 2 items. If you issue a query for \fBpage=3\fP and \fBperpage=10\fP, you will only
  980. have the last 10 items of the \fBrest\fP section.
  981. .sp
  982. In all these calls, \fBtotal\fP will be 30 to indicate the total number of
  983. available items.
  984. .INDENT 0.0
  985. .INDENT 3.5
  986. .sp
  987. .nf
  988. .ft C
  989. {
  990. # Files currently being downloaded
  991. "progress": [
  992. {
  993. "flags": "0755",
  994. "sequence": 6,
  995. "modified": "2015\-04\-20T23:06:12+09:00",
  996. "name": "ls",
  997. "size": 34640,
  998. "version": [
  999. "5157751870738175669:1"
  1000. ]
  1001. }
  1002. ],
  1003. # Files queued to be downloaded next (as per array order)
  1004. "queued": [
  1005. ...
  1006. ],
  1007. # Files to be downloaded after all queued files will be downloaded.
  1008. # This happens when we start downloading files, and new files get added while we are downloading.
  1009. "rest": [
  1010. ...
  1011. ],
  1012. "page": 1,
  1013. "perpage": 100,
  1014. "total": 2000
  1015. }
  1016. .ft P
  1017. .fi
  1018. .UNINDENT
  1019. .UNINDENT
  1020. .sp
  1021. \fBNOTE:\fP
  1022. .INDENT 0.0
  1023. .INDENT 3.5
  1024. This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
  1025. .UNINDENT
  1026. .UNINDENT
  1027. .SS POST /rest/db/override
  1028. .sp
  1029. Request override of a send only folder. Override means to make the local
  1030. version latest, overriding changes made on other devices. This API call does
  1031. nothing if the folder is not a send only folder.
  1032. .sp
  1033. Takes the mandatory parameter \fIfolder\fP (folder ID).
  1034. .INDENT 0.0
  1035. .INDENT 3.5
  1036. .sp
  1037. .nf
  1038. .ft C
  1039. curl \-X POST \-H X\-API\-key:... http://127.0.0.1:8384/rest/db/override?folder=default
  1040. .ft P
  1041. .fi
  1042. .UNINDENT
  1043. .UNINDENT
  1044. .SS POST /rest/db/prio
  1045. .sp
  1046. Moves the file to the top of the download queue.
  1047. .INDENT 0.0
  1048. .INDENT 3.5
  1049. .sp
  1050. .nf
  1051. .ft C
  1052. curl \-X POST http://127.0.0.1:8384/rest/db/prio?folder=default&file=foo/bar
  1053. .ft P
  1054. .fi
  1055. .UNINDENT
  1056. .UNINDENT
  1057. .sp
  1058. Response contains the same output as \fBGET /rest/db/need\fP
  1059. .SS POST /rest/db/revert
  1060. .sp
  1061. New in version 0.14.50.
  1062. .sp
  1063. Request revert of a receive only folder. Reverting a folder means to undo
  1064. all local changes. This API call does nothing if the folder is not a receive
  1065. only folder.
  1066. .sp
  1067. Takes the mandatory parameter \fIfolder\fP (folder ID).
  1068. .INDENT 0.0
  1069. .INDENT 3.5
  1070. .sp
  1071. .nf
  1072. .ft C
  1073. curl \-X POST \-H X\-API\-Key:... http://127.0.0.1:8384/rest/db/revert?folder=default
  1074. .ft P
  1075. .fi
  1076. .UNINDENT
  1077. .UNINDENT
  1078. .SS POST /rest/db/scan
  1079. .sp
  1080. Request immediate scan. Takes the optional parameters \fBfolder\fP (folder ID),
  1081. \fBsub\fP (path relative to the folder root) and \fBnext\fP (time in seconds). If
  1082. \fBfolder\fP is omitted or empty all folders are scanned. If \fBsub\fP is given,
  1083. only this path (and children, in case it’s a directory) is scanned. The \fBnext\fP
  1084. argument delays Syncthing’s automated rescan interval for a given amount of
  1085. seconds.
  1086. .sp
  1087. Requesting scan of a path that no longer exists, but previously did, is
  1088. valid and will result in Syncthing noticing the deletion of the path in
  1089. question.
  1090. .sp
  1091. Returns status 200 and no content upon success, or status 500 and a
  1092. plain text error if an error occurred during scanning.
  1093. .INDENT 0.0
  1094. .INDENT 3.5
  1095. .sp
  1096. .nf
  1097. .ft C
  1098. curl \-X POST http://127.0.0.1:8384/rest/db/scan?folder=default&sub=foo/bar
  1099. .ft P
  1100. .fi
  1101. .UNINDENT
  1102. .UNINDENT
  1103. .SS GET /rest/db/status
  1104. .sp
  1105. Returns information about the current status of a folder.
  1106. .sp
  1107. Parameters: \fBfolder\fP, the ID of a folder.
  1108. .INDENT 0.0
  1109. .INDENT 3.5
  1110. .sp
  1111. .nf
  1112. .ft C
  1113. {
  1114. "globalBytes": 0,
  1115. "globalDeleted": 0,
  1116. "globalDirectories": 0,
  1117. "globalFiles": 0,
  1118. "globalSymlinks": 0,
  1119. "globalTotalItems": 0,
  1120. "ignorePatterns": false,
  1121. "inSyncBytes": 0,
  1122. "inSyncFiles": 0,
  1123. "invalid": "",
  1124. "localBytes": 0,
  1125. "localDeleted": 0,
  1126. "localDirectories": 0,
  1127. "localFiles": 0,
  1128. "localSymlinks": 0,
  1129. "localTotalItems": 0,
  1130. "needBytes": 0,
  1131. "needDeletes": 0,
  1132. "needDirectories": 0,
  1133. "needFiles": 0,
  1134. "needSymlinks": 0,
  1135. "needTotalItems": 0,
  1136. "pullErrors": 0,
  1137. "receiveOnlyChangedBytes": 0,
  1138. "receiveOnlyChangedDeletes": 0,
  1139. "receiveOnlyChangedDirectories": 0,
  1140. "receiveOnlyChangedFiles": 0,
  1141. "receiveOnlyChangedSymlinks": 0,
  1142. "receiveOnlyTotalItems": 0,
  1143. "sequence": 0,
  1144. "state": "idle",
  1145. "stateChanged": "2018\-08\-08T07:04:57.301064781+02:00",
  1146. "version": 0
  1147. }
  1148. .ft P
  1149. .fi
  1150. .UNINDENT
  1151. .UNINDENT
  1152. .sp
  1153. The various fields have the following meaning:
  1154. .INDENT 0.0
  1155. .TP
  1156. .B global*:
  1157. Data in the cluster latest version.
  1158. .TP
  1159. .B inSync*:
  1160. Data that is locally the same as the cluster latest version.
  1161. .TP
  1162. .B local*:
  1163. Data that is locally present, regardless of whether it’s the same or different version as the cluster latest version.
  1164. .TP
  1165. .B need*:
  1166. Data that is needed to become up to date with the cluster latest version (i.e., data that is out of sync).
  1167. .TP
  1168. .B receiveOnlyChanged*:
  1169. Data that has changed locally in a receive only folder, and thus not been sent to the cluster.
  1170. .TP
  1171. .B invalid:
  1172. Deprecated, always empty.
  1173. .TP
  1174. .B pullErrors:
  1175. The number of files that failed to sync during the last sync operations.
  1176. .TP
  1177. .B sequence:
  1178. The current folder sequence number.
  1179. .TP
  1180. .B state:
  1181. The current folder state.
  1182. .TP
  1183. .B stateChanged:
  1184. When the folder state last changed.
  1185. .TP
  1186. .B version:
  1187. Deprecated, equivalent to the sequence number.
  1188. .UNINDENT
  1189. .sp
  1190. \fBNOTE:\fP
  1191. .INDENT 0.0
  1192. .INDENT 3.5
  1193. This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
  1194. .UNINDENT
  1195. .UNINDENT
  1196. .SH EVENT ENDPOINTS
  1197. .SS GET /rest/events
  1198. .sp
  1199. To receive events, perform a HTTP GET of \fB/rest/events\fP\&.
  1200. .sp
  1201. To filter the event list, in effect creating a specific subscription for
  1202. only the desired event types, add a parameter
  1203. \fBevents=EventTypeA,EventTypeB,...\fP where the event types are any of the event\-types\&.
  1204. .sp
  1205. The optional parameter \fBsince=<lastSeenID>\fP sets the ID of the last event
  1206. you’ve already seen. Syncthing returns a JSON encoded array of event objects,
  1207. starting at the event just after the one with this last seen ID. The default
  1208. value is 0, which returns all events. There is a limit to the number of events
  1209. buffered, so if the rate of events is high or the time between polling calls is
  1210. long some events might be missed. This can be detected by noting a discontinuity
  1211. in the event IDs.
  1212. .sp
  1213. If no new events are produced since \fB<lastSeenID>\fP, the HTTP call blocks and
  1214. waits for new events to happen before returning. By default it times out after
  1215. 60 seconds returning an empty array. The time out duration can be customized
  1216. with the optional parameter \fBtimeout=<seconds>\fP\&.
  1217. .sp
  1218. To receive only a limited number of events, add the \fBlimit=<n>\fP parameter with a
  1219. suitable value for \fBn\fP and only the \fIlast\fP \fBn\fP events will be returned. This
  1220. can be used to catch up with the latest event ID after a disconnection for
  1221. example: \fB/rest/events?since=0&limit=1\fP\&.
  1222. .SH STATISTICS ENDPOINTS
  1223. .SS GET /rest/stats/device
  1224. .sp
  1225. Returns general statistics about devices. Currently, only contains the
  1226. time the device was last seen.
  1227. .INDENT 0.0
  1228. .INDENT 3.5
  1229. .sp
  1230. .nf
  1231. .ft C
  1232. $ curl \-s http://localhost:8384/rest/stats/device | json
  1233. {
  1234. "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2": {
  1235. "lastSeen" : "2015\-04\-18T11:21:31.3256277+01:00"
  1236. }
  1237. }
  1238. .ft P
  1239. .fi
  1240. .UNINDENT
  1241. .UNINDENT
  1242. .SS GET /rest/stats/folder
  1243. .sp
  1244. Returns general statistics about folders. Currently contains the
  1245. last scan time and the last synced file.
  1246. .INDENT 0.0
  1247. .INDENT 3.5
  1248. .sp
  1249. .nf
  1250. .ft C
  1251. $ curl \-s http://localhost:8384/rest/stats/folder | json
  1252. {
  1253. "folderid" : {
  1254. "lastScan": "2016\-06\-02T13:28:01.288181412\-04:00",
  1255. "lastFile" : {
  1256. "filename" : "file/name",
  1257. "at" : "2015\-04\-16T22:04:18.3066971+01:00"
  1258. }
  1259. }
  1260. }
  1261. .ft P
  1262. .fi
  1263. .UNINDENT
  1264. .UNINDENT
  1265. .SH MISC SERVICES ENDPOINTS
  1266. .SS GET /rest/svc/deviceid
  1267. .sp
  1268. Verifies and formats a device ID. Accepts all currently valid formats
  1269. (52 or 56 characters with or without separators, upper or lower case,
  1270. with trivial substitutions). Takes one parameter, \fBid\fP, and returns
  1271. either a valid device ID in modern format, or an error.
  1272. .INDENT 0.0
  1273. .INDENT 3.5
  1274. .sp
  1275. .nf
  1276. .ft C
  1277. $ curl \-s http://localhost:8384/rest/svc/deviceid?id=1234 | json
  1278. {
  1279. "error": "device ID invalid: incorrect length"
  1280. }
  1281. $ curl \-s http://localhost:8384/rest/svc/deviceid?id=p56ioi7m\-\-zjnu2iq\-gdr\-eydm\-2mgtmgl3bxnpq6w5btbbz4tjxzwicq | json
  1282. {
  1283. "id": "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2"
  1284. }
  1285. .ft P
  1286. .fi
  1287. .UNINDENT
  1288. .UNINDENT
  1289. .SS GET /rest/svc/lang
  1290. .sp
  1291. Returns a list of canonicalized localization codes, as picked up from
  1292. the \fBAccept\-Language\fP header sent by the browser.
  1293. .INDENT 0.0
  1294. .INDENT 3.5
  1295. .sp
  1296. .nf
  1297. .ft C
  1298. ["sv_sv","sv","en_us","en"]
  1299. .ft P
  1300. .fi
  1301. .UNINDENT
  1302. .UNINDENT
  1303. .SS GET /rest/svc/random/string
  1304. .sp
  1305. Returns a strong random generated string (alphanumeric) of the specified length. Takes the \fBlength\fP parameter.
  1306. .INDENT 0.0
  1307. .INDENT 3.5
  1308. .sp
  1309. .nf
  1310. .ft C
  1311. {
  1312. "random": "FdPaEaZQ56sXEKYNxpgF"
  1313. }
  1314. .ft P
  1315. .fi
  1316. .UNINDENT
  1317. .UNINDENT
  1318. .SS GET /rest/svc/report
  1319. .sp
  1320. Returns the data sent in the anonymous usage report.
  1321. .INDENT 0.0
  1322. .INDENT 3.5
  1323. .sp
  1324. .nf
  1325. .ft C
  1326. {
  1327. "folderMaxMiB" : 0,
  1328. "platform" : "linux\-amd64",
  1329. "totMiB" : 0,
  1330. "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",
  1331. "upgradeAllowedManual" : true,
  1332. "totFiles" : 3,
  1333. "folderUses" : {
  1334. "ignorePerms" : 0,
  1335. "autoNormalize" : 0,
  1336. "sendonly" : 0,
  1337. "ignoreDelete" : 0
  1338. },
  1339. "memoryUsageMiB" : 13,
  1340. "version" : "v0.12.2",
  1341. "sha256Perf" : 27.28,
  1342. "numFolders" : 2,
  1343. "memorySize" : 1992,
  1344. "announce" : {
  1345. "defaultServersIP" : 0,
  1346. "otherServers" : 0,
  1347. "globalEnabled" : false,
  1348. "defaultServersDNS" : 1,
  1349. "localEnabled" : false
  1350. },
  1351. "usesRateLimit" : false,
  1352. "numCPU" : 2,
  1353. "uniqueID" : "",
  1354. "urVersion" : 2,
  1355. "rescanIntvs" : [
  1356. 60,
  1357. 60
  1358. ],
  1359. "numDevices" : 2,
  1360. "folderMaxFiles" : 3,
  1361. "relays" : {
  1362. "defaultServers" : 1,
  1363. "enabled" : true,
  1364. "otherServers" : 0
  1365. },
  1366. "deviceUses" : {
  1367. "compressMetadata" : 1,
  1368. "customCertName" : 0,
  1369. "staticAddr" : 1,
  1370. "compressAlways" : 0,
  1371. "compressNever" : 1,
  1372. "introducer" : 0,
  1373. "dynamicAddr" : 1
  1374. },
  1375. "upgradeAllowedAuto" : false
  1376. }
  1377. .ft P
  1378. .fi
  1379. .UNINDENT
  1380. .UNINDENT
  1381. .SH AUTHOR
  1382. The Syncthing Authors
  1383. .SH COPYRIGHT
  1384. 2014-2019, The Syncthing Authors
  1385. .\" Generated by docutils manpage writer.
  1386. .