Determine sync completion with API (ignoring some files)

I’m hit by this bug where Remote Device is stuck at Syncthing (99% 128B) where the only Out of Sync Items are those in the ignore file. I think the files is also not necessarily the same ignore files, i.e. it sometimes varies which ignored files are out of sync, at least depending on the host.

What the best way to check for sync completion then using the API?