1SYNCTHING-EVENT-API(7)             Syncthing            SYNCTHING-EVENT-API(7)
2
3
4

NAME

6       syncthing-event-api - Event API
7

DESCRIPTION

9       Syncthing  provides a simple long polling interface for exposing events
10       from the core utility towards a GUI. To receive events, see events-get.
11

EVENT STRUCTURE

13       Each event is represented by an object similar to the following:
14
15          {
16              "id": 2,
17              "globalID": 3,
18              "type": "DeviceConnected",
19              "time": "2014-07-13T21:04:33.687836696+02:00",
20              "data": {
21                  "addr": "172.16.32.25:22000",
22                  "id": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG"
23              }
24          }
25
26       The top level keys  id,  globalID,  time,  type  and  data  are  always
27       present, though data may be null.
28
29       id     A  unique  ID  for  this  event on the events API. It always in‐
30              creases by 1: the first event generated has id 1, the  next  has
31              id  2  etc.  If  this increases by more than 1, then one or more
32              events have been skipped by the events API.
33
34       globalID
35              A global ID for this event, across the  events  API,  the  audit
36              log,  and any other sources. It may increase by more than 1, but
37              it will always be greater than or equal to the id.
38
39       time   The time the event was generated.
40
41       type   Indicates the type of (i.e. reason for) the event and is one  of
42              the event types below.
43
44       data   An  object  containing  optional  extra  information;  the exact
45              structure is determined by the event type.
46

EVENT TYPES

