Hi Richard, thanks for posting! I saw you replied to another thread with this question and I responded to you there. Re-posting my response below for extra visibility.
Unfortunately the ContainedBy field you see in the CSV export currently isn’t included by default in the JSON response to a GET Document Contents, so there is no way to tell which shapes are in containers.
However, one way you could work around this is by using the CONTAINED or CONTAINEDBY formula functions in your document. This would allow you to identify which shapes are in which containers from the "customData" part of the JSON response. You can find an example in this Developer Community post, where another user is seeking help with the exact CONTAINED function to use.
Please feel free to respond with your feedback or a brief description of your use case, especially if this workaround isn’t suitable. We are always looking for ways to improve our public API’s and we value your feedback.