syncthing-rest-api.7 45 KB

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