48   ConfigSaved
49       Emitted after the config has been saved by the user or by Syncthing it‐
50       self.
51
52          {
53              "id": 50,
54              "globalID": 50,
55              "type": "ConfigSaved",
56              "time": "2014-12-13T00:09:13.5166486Z",
57              "data": {
58                  "Version": 7,
59                  "Options": {"..."},
60                  "GUI": {"..."},
61                  "Devices": [{"..."}],
62                  "Folders": [{"..."}]
63              }
64          }
65
66   DeviceConnected
67       Generated each time a connection to a device has been established.
68
69          {
70              "id": 2,
71              "globalID": 2,
72              "type": "DeviceConnected",
73              "time": "2014-07-13T21:04:33.687836696+02:00",
74              "data": {
75                  "addr": "172.16.32.25:22000",
76                  "id": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG",
77                  "deviceName": "Laptop",
78                  "clientName": "syncthing",
79                  "clientVersion": "v0.13.4",
80                  "type": "TCP (Client)"
81              }
82          }
83
84   DeviceDisconnected
85       Generated each time a connection to a device has been terminated.
86
87          {
88              "id": 48,
89              "globalID": 48,
90              "type": "DeviceDisconnected",
91              "time": "2014-07-13T21:18:52.859929215+02:00",
92              "data": {
93                  "error": "unexpected EOF",
94                  "id": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG"
95              }
96          }
97
98       NOTE:
99          The  error key contains the cause for disconnection, which might not
100          necessarily be an error as such. Specifically, “EOF” and “unexpected
101          EOF”  both  signify  TCP  connection  termination, either due to the
102          other device restarting or going offline or due to a network change.
103
104   DeviceDiscovered
105       Emitted when a new device is discovered using local discovery.
106
107          {
108              "id": 13,
109              "globalID": 13,
110              "type": "DeviceDiscovered",
111              "time": "2014-07-17T13:28:05.043465207+02:00",
112              "data": {
113                  "addrs": [
114                      "172.16.32.25:22000"
115                  ],
116                  "device": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG"
117              }
118          }
119
120   DevicePaused
121       Emitted when a device was paused.
122
123          {
124              "id": 13,
125              "globalID": 13,
126              "type": "DevicePaused",
127              "time": "2014-07-17T13:28:05.043465207+02:00",
128              "data": {
129                  "device": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG"
130              }
131          }
132
133   DeviceRejected
134       Deprecated since version v1.13.0: This event is still emitted for  com‐
135       patibility,   but   deprecated.    Use   the   replacement  pending-de‐
136       vices-changed event instead.
137
138
139       Emitted when there is a connection from a device we are not  configured
140       to talk to.
141
142          {
143              "id": 24,
144              "globalID": 24,
145              "type": "DeviceRejected",
146              "time": "2014-08-19T10:43:00.562821045+02:00",
147              "data": {
148                  "address": "127.0.0.1:51807",
149                  "name": "My dusty computer",
150                  "device": "EJHMPAQ-OGCVORE-ISB4IS3-SYYVJXF-TKJGLTU-66DIQPF-GJ5D2GX-GQ3OWQK"
151              }
152          }
153
154   DeviceResumed
155       Generated each time a device was resumed.
156
157          {
158              "id": 2,
159              "globalID": 2,
160              "type": "DeviceResumed",
161              "time": "2014-07-13T21:04:33.687836696+02:00",
162              "data": {
163                  "device": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG"
164              }
165          }
166
167   DownloadProgress
168       Emitted during file downloads for each folder for each file. By default
169       only a single file in a folder is handled at the same time, but  custom
170       configuration can cause multiple files to be shown.
171
172          {
173              "id": 221,
174              "globalID": 221,
175              "type": "DownloadProgress",
176              "time": "2014-12-13T00:26:12.9876937Z",
177              "data": {
178                  "folder1": {
179                      "file1": {
180                          "total": 800,
181                          "pulling": 2,
182                          "copiedFromOrigin": 0,
183                          "reused": 633,
184                          "copiedFromElsewhere": 0,
185                          "pulled": 38,
186                          "bytesTotal": 104792064,
187                          "bytesDone": 87883776
188                      },
189                      "dir\\file2": {
190                          "total": 80,
191                          "pulling": 2,
192                          "copiedFromOrigin": 0,
193                          "reused": 0,
194                          "copiedFromElsewhere": 0,
195                          "pulled": 32,
196                          "bytesTotal": 10420224,
197                          "bytesDone": 4128768
198                      }
199                  },
200                  "folder2": {
201                      "file3": {
202                          "total": 800,
203                          "pulling": 2,
204                          "copiedFromOrigin": 0,
205                          "reused": 633,
206                          "copiedFromElsewhere": 0,
207                          "pulled": 38,
208                          "bytesTotal": 104792064,
209                          "bytesDone": 87883776
210                      },
211                      "dir\\file4": {
212                          "total": 80,
213                          "pulling": 2,
214                          "copiedFromOrigin": 0,
215                          "reused": 0,
216                          "copiedFromElsewhere": 0,
217                          "pulled": 32,
218                          "bytesTotal": 10420224,
219                          "bytesDone": 4128768
220                      }
221                  }
222              }
223          }
224
225total - total number of blocks in the file
226
227pulling - number of blocks currently being downloaded
228
229copiedFromOrigin - number of blocks copied from the file we are about
230         to replace
231
232reused - number of blocks reused from a previous temporary file
233
234copiedFromElsewhere - number of blocks copied from other files or po‐
235         tentially other folders
236
237pulled - number of blocks actually downloaded so far
238
239bytesTotal - approximate total file size
240
241bytesDone  -  approximate  number  of  bytes already handled (already
242         reused, copied or pulled)
243
244       Where block size is 128KB.
245
246       Files/folders appearing in the event data imply that the  download  has
247       been  started for that file/folder, where disappearing implies that the
248       downloads have been finished or failed for that file/folder.  There  is
249       always  a  last event emitted with no data, which implies all downloads
250       have finished/failed.
251
252   FolderCompletion
253       The FolderCompletion event is emitted when the local or remote contents
254       for a folder changes. It contains the completion percentage for a given
255       remote device and is emitted once per currently  connected  remote  de‐
256       vice.
257
258          {
259              "id": 84,
260              "globalID": 84,
261              "type": "FolderCompletion",
262              "time": "2015-04-17T14:14:27.043576583+09:00",
263              "data": {
264                  "completion": 100,
265                  "device": "I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU",
266                  "folder": "default"
267              }
268          }
269
270   FolderErrors
271       The  FolderErrors event is emitted when a folder cannot be successfully
272       synchronized. The event contains the ID of the affected  folder  and  a
273       list of errors for files or directories therein. This list of errors is
274       obsolete once the folder changes state to syncing -  if  errors  remain
275       after  the  next  synchronization  attempt, a new FolderErrors event is
276       emitted.
277
278          {
279              "id": 132,
280              "type": "FolderErrors",
281              "time": "2015-06-26T13:39:24.697401384+02:00",
282              "data": {
283                  "errors": [
284                      {
285                          "error": "open /Users/jb/src/github.com/syncthing/syncthing/test/s2/h2j/.syncthing.aslkjd.tmp: permission denied",
286                          "path": "h2j/aslkjd"
287                      }
288                  ],
289                  "folder": "default"
290              }
291          }
292
293       New in version 0.11.12.
294
295
296       SEE ALSO:
297          The statechanged event.
298
299   FolderRejected
300       Deprecated since version v1.13.0: This event is still emitted for  com‐
301       patibility,   but   deprecated.    Use  the  replacement  pending-fold‐
302       ers-changed event instead.
303
304
305       Emitted when a device sends index information for a folder  we  do  not
306       have, or have but do not share with the device in question.
307
308          {
309              "id": 27,
310              "globalID": 27,
311              "type": "FolderRejected",
312              "time": "2014-08-19T10:41:06.761751399+02:00",
313              "data": {
314                  "device": "EJHMPAQ-OGCVORE-ISB4IS3-SYYVJXF-TKJGLTU-66DIQPF-GJ5D2GX-GQ3OWQK",
315                  "folder": "GXWxf-3zgnU",
316                  "folderLabel": "My Pictures"
317              }
318          }
319
320   Folder Scan Progress
321       Emitted  in  regular intervals (folder setting ProgressIntervalS, 2s by
322       default) during scans giving the amount of bytes already scanned and to
323       be  scanned  in  total , as well as the current scanning rates in bytes
324       per second.
325
326          {
327             "data" : {
328                "total" : 1,
329                "rate" : 0,
330                "current" : 0,
331                "folder" : "bd7q3-zskm5"
332             },
333             "globalID" : 29,
334             "type" : "FolderScanProgress",
335             "time" : "2017-03-06T15:00:58.072004209+01:00",
336             "id" : 29
337          }
338
339   FolderSummary
340       The FolderSummary event is emitted when folder  contents  have  changed
341       locally.  This  can  be  used to calculate the current local completion
342       state.
343
344          {
345              "id": 16,
346              "globalID": 16,
347              "type": "FolderSummary",
348              "time": "2015-04-17T14:12:20.460121585+09:00",
349              "data": {
350                  "folder": "default",
351                  "summary": {
352                      "globalBytes": 0,
353                      "globalDeleted": 0,
354                      "globalFiles": 0,
355                      "ignorePatterns": false,
356                      "inSyncBytes": 0,
357                      "inSyncFiles": 0,
358                      "invalid": "",
359                      "localBytes": 0,
360                      "localDeleted": 0,
361                      "localFiles": 0,
362                      "needBytes": 0,
363                      "needFiles": 0,
364                      "state": "idle",
365                      "stateChanged": "2015-04-17T14:12:12.455224687+09:00",
366                      "version": 0
367                  }
368              }
369          }
370
371   ItemFinished
372       Generated when Syncthing ends synchronizing a file to a newer  version.
373       A successful operation:
374
375          {
376              "id": 93,
377              "globalID": 93,
378              "type": "ItemFinished",
379              "time": "2014-07-13T21:22:03.414609034+02:00",
380              "data": {
381                  "item": "test.txt",
382                  "folder": "default",
383                  "error": null,
384                  "type": "file",
385                  "action": "update"
386              }
387          }
388
389       An unsuccessful operation:
390
391          {
392              "id": 44,
393              "globalID": 44,
394              "type": "ItemFinished",
395              "time": "2015-05-27T11:21:05.711133004+02:00",
396              "data": {
397                  "action": "update",
398                  "error": "open /Users/jb/src/github.com/syncthing/syncthing/test/s2/foo/.syncthing.hej.tmp: permission denied",
399                  "folder": "default",
400                  "item": "foo/hej",
401                  "type": "file"
402              }
403          }
404
405       The  action  field  is either update (contents changed), metadata (file
406       metadata changed but not contents), or delete.
407
408       New in version 0.11.10: The metadata action.
409
410
411   ItemStarted
412       Generated when Syncthing begins synchronizing a file to  a  newer  ver‐
413       sion.
414
415          {
416              "id": 93,
417              "globalID": 93,
418              "type": "ItemStarted",
419              "time": "2014-07-13T21:22:03.414609034+02:00",
420              "data": {
421                  "item": "test.txt",
422                  "folder": "default",
423                  "type": "file",
424                  "action": "update"
425              }
426          }
427
428       The  action  field  is either update (contents changed), metadata (file
429       metadata changed but not contents), or delete.
430
431       New in version 0.11.10: The metadata action.
432
433
434   Listen Addresses Changed
435       This event is emitted when a listen address changes.
436
437          {
438             "type" : "ListenAddressesChanged",
439             "id" : 70,
440             "time" : "2017-03-06T15:01:24.88340663+01:00",
441             "globalID" : 70,
442             "data" : {
443                "address" : {
444                   "Fragment" : "",
445                   "RawQuery" : "",
446                   "Scheme" : "dynamic+https",
447                   "Path" : "/endpoint",
448                   "RawPath" : "",
449                   "User" : null,
450                   "ForceQuery" : false,
451                   "Host" : "relays.syncthing.net",
452                   "Opaque" : ""
453                },
454                "wan" : [
455                   {
456                      "ForceQuery" : false,
457                      "User" : null,
458                      "Host" : "31.15.66.212:443",
459                      "Opaque" : "",
460                      "Path" : "/",
461                      "RawPath" : "",
462                      "RawQuery" : "id=F4HSJVO-CP2C3IL-YLQYLSU-XTYODAG-PPU4LGV-PH3MU4N-G6K56DV-IPN47A&pingInterval=1m0s&networkTimeout=2m0s&sessionLimitBps=0&globalLimitBps=0&statusAddr=:22070&providedBy=",
463                      "Scheme" : "relay",
464                      "Fragment" : ""
465                   }
466                ],
467                "lan" : [
468                   {
469                      "RawQuery" : "id=F4HSJVO-CP2C3IL-YLQYLSU-XTYODAG-PPU4LGV-PH3MU4N-G6K56DV-IPN47A&pingInterval=1m0s&networkTimeout=2m0s&sessionLimitBps=0&globalLimitBps=0&statusAddr=:22070&providedBy=",
470                      "Scheme" : "relay",
471                      "Fragment" : "",
472                      "RawPath" : "",
473                      "Path" : "/",
474                      "Host" : "31.15.66.212:443",
475                      "Opaque" : "",
476                      "ForceQuery" : false,
477                      "User" : null
478                   }
479                ]
480             }
481          }
482
483   LocalChangeDetected
484       Generated upon scan whenever the local disk has discovered  an  updated
485       file  from  the  previous  scan.  This does not include events that are
486       discovered and copied from other devices (remote-change-detected), only
487       files that were changed on the local filesystem.
488
489          {
490            "id": 7,
491            "globalID": 59,
492            "time": "2016-09-26T22:07:10.7189141-04:00",
493            "type": "LocalChangeDetected",
494            "data": {
495              "action": "deleted",
496              "folderID": "vitwy-zjxqt",
497              "label": "TestSync",
498              "path": "C:\\Users\\Nate\\Sync\\testfolder\\test file.rtf",
499              "type": "file"
500            }
501          }
502
503   LocalIndexUpdated
504       Generated when the local index information has changed, due to synchro‐
505       nizing one or more items from the cluster or discovering local  changes
506       during a scan.
507
508          {
509              "id": 59,
510              "globalID": 59,
511              "type": "LocalIndexUpdated",
512              "time": "2014-07-17T13:27:28.051369434+02:00",
513              "data": {
514                  "folder": "default",
515                  "items": 1000,
516              }
517          }
518
519   Login Attempt
520       When  authentication  is  enabled for the GUI, this event is emitted on
521       every login attempt. If either the username or password are  incorrect,
522       success  is  false and in any case the given username is returned.  The
523       included remote address concerns the immediate connecting  host,  which
524       may not be the origin of the request, but e.g. a reverse proxy.
525
526          {
527             "id" : 187,
528             "time" : "2017-03-07T00:19:24.420386143+01:00",
529             "data" : {
530                "remoteAddress" : "127.0.0.1:55530",
531                "username" : "somename",
532                "success" : false
533             },
534             "type" : "LoginAttempt",
535             "globalID" : 195
536          }
537
538   PendingDevicesChanged
539       New in version 1.14.0.
540
541
542       Emitted  when pending devices were added / updated (connection from un‐
543       known ID) or removed (device is ignored or added).
544
545          {
546            "id": 87,
547            "type": "PendingDevicesChanged",
548            "time": "2020-12-22T22:24:37.578586718+01:00",
549            "data": {
550              "added": [
551                {
552                  "address": "127.0.0.1:51807",
553                  "device": "EJHMPAQ-OGCVORE-ISB4IS3-SYYVJXF-TKJGLTU-66DIQPF-GJ5D2GX-GQ3OWQK",
554                  "name": "My dusty computer"
555                }
556              ],
557              "removed": [
558                {
559                  "device": "P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"
560                }
561              ]
562            }
563          }
564
565   PendingFoldersChanged
566       New in version 1.14.0.
567
568
569       Emitted when pending folders were added / updated (offered by some  de‐
570       vice, but not shared to them) or removed (folder ignored or added or no
571       longer offered from the remote device).
572
573          {
574            "id": 101,
575            "type": "PendingFoldersChanged",
576            "time": "2020-12-22T22:36:55.66744317+01:00",
577            "data": {
578              "added": [
579                {
580                  "device": "EJHMPAQ-OGCVORE-ISB4IS3-SYYVJXF-TKJGLTU-66DIQPF-GJ5D2GX-GQ3OWQK",
581                  "folder": "GXWxf-3zgnU",
582                  "folderLabel": "My Pictures"
583                }
584              ],
585              "removed": [
586                {
587                  "device": "P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2",
588                  "folder": "neyfh-sa2nu"
589                }
590              ]
591            }
592          }
593
594   RemoteChangeDetected
595       Generated upon scan whenever a file is locally updated due to a  remote
596       change.  Files that are updated locally produce a local-change-detected
597       event.
598
599          {
600             "time" : "2017-03-06T23:58:21.844739891+01:00",
601             "globalID" : 123,
602             "data" : {
603                "type" : "file",
604                "action" : "deleted",
605                "path" : "/media/ntfs_data/Dokumente/testfile",
606                "label" : "Dokumente",
607                "folderID" : "Dokumente",
608                "modifiedBy" : "BPDFDTU"
609             },
610             "type" : "RemoteChangeDetected",
611             "id" : 2
612          }
613
614   Remote Download Progress
615       This event is emitted when a download-progress message is received.  It
616       returns  a map data of filenames with a count of downloaded blocks. The
617       files in questions are currently being downloaded on the remote  device
618       and belong to folder.
619
620          {
621             "time" : "2017-03-07T00:11:37.65838955+01:00",
622             "globalID" : 170,
623             "data" : {
624                "state" : {
625                   "tahr64-6.0.5.iso" : 1784
626                },
627                "device" : "F4HSJVO-CP2C3IL-YLQYLSU-XTYODAG-PPU4LGV-PH3MU4N-G6K56DV-IPN47A",
628                "folder" : "Dokumente"
629             },
630             "type" : "RemoteDownloadProgress",
631             "id" : 163
632          }
633
634   RemoteIndexUpdated
635       Generated each time new index information is received from a device.
636
637          {
638              "id": 44,
639              "globalID": 44,
640              "type": "RemoteIndexUpdated",
641              "time": "2014-07-13T21:04:35.394184435+02:00",
642              "data": {
643                  "device": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG",
644                  "folder": "lightroom",
645                  "items": 1000
646              }
647          }
648
649   Starting
650       Emitted  exactly once, when Syncthing starts, before parsing configura‐
651       tion etc.
652
653          {
654              "id": 1,
655              "globalID": 1,
656              "type": "Starting",
657              "time": "2014-07-17T13:13:32.044470055+02:00",
658              "data": {
659                  "home": "/home/jb/.config/syncthing"
660              }
661          }
662
663   StartupComplete
664       Emitted exactly once, when initialization is complete and Syncthing  is
665       ready to start exchanging data with other devices.
666
667          {
668              "id": 1,
669              "globalID": 1,
670              "type": "StartupComplete",
671              "time": "2014-07-13T21:03:18.383239179+02:00",
672              "data": null
673          }
674
675   StateChanged
676       Emitted  when  a  folder changes state. Possible states are idle, scan‐
677       ning, syncing and error. The field duration is the  number  of  seconds
678       the  folder  spent  in state from. In the example below, the folder de‐
679       fault was in state scanning for 0.198 seconds and is now in state idle.
680
681          {
682              "id": 8,
683              "globalID": 8,
684              "type": "StateChanged",
685              "time": "2014-07-17T13:14:28.697493016+02:00",
686              "data": {
687                  "folder": "default",
688                  "from": "scanning",
689                  "duration": 0.19782869900000002,
690                  "to": "idle"
691              }
692          }
693

AUTHOR

695       The Syncthing Authors
696
698       2014-2019, The Syncthing Authors
699
700
701
702
703v1                               Apr 15, 2021           SYNCTHING-EVENT-API(7)
Impressum