Expose "expanded" property in api

My personal use case for this is simply that I want nodes inserted by the API to not be expanded by default. Is there any workaround for this? But in general, exposing the “expanded” property would be nice.

I know that it’s possible the “expanded” property isn’t so simple. Maybe each node has a different “expanded” property depending on the root node, or the web browser even? If it turns out too complicated to fully expose the property, maybe there can at least be a way to change whether or new nodes inserted by the API are expanded by default?