Reinventing the versioning wheel
Does anyone know a standard approach/design pattern or method to this?
This sounds a lot like a versioning system. Are you sure you're not trying to reinvent the wheel?
Even if this isn't a case of reinventing the versioning wheel, it's still interesting to take some inspiration from versioning systems (Git, SVN, ...) on how the interaction between client and server works (you don't necessarily need to look at the specific implementation, the contract between them is relevant enough as-is).
It's no coincidence that I've used "push", "pull" and "check out" in this answer - all git commands. The similarities are quite accurate.
Top-level API design
As a sidenote, this is starting to sound like a versioning system. Even if this isn't a case of reinventing the versioning wheel, it's still interesting to take some inspiration from versioning systems on how the interaction between client and server works. It's no coincidence that I've used "push", "pull" and "check out" in this answer - the similarities are quite accurate.
- The client specifically sends you a list of entity IDs that it has stored locally
- The server already kept aits own record of which entities were checked out by which client and thus already knows this information
I suggest doing the former, as relying on the server's information can be an issue in case the client's local storage has changed without the server having been made aware of it. E.g. if the client's hard drive crashes and the application is reinstalled from scratch, then the server thinks that the client has local copies when in fact it does not.
Either way, you could significantly cut down on both query runtime and response data size by trimming the list to only contain entities that the client cares about.
The client now knows to simply deleteddelete these entities from its local storage.
Note that if access can be revoked temporarily - then you wouldn't want to automatically delete the local changes without the user's consent, as they may want to keep these changes so they can push them when access has been restored.