I am really confused on autosave and confused on the overall architecture

Autosaves only save in the cache, if autosave is on and doesn’t trigger the /callback. And we are supposed to update the key whenever we reload. The changes in the old key call the callback only 10 seconds after. This way, I lose all my changes in the editor because when I load the document from my database for a new key, it won’t have the saved changes of the old key in the database.

Hello @bipana.shrestha

The Save delay mechanism is used to prevent such scenario. More about you can find here:
https://api.onlyoffice.com/editors/save#savedelay

Basically, Document Server waits ~10 seconds before completely saving document with all changes back to the storage. If you access the document in less than 10 seconds then it must be available via the same key and you will open the document with made changes before it is saved.
In general, your scenario is correct only if the document key generation and callback service are improperly configured.

Hi @Constantine ,

Can you point to the document where I can properly configure document key generation and callback service? It seems to me that it’s inflexible. If I don’t change the key on every edit and save, there is one “file version has been changed” issue that will occur ONLYOFFICE Api Documentation - Troubleshooting

We need to note that we aren’t using the Onlyoffice versioning because we have our own versioning and they were clashing. With versioning turned off, I don’t think ONLYOFFICE Api Documentation - Saving File will work because I remember I saw a note somewhere in the docs saying that. Integrating with the Onlyoffice editor has been really difficult, especially the key, callback and saving situation. I would be grateful if you could help me in any way.

Hello @bipana.shrestha

You can check out callback saving examples on different programming languages here, starting form C#:
https://api.onlyoffice.com/editors/callback#csharp
I would also recommend take a closer look at the article in general.

As an independent integrator you should develop the method for keys generation by yourself on your app side.
As a reference you can download and install language specific test storage example that corresponds to the language of your storage to check out how it works:
https://api.onlyoffice.com/editors/demopreview
Additionally, you can find out more principles of work of Callback Handler in test example too.