syncthing-rest-api.7 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .TH "SYNCTHING-REST-API" "7" "Jul 24, 2018" "v0.14" "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\&.
  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. Returns the current configuration.
  91. .INDENT 0.0
  92. .INDENT 3.5
  93. .sp
  94. .nf
  95. .ft C
  96. {
  97. {
  98. "version": 15,
  99. "folders": [
  100. {
  101. "id": "GXWxf\-3zgnU",
  102. "label": "MyFolder",
  103. "path": "...",
  104. "type": "sendreceive",
  105. "devices": [
  106. {
  107. "deviceID": "..."
  108. }
  109. ],
  110. "rescanIntervalS": 60,
  111. "ignorePerms": false,
  112. "autoNormalize": true,
  113. "minDiskFreePct": 1,
  114. "versioning": {
  115. "type": "simple",
  116. "params": {
  117. "keep": "5"
  118. }
  119. },
  120. "copiers": 0,
  121. "pullers": 0,
  122. "hashers": 0,
  123. "order": "random",
  124. "ignoreDelete": false,
  125. "scanProgressIntervalS": 0,
  126. "pullerSleepS": 0,
  127. "pullerPauseS": 0,
  128. "maxConflicts": 10,
  129. "disableSparseFiles": false,
  130. "disableTempIndexes": false,
  131. "fsync": false,
  132. "invalid": ""
  133. }
  134. ],
  135. "devices": [
  136. {
  137. "deviceID": "...",
  138. "name": "Laptop",
  139. "addresses": [
  140. "dynamic",
  141. "tcp://192.168.1.2:22000"
  142. ],
  143. "compression": "metadata",
  144. "certName": "",
  145. "introducer": false
  146. }
  147. ],
  148. "gui": {
  149. "enabled": true,
  150. "address": "127.0.0.1:8384",
  151. "user": "Username",
  152. "password": "$2a$10$ZFws69T4FlvWwsqeIwL.TOo5zOYqsa/.TxlUnsGYS.j3JvjFTmxo6",
  153. "useTLS": false,
  154. "apiKey": "pGahcht56664QU5eoFQW6szbEG6Ec2Cr",
  155. "insecureAdminAccess": false,
  156. "theme": "default"
  157. },
  158. "options": {
  159. "listenAddresses": [
  160. "default"
  161. ],
  162. "globalAnnounceServers": [
  163. "default"
  164. ],
  165. "globalAnnounceEnabled": true,
  166. "localAnnounceEnabled": true,
  167. "localAnnouncePort": 21027,
  168. "localAnnounceMCAddr": "[ff12::8384]:21027",
  169. "maxSendKbps": 0,
  170. "maxRecvKbps": 0,
  171. "reconnectionIntervalS": 60,
  172. "relaysEnabled": true,
  173. "relayReconnectIntervalM": 10,
  174. "startBrowser": false,
  175. "natEnabled": true,
  176. "natLeaseMinutes": 60,
  177. "natRenewalMinutes": 30,
  178. "natTimeoutSeconds": 10,
  179. "urAccepted": \-1,
  180. "urUniqueId": "",
  181. "urURL": "https://data.syncthing.net/newdata",
  182. "urPostInsecurely": false,
  183. "urInitialDelayS": 1800,
  184. "restartOnWakeup": true,
  185. "autoUpgradeIntervalH": 12,
  186. "keepTemporariesH": 24,
  187. "cacheIgnoredFiles": false,
  188. "progressUpdateIntervalS": 5,
  189. "limitBandwidthInLan": false,
  190. "minHomeDiskFreePct": 1,
  191. "releasesURL": "https://upgrades.syncthing.net/meta.json",
  192. "alwaysLocalNets": [],
  193. "overwriteRemoteDeviceNamesOnConnect": false,
  194. "tempIndexMinBlocks": 10
  195. },
  196. "ignoredDevices": [],
  197. "ignoredFolders": []
  198. }
  199. }
  200. .ft P
  201. .fi
  202. .UNINDENT
  203. .UNINDENT
  204. .SS GET /rest/system/config/insync
  205. .sp
  206. Returns whether the config is in sync, i.e. whether the running
  207. configuration is the same as that on disk.
  208. .INDENT 0.0
  209. .INDENT 3.5
  210. .sp
  211. .nf
  212. .ft C
  213. {
  214. "configInSync": true
  215. }
  216. .ft P
  217. .fi
  218. .UNINDENT
  219. .UNINDENT
  220. .SS POST /rest/system/config
  221. .sp
  222. Post the full contents of the configuration, in the same format as returned by
  223. the corresponding GET request. The configuration will be saved to disk and the
  224. \fBconfigInSync\fP flag set to false. Restart Syncthing to activate.
  225. .SS GET /rest/system/connections
  226. .sp
  227. \fBNOTE:\fP
  228. .INDENT 0.0
  229. .INDENT 3.5
  230. Return format changed in 0.13.0.
  231. .UNINDENT
  232. .UNINDENT
  233. .sp
  234. Returns the list of configured devices and some metadata associated
  235. with them. The list also contains the local device itself as not connected.
  236. .sp
  237. The connection types are \fBTCP (Client)\fP, \fBTCP (Server)\fP, \fBRelay (Client)\fP and \fBRelay (Server)\fP\&.
  238. .INDENT 0.0
  239. .INDENT 3.5
  240. .sp
  241. .nf
  242. .ft C
  243. {
  244. "total" : {
  245. "paused" : false,
  246. "clientVersion" : "",
  247. "at" : "2015\-11\-07T17:29:47.691637262+01:00",
  248. "connected" : false,
  249. "inBytesTotal" : 1479,
  250. "type" : "",
  251. "outBytesTotal" : 1318,
  252. "address" : ""
  253. },
  254. "connections" : {
  255. "YZJBJFX\-RDBL7WY\-6ZGKJ2D\-4MJB4E7\-ZATSDUY\-LD6Y3L3\-MLFUYWE\-AEMXJAC" : {
  256. "connected" : true,
  257. "inBytesTotal" : 556,
  258. "paused" : false,
  259. "at" : "2015\-11\-07T17:29:47.691548971+01:00",
  260. "clientVersion" : "v0.12.1",
  261. "address" : "127.0.0.1:22002",
  262. "type" : "TCP (Client)",
  263. "outBytesTotal" : 550
  264. },
  265. "DOVII4U\-SQEEESM\-VZ2CVTC\-CJM4YN5\-QNV7DCU\-5U3ASRL\-YVFG6TH\-W5DV5AA" : {
  266. "outBytesTotal" : 0,
  267. "type" : "",
  268. "address" : "",
  269. "at" : "0001\-01\-01T00:00:00Z",
  270. "clientVersion" : "",
  271. "paused" : false,
  272. "inBytesTotal" : 0,
  273. "connected" : false
  274. },
  275. "UYGDMA4\-TPHOFO5\-2VQYDCC\-7CWX7XW\-INZINQT\-LE4B42N\-4JUZTSM\-IWCSXA4" : {
  276. "address" : "",
  277. "type" : "",
  278. "outBytesTotal" : 0,
  279. "connected" : false,
  280. "inBytesTotal" : 0,
  281. "paused" : false,
  282. "at" : "0001\-01\-01T00:00:00Z",
  283. "clientVersion" : ""
  284. }
  285. }
  286. }
  287. .ft P
  288. .fi
  289. .UNINDENT
  290. .UNINDENT
  291. .SS GET /rest/system/debug
  292. .sp
  293. New in version 0.12.0.
  294. .sp
  295. Returns the set of debug facilities and which of them are currently enabled.
  296. .INDENT 0.0
  297. .INDENT 3.5
  298. .sp
  299. .nf
  300. .ft C
  301. {
  302. "enabled": [
  303. "beacon"
  304. ],
  305. "facilities": {
  306. "beacon": "Multicast and broadcast discovery",
  307. "config": "Configuration loading and saving",
  308. "connections": "Connection handling",
  309. "db": "The database layer",
  310. "dialer": "Dialing connections",
  311. "discover": "Remote device discovery",
  312. "events": "Event generation and logging",
  313. "http": "REST API",
  314. "main": "Main package",
  315. "model": "The root hub",
  316. "protocol": "The BEP protocol",
  317. "relay": "Relay connection handling",
  318. "scanner": "File change detection and hashing",
  319. "stats": "Persistent device and folder statistics",
  320. "sync": "Mutexes",
  321. "upgrade": "Binary upgrades",
  322. "upnp": "UPnP discovery and port mapping",
  323. "versioner": "File versioning"
  324. }
  325. }
  326. .ft P
  327. .fi
  328. .UNINDENT
  329. .UNINDENT
  330. .SS POST /rest/system/debug
  331. .sp
  332. New in version 0.12.0.
  333. .sp
  334. Enables or disables debugging for specified facilities. Give one or both of
  335. \fBenable\fP and \fBdisable\fP query parameters, with comma separated facility
  336. names. To disable debugging of the beacon and discovery packages, and enable it
  337. for config and db:
  338. .INDENT 0.0
  339. .INDENT 3.5
  340. .sp
  341. .nf
  342. .ft C
  343. $ curl \-H X\-API\-Key:abc123 \-X POST \(aqhttp://localhost:8384/rest/system/debug?disable=beacon,discovery&enable=config,db\(aq
  344. .ft P
  345. .fi
  346. .UNINDENT
  347. .UNINDENT
  348. .SS GET /rest/system/discovery
  349. .sp
  350. Returns the contents of the local discovery cache.
  351. .INDENT 0.0
  352. .INDENT 3.5
  353. .sp
  354. .nf
  355. .ft C
  356. {
  357. "LGFPDIT7SKNNJVJZA4FC7QNCRKCE753K72BW5QD2FOZ7FRFEP57Q": [
  358. "192.162.129.11:22000"
  359. ]
  360. }
  361. .ft P
  362. .fi
  363. .UNINDENT
  364. .UNINDENT
  365. .SS POST /rest/system/discovery
  366. .sp
  367. \fBNOTE:\fP
  368. .INDENT 0.0
  369. .INDENT 3.5
  370. Removed in v0.12.0.
  371. .UNINDENT
  372. .UNINDENT
  373. .sp
  374. Post with the query parameters \fBdevice\fP and \fBaddr\fP to add entries to
  375. the discovery cache.
  376. .INDENT 0.0
  377. .INDENT 3.5
  378. .sp
  379. .nf
  380. .ft C
  381. curl \-X POST http://127.0.0.1:8384/rest/system/discovery?device=LGFPDIT7SKNNJVJZA4FC7QNCRKCE753K72BW5QD2FOZ7FRFEP57Q\e&addr=192.162.129.11:22000
  382. # Or with the X\-API\-Key header:
  383. 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
  384. .ft P
  385. .fi
  386. .UNINDENT
  387. .UNINDENT
  388. .SS POST /rest/system/error/clear
  389. .sp
  390. Post with empty to body to remove all recent errors.
  391. .SS GET /rest/system/error
  392. .sp
  393. \fBNOTE:\fP
  394. .INDENT 0.0
  395. .INDENT 3.5
  396. Return format changed in 0.12.0.
  397. .UNINDENT
  398. .UNINDENT
  399. .sp
  400. Returns the list of recent errors.
  401. .INDENT 0.0
  402. .INDENT 3.5
  403. .sp
  404. .nf
  405. .ft C
  406. {
  407. "errors": [
  408. {
  409. "when": "2014\-09\-18T12:59:26.549953186+02:00",
  410. "message": "This is an error string"
  411. }
  412. ]
  413. }
  414. .ft P
  415. .fi
  416. .UNINDENT
  417. .UNINDENT
  418. .SS POST /rest/system/error
  419. .sp
  420. Post with an error message in the body (plain text) to register a new
  421. error. The new error will be displayed on any active GUI clients.
  422. .SS GET /rest/system/log
  423. .sp
  424. New in version 0.12.0.
  425. .sp
  426. Returns the list of recent log entries.
  427. .INDENT 0.0
  428. .INDENT 3.5
  429. .sp
  430. .nf
  431. .ft C
  432. {
  433. "messages": [
  434. {
  435. "when": "2014\-09\-18T12:59:26.549953186+02:00",
  436. "message": "This is a log entry"
  437. }
  438. ]
  439. }
  440. .ft P
  441. .fi
  442. .UNINDENT
  443. .UNINDENT
  444. .SS POST /rest/system/pause
  445. .sp
  446. Pause the given device or all devices.
  447. .sp
  448. Takes the optional parameter \fBdevice\fP (device ID). When omitted,
  449. pauses all devices. Returns status 200 and no content upon success, or status
  450. 500 and a plain text error on failure.
  451. .SS GET /rest/system/ping
  452. .sp
  453. Returns a \fB{"ping": "pong"}\fP object.
  454. .INDENT 0.0
  455. .INDENT 3.5
  456. .sp
  457. .nf
  458. .ft C
  459. {
  460. "ping": "pong"
  461. }
  462. .ft P
  463. .fi
  464. .UNINDENT
  465. .UNINDENT
  466. .SS POST /rest/system/ping
  467. .sp
  468. Returns a \fB{"ping": "pong"}\fP object.
  469. .SS POST /rest/system/reset
  470. .sp
  471. Post with empty body to erase the current index database and restart
  472. Syncthing. With no query parameters, the entire database is erased from disk.
  473. By specifying the \fBfolder\fP parameter with a valid folder ID, only
  474. information for that folder will be erased:
  475. .INDENT 0.0
  476. .INDENT 3.5
  477. .sp
  478. .nf
  479. .ft C
  480. $ curl \-X POST \-H "X\-API\-Key: abc123" http://localhost:8384/rest/system/reset?folder=default
  481. .ft P
  482. .fi
  483. .UNINDENT
  484. .UNINDENT
  485. .sp
  486. \fBCaution\fP: See \fB\-reset\-database\fP for \fB\&.stfolder\fP creation side\-effect and caution regarding mountpoints.
  487. .SS POST /rest/system/restart
  488. .sp
  489. Post with empty body to immediately restart Syncthing.
  490. .SS POST /rest/system/resume
  491. .sp
  492. Resume the given device or all devices.
  493. .sp
  494. Takes the optional parameter \fBdevice\fP (device ID). When omitted,
  495. resumes all devices. Returns status 200 and no content upon success, or status
  496. 500 and a plain text error on failure.
  497. .SS POST /rest/system/shutdown
  498. .sp
  499. Post with empty body to cause Syncthing to exit and not restart.
  500. .SS GET /rest/system/status
  501. .sp
  502. Returns information about current system status and resource usage.
  503. .INDENT 0.0
  504. .INDENT 3.5
  505. .sp
  506. .nf
  507. .ft C
  508. {
  509. "alloc": 30618136,
  510. "connectionServiceStatus": {
  511. "dynamic+https://relays.syncthing.net/endpoint": {
  512. "lanAddresses": [
  513. "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"
  514. ],
  515. "wanAddresses": [
  516. "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"
  517. ]
  518. },
  519. "tcp://0.0.0.0:22000": {
  520. "lanAddresses": [
  521. "tcp://0.0.0.0:22000"
  522. ],
  523. "wanAddresses": [
  524. "tcp://0.0.0.0:22000"
  525. ]
  526. }
  527. },
  528. "cpuPercent": 0.006944836512046966,
  529. "discoveryEnabled": true,
  530. "discoveryErrors": {
  531. "global@https://discovery\-v4\-1.syncthing.net/v2/": "500 Internal Server Error",
  532. "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)",
  533. "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)",
  534. "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",
  535. "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",
  536. "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"
  537. },
  538. "discoveryMethods": 8,
  539. "goroutines": 49,
  540. "myID": "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2",
  541. "pathSeparator": "/",
  542. "startTime": "2016\-06\-06T19:41:43.039284753+02:00",
  543. "sys": 42092792,
  544. "themes": [
  545. "default",
  546. "dark"
  547. ],
  548. "tilde": "/Users/jb",
  549. "uptime": 2635
  550. }
  551. .ft P
  552. .fi
  553. .UNINDENT
  554. .UNINDENT
  555. .SS GET /rest/system/upgrade
  556. .sp
  557. Checks for a possible upgrade and returns an object describing the
  558. newest version and upgrade possibility.
  559. .INDENT 0.0
  560. .INDENT 3.5
  561. .sp
  562. .nf
  563. .ft C
  564. {
  565. "latest": "v0.14.47",
  566. "majorNewer": false,
  567. "newer": true,
  568. "running": "v0.14.46"
  569. }
  570. .ft P
  571. .fi
  572. .UNINDENT
  573. .UNINDENT
  574. .SS POST /rest/system/upgrade
  575. .sp
  576. Perform an upgrade to the newest released version and restart. Does
  577. nothing if there is no newer version than currently running.
  578. .SS GET /rest/system/version
  579. .sp
  580. Returns the current Syncthing version information.
  581. .INDENT 0.0
  582. .INDENT 3.5
  583. .sp
  584. .nf
  585. .ft C
  586. {
  587. "arch": "amd64",
  588. "longVersion": "syncthing v0.10.27+3\-gea8c3de (go1.4 darwin\-amd64 default) jb@syno 2015\-03\-16 11:01:29 UTC",
  589. "os": "darwin",
  590. "version": "v0.10.27+3\-gea8c3de"
  591. }
  592. .ft P
  593. .fi
  594. .UNINDENT
  595. .UNINDENT
  596. .SH DATABASE ENDPOINTS
  597. .SS GET /rest/db/browse
  598. .sp
  599. Returns the directory tree of the global model. Directories are always
  600. JSON objects (map/dictionary), and files are always arrays of
  601. modification time and size. The first integer is the files modification
  602. time, and the second integer is the file size.
  603. .sp
  604. The call takes one mandatory \fBfolder\fP parameter and two optional
  605. parameters. Optional parameter \fBlevels\fP defines how deep within the
  606. tree we want to dwell down (0 based, defaults to unlimited depth)
  607. Optional parameter \fBprefix\fP defines a prefix within the tree where to
  608. start building the structure.
  609. .INDENT 0.0
  610. .INDENT 3.5
  611. .sp
  612. .nf
  613. .ft C
  614. $ curl \-s http://localhost:8384/rest/db/browse?folder=default | json_pp
  615. {
  616. "directory": {
  617. "file": ["2015\-04\-20T22:20:45+09:00", 130940928],
  618. "subdirectory": {
  619. "another file": ["2015\-04\-20T22:20:45+09:00", 130940928]
  620. }
  621. },
  622. "rootfile": ["2015\-04\-20T22:20:45+09:00", 130940928]
  623. }
  624. $ curl \-s http://localhost:8384/rest/db/browse?folder=default&levels=0 | json_pp
  625. {
  626. "directory": {},
  627. "rootfile": ["2015\-04\-20T22:20:45+09:00", 130940928]
  628. }
  629. $ curl \-s http://localhost:8384/rest/db/browse?folder=default&levels=1 | json_pp
  630. {
  631. "directory": {
  632. "file": ["2015\-04\-20T22:20:45+09:00", 130940928],
  633. "subdirectory": {}
  634. },
  635. "rootfile": ["2015\-04\-20T22:20:45+09:00", 130940928]
  636. }
  637. $ curl \-s http://localhost:8384/rest/db/browse?folder=default&prefix=directory/subdirectory | json_pp
  638. {
  639. "another file": ["2015\-04\-20T22:20:45+09:00", 130940928]
  640. }
  641. $ curl \-s http://localhost:8384/rest/db/browse?folder=default&prefix=directory&levels=0 | json_pp
  642. {
  643. "file": ["2015\-04\-20T22:20:45+09:00", 130940928],
  644. "subdirectory": {}
  645. }
  646. .ft P
  647. .fi
  648. .UNINDENT
  649. .UNINDENT
  650. .sp
  651. \fBNOTE:\fP
  652. .INDENT 0.0
  653. .INDENT 3.5
  654. This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
  655. .UNINDENT
  656. .UNINDENT
  657. .SS GET /rest/db/completion
  658. .sp
  659. Returns the completion percentage (0 to 100) for a given device and
  660. folder. Takes \fBdevice\fP and \fBfolder\fP parameters.
  661. .INDENT 0.0
  662. .INDENT 3.5
  663. .sp
  664. .nf
  665. .ft C
  666. {
  667. "completion": 100,
  668. "globalBytes": 156793013575,
  669. "needBytes": 0,
  670. "needDeletes": 0
  671. }
  672. .ft P
  673. .fi
  674. .UNINDENT
  675. .UNINDENT
  676. .sp
  677. \fBNOTE:\fP
  678. .INDENT 0.0
  679. .INDENT 3.5
  680. This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
  681. .UNINDENT
  682. .UNINDENT
  683. .SS GET /rest/db/file
  684. .sp
  685. Returns most data available about a given file, including version and
  686. availability. Takes \fBfolder\fP and \fBfile\fP parameters.
  687. .INDENT 0.0
  688. .INDENT 3.5
  689. .sp
  690. .nf
  691. .ft C
  692. {
  693. "availability": [{
  694. "id": "I6KAH76\-66SLLLB\-5PFXSOA\-UFJCDZC\-YAOMLEK\-CP2GB32\-BV5RQST\-3PSROAU",
  695. "fromTemporary": false
  696. }],
  697. "global": {
  698. "deleted": false,
  699. "invalid": false,
  700. "flags": "0644",
  701. "sequence": 3,
  702. "modified": "2015\-04\-20T22:20:45+09:00",
  703. "modifiedBy": "I6KAH76",
  704. "noPermissions": false,
  705. "name": "util.go",
  706. "numBlocks": 1,
  707. "size": 9642,
  708. "type": 0,
  709. "version": [
  710. "I6KAH76:1"
  711. ]
  712. },
  713. "local": {
  714. "deleted": false,
  715. "invalid": false,
  716. "flags": "0644",
  717. "sequence": 4,
  718. "modified": "2015\-04\-20T22:20:45+09:00",
  719. "modifiedBy": "I6KAH76",
  720. "noPermissions": false,
  721. "name": "util.go",
  722. "numBlocks": 1,
  723. "size": 9642,
  724. "type": 0,
  725. "version": [
  726. "I6KAH76:1"
  727. ]
  728. }
  729. }
  730. .ft P
  731. .fi
  732. .UNINDENT
  733. .UNINDENT
  734. .SS GET /rest/db/ignores
  735. .sp
  736. Takes one parameter, \fBfolder\fP, and returns the content of the
  737. \fB\&.stignore\fP as the \fBignore\fP field. A second field, \fBexpanded\fP,
  738. 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.
  739. .INDENT 0.0
  740. .INDENT 3.5
  741. .sp
  742. .nf
  743. .ft C
  744. {
  745. "ignore": [
  746. "(?i)/Backups"
  747. ],
  748. "expanded": [
  749. "(?i)Backups",
  750. "(?i)Backups/**"
  751. ]
  752. }
  753. .ft P
  754. .fi
  755. .UNINDENT
  756. .UNINDENT
  757. .SS POST /rest/db/ignores
  758. .sp
  759. Expects a format similar to the output of \fBGET\fP call, but only
  760. containing the \fBignore\fP field (\fBexpanded\fP field should be omitted).
  761. It takes one parameter, \fBfolder\fP, and either updates the content of
  762. the \fB\&.stignore\fP echoing it back as a response, or returns an error.
  763. .SS GET /rest/db/need
  764. .sp
  765. Takes one mandatory parameter, \fBfolder\fP, and returns lists of files which are
  766. needed by this device in order for it to become in sync.
  767. .sp
  768. Furthermore takes an optional \fBpage\fP and \fBperpage\fP arguments for pagination.
  769. Pagination happens, across the union of all needed files, that is \- across all
  770. 3 sections of the response.
  771. For example, given the current need state is as follows:
  772. .INDENT 0.0
  773. .IP 1. 3
  774. \fBprogress\fP has 15 items
  775. .IP 2. 3
  776. \fBqueued\fP has 3 items
  777. .IP 3. 3
  778. \fBrest\fP has 12 items
  779. .UNINDENT
  780. .sp
  781. If you issue a query with \fBpage=1\fP and \fBperpage=10\fP, only the \fBprogress\fP
  782. section in the response will have 10 items. If you issue a request query with
  783. \fBpage=2\fP and \fBperpage=10\fP, \fBprogress\fP section will have the last 5 items,
  784. \fBqueued\fP section will have all 3 items, and \fBrest\fP section will have first
  785. 2 items. If you issue a query for \fBpage=3\fP and \fBperpage=10\fP, you will only
  786. have the last 10 items of the \fBrest\fP section.
  787. .sp
  788. In all these calls, \fBtotal\fP will be 30 to indicate the total number of
  789. available items.
  790. .INDENT 0.0
  791. .INDENT 3.5
  792. .sp
  793. .nf
  794. .ft C
  795. {
  796. # Files currently being downloaded
  797. "progress": [
  798. {
  799. "flags": "0755",
  800. "sequence": 6,
  801. "modified": "2015\-04\-20T23:06:12+09:00",
  802. "name": "ls",
  803. "size": 34640,
  804. "version": [
  805. "5157751870738175669:1"
  806. ]
  807. }
  808. ],
  809. # Files queued to be downloaded next (as per array order)
  810. "queued": [
  811. ...
  812. ],
  813. # Files to be downloaded after all queued files will be downloaded.
  814. # This happens when we start downloading files, and new files get added while we are downloading.
  815. "rest": [
  816. ...
  817. ],
  818. "page": 1,
  819. "perpage": 100,
  820. "total": 2000
  821. }
  822. .ft P
  823. .fi
  824. .UNINDENT
  825. .UNINDENT
  826. .sp
  827. \fBNOTE:\fP
  828. .INDENT 0.0
  829. .INDENT 3.5
  830. This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
  831. .UNINDENT
  832. .UNINDENT
  833. .SS POST /rest/db/override
  834. .sp
  835. Request override of a send only folder.
  836. Takes the mandatory parameter \fIfolder\fP (folder ID).
  837. .INDENT 0.0
  838. .INDENT 3.5
  839. .sp
  840. .nf
  841. .ft C
  842. curl \-X POST http://127.0.0.1:8384/rest/db/override?folder=default
  843. .ft P
  844. .fi
  845. .UNINDENT
  846. .UNINDENT
  847. .SS POST /rest/db/prio
  848. .sp
  849. Moves the file to the top of the download queue.
  850. .INDENT 0.0
  851. .INDENT 3.5
  852. .sp
  853. .nf
  854. .ft C
  855. curl \-X POST http://127.0.0.1:8384/rest/db/prio?folder=default&file=foo/bar
  856. .ft P
  857. .fi
  858. .UNINDENT
  859. .UNINDENT
  860. .sp
  861. Response contains the same output as \fBGET /rest/db/need\fP
  862. .SS POST /rest/db/scan
  863. .sp
  864. Request immediate scan. Takes the optional parameters \fBfolder\fP (folder ID),
  865. \fBsub\fP (path relative to the folder root) and \fBnext\fP (time in seconds). If
  866. \fBfolder\fP is omitted or empty all folders are scanned. If \fBsub\fP is given,
  867. only this path (and children, in case it’s a directory) is scanned. The \fBnext\fP
  868. argument delays Syncthing’s automated rescan interval for a given amount of
  869. seconds.
  870. .sp
  871. Requesting scan of a path that no longer exists, but previously did, is
  872. valid and will result in Syncthing noticing the deletion of the path in
  873. question.
  874. .sp
  875. Returns status 200 and no content upon success, or status 500 and a
  876. plain text error if an error occurred during scanning.
  877. .INDENT 0.0
  878. .INDENT 3.5
  879. .sp
  880. .nf
  881. .ft C
  882. curl \-X POST http://127.0.0.1:8384/rest/db/scan?folder=default&sub=foo/bar
  883. .ft P
  884. .fi
  885. .UNINDENT
  886. .UNINDENT
  887. .SS GET /rest/db/status
  888. .sp
  889. Returns information about the current status of a folder.
  890. .sp
  891. Parameters: \fBfolder\fP, the ID of a folder.
  892. .INDENT 0.0
  893. .INDENT 3.5
  894. .sp
  895. .nf
  896. .ft C
  897. {
  898. # latest version according to cluster:
  899. "globalBytes": 13173473780,
  900. "globalDeleted": 1847,
  901. "globalFiles": 42106,
  902. # what we have locally:
  903. "localBytes": 13173473780,
  904. "localDeleted": 1847,
  905. "localFiles": 42106,
  906. # which part of what we have locally is the latest cluster version:
  907. "inSyncBytes": 13173473780,
  908. "inSyncFiles": 42106,
  909. # which part of what we have locally should be fetched from the cluster:
  910. "needBytes": 0,
  911. "needFiles": 0,
  912. # various other metadata
  913. "ignorePatterns": true,
  914. "invalid": "",
  915. "state": "idle",
  916. "stateChanged": "2015\-03\-16T21:47:28.750853241+01:00",
  917. "version": 71989
  918. }
  919. .ft P
  920. .fi
  921. .UNINDENT
  922. .UNINDENT
  923. .sp
  924. \fBNOTE:\fP
  925. .INDENT 0.0
  926. .INDENT 3.5
  927. This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.
  928. .UNINDENT
  929. .UNINDENT
  930. .SH EVENT ENDPOINTS
  931. .SS GET /rest/events
  932. .sp
  933. To receive events, perform a HTTP GET of \fB/rest/events\fP\&.
  934. .sp
  935. To filter the event list, in effect creating a specific subscription for
  936. only the desired event types, add a parameter
  937. \fBevents=EventTypeA,EventTypeB,...\fP where the event types are any of the event\-types\&.
  938. .sp
  939. The optional parameter \fBsince=<lastSeenID>\fP sets the ID of the last event
  940. you’ve already seen. Syncthing returns a JSON encoded array of event objects,
  941. starting at the event just after the one with this last seen ID. The default
  942. value is 0, which returns all events. There is a limit to the number of events
  943. buffered, so if the rate of events is high or the time between polling calls is
  944. long some events might be missed. This can be detected by noting a discontinuity
  945. in the event IDs.
  946. .sp
  947. If no new events are produced since \fB<lastSeenID>\fP, the HTTP call blocks and
  948. waits for new events to happen before returning. By default it times out after
  949. 60 seconds returning an empty array. The time out duration can be customized
  950. with the optional parameter \fBtimeout=seconds\fP\&.
  951. .sp
  952. To receive only a limited number of events, add the \fBlimit=n\fP parameter with a
  953. suitable value for \fBn\fP and only the \fIlast\fP \fBn\fP events will be returned. This
  954. can be used to catch up with the latest event ID after a disconnection for
  955. example: \fB/rest/events?since=0&limit=1\fP\&.
  956. .SH STATISTICS ENDPOINTS
  957. .SS GET /rest/stats/device
  958. .sp
  959. Returns general statistics about devices. Currently, only contains the
  960. time the device was last seen.
  961. .INDENT 0.0
  962. .INDENT 3.5
  963. .sp
  964. .nf
  965. .ft C
  966. $ curl \-s http://localhost:8384/rest/stats/device | json
  967. {
  968. "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2": {
  969. "lastSeen" : "2015\-04\-18T11:21:31.3256277+01:00"
  970. }
  971. }
  972. .ft P
  973. .fi
  974. .UNINDENT
  975. .UNINDENT
  976. .SS GET /rest/stats/folder
  977. .sp
  978. Returns general statistics about folders. Currently contains the
  979. last scan time and the last synced file.
  980. .INDENT 0.0
  981. .INDENT 3.5
  982. .sp
  983. .nf
  984. .ft C
  985. $ curl \-s http://localhost:8384/rest/stats/folder | json
  986. {
  987. "folderid" : {
  988. "lastScan": "2016\-06\-02T13:28:01.288181412\-04:00",
  989. "lastFile" : {
  990. "filename" : "file/name",
  991. "at" : "2015\-04\-16T22:04:18.3066971+01:00"
  992. }
  993. }
  994. }
  995. .ft P
  996. .fi
  997. .UNINDENT
  998. .UNINDENT
  999. .SH MISC SERVICES ENDPOINTS
  1000. .SS GET /rest/svc/deviceid
  1001. .sp
  1002. Verifies and formats a device ID. Accepts all currently valid formats
  1003. (52 or 56 characters with or without separators, upper or lower case,
  1004. with trivial substitutions). Takes one parameter, \fBid\fP, and returns
  1005. either a valid device ID in modern format, or an error.
  1006. .INDENT 0.0
  1007. .INDENT 3.5
  1008. .sp
  1009. .nf
  1010. .ft C
  1011. $ curl \-s http://localhost:8384/rest/svc/deviceid?id=1234 | json
  1012. {
  1013. "error": "device ID invalid: incorrect length"
  1014. }
  1015. $ curl \-s http://localhost:8384/rest/svc/deviceid?id=p56ioi7m\-\-zjnu2iq\-gdr\-eydm\-2mgtmgl3bxnpq6w5btbbz4tjxzwicq | json
  1016. {
  1017. "id": "P56IOI7\-MZJNU2Y\-IQGDREY\-DM2MGTI\-MGL3BXN\-PQ6W5BM\-TBBZ4TJ\-XZWICQ2"
  1018. }
  1019. .ft P
  1020. .fi
  1021. .UNINDENT
  1022. .UNINDENT
  1023. .SS GET /rest/svc/lang
  1024. .sp
  1025. Returns a list of canonicalized localization codes, as picked up from
  1026. the \fBAccept\-Language\fP header sent by the browser.
  1027. .INDENT 0.0
  1028. .INDENT 3.5
  1029. .sp
  1030. .nf
  1031. .ft C
  1032. ["sv_sv","sv","en_us","en"]
  1033. .ft P
  1034. .fi
  1035. .UNINDENT
  1036. .UNINDENT
  1037. .SS GET /rest/svc/random/string
  1038. .sp
  1039. Returns a strong random generated string (alphanumeric) of the specified length. Takes the \fBlength\fP parameter.
  1040. .INDENT 0.0
  1041. .INDENT 3.5
  1042. .sp
  1043. .nf
  1044. .ft C
  1045. {
  1046. "random": "FdPaEaZQ56sXEKYNxpgF"
  1047. }
  1048. .ft P
  1049. .fi
  1050. .UNINDENT
  1051. .UNINDENT
  1052. .SS GET /rest/svc/report
  1053. .sp
  1054. Returns the data sent in the anonymous usage report.
  1055. .INDENT 0.0
  1056. .INDENT 3.5
  1057. .sp
  1058. .nf
  1059. .ft C
  1060. {
  1061. "folderMaxMiB" : 0,
  1062. "platform" : "linux\-amd64",
  1063. "totMiB" : 0,
  1064. "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",
  1065. "upgradeAllowedManual" : true,
  1066. "totFiles" : 3,
  1067. "folderUses" : {
  1068. "ignorePerms" : 0,
  1069. "autoNormalize" : 0,
  1070. "sendonly" : 0,
  1071. "ignoreDelete" : 0
  1072. },
  1073. "memoryUsageMiB" : 13,
  1074. "version" : "v0.12.2",
  1075. "sha256Perf" : 27.28,
  1076. "numFolders" : 2,
  1077. "memorySize" : 1992,
  1078. "announce" : {
  1079. "defaultServersIP" : 0,
  1080. "otherServers" : 0,
  1081. "globalEnabled" : false,
  1082. "defaultServersDNS" : 1,
  1083. "localEnabled" : false
  1084. },
  1085. "usesRateLimit" : false,
  1086. "numCPU" : 2,
  1087. "uniqueID" : "",
  1088. "urVersion" : 2,
  1089. "rescanIntvs" : [
  1090. 60,
  1091. 60
  1092. ],
  1093. "numDevices" : 2,
  1094. "folderMaxFiles" : 3,
  1095. "relays" : {
  1096. "defaultServers" : 1,
  1097. "enabled" : true,
  1098. "otherServers" : 0
  1099. },
  1100. "deviceUses" : {
  1101. "compressMetadata" : 1,
  1102. "customCertName" : 0,
  1103. "staticAddr" : 1,
  1104. "compressAlways" : 0,
  1105. "compressNever" : 1,
  1106. "introducer" : 0,
  1107. "dynamicAddr" : 1
  1108. },
  1109. "upgradeAllowedAuto" : false
  1110. }
  1111. .ft P
  1112. .fi
  1113. .UNINDENT
  1114. .UNINDENT
  1115. .SH AUTHOR
  1116. The Syncthing Authors
  1117. .SH COPYRIGHT
  1118. 2014-2018, The Syncthing Authors
  1119. .\" Generated by docutils manpage writer.
  1120. .