Well, it sorta does exist, but it's limited to 3D instructions in the builder app. We can pretend to be the builder app! If you make a request to
https://api.prod.dbix.i.lego.com/api/v1/buildinginstructions?ProductNumber=
with the set number on the end you'll get some JSON back.
In the JSON is a key of BuildingInstructions, and under that key is the Url key. That is the LFXML file that the app uses to show you the 3D instructions.
An LFXML file is just XML with a bit of fun. What you'll need to do in order to work out what's in what bags is best shown with a tiny example:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<LXFML versionMajor="8" versionMinor="1" versionPatch="0">
<Meta>
<UseBags/>
<DWFBI identifier="BI;VX1039209;B;"/>
</Meta>
<Bricks>
<Brick designID="6636;M" itemNos="4211549" uuid="92f2b701-b9f8-409e-a4fd-6a59f08730dc">
<Part uuid="7be5fabd-d150-4007-9dc2-fb85c4a0a737" designID="6636;M" partType="rigid" materials="194:0">
<Bone uuid="e706f478-3358-4045-9d6b-d27d2ea9ba34" transformation="0,0,-1,-1,0,0,0,1,0,34.486966947508,7.9984556880277,-45.066111966449"/>
</Part>
</Brick>
</Bricks>
<Bags>
<NumberedBag uuid="44c451bb-81b5-4487-82d1-a5695339e4df" name="">
<Brick brickRef="92f2b701-b9f8-409e-a4fd-6a59f08730dc"/>
</NumberedBag>
</Bags>
</LXFML>
In this VERY tiny example (pulled from an actual LFXML file!), you have a 1x6 tile in LBG. That tile is, in this example, in the first bag. Bags in the LFXML file are not numbered for you, but from deduction are listed in numerical order (so the first <NumberedBag> is Bag 1, the second is Bag 2, etc - bags can have names, but they're not bag numbers, they're just internal naming tags for specific bags, and the name parameter will be absent from older LFXML files).
Bricks are identified by their uuid on the <Brick>, and that's the UUID referenced in the brickRef parameter.
Thus if you map the NumberedBag to the Brick's UUID, you can construct a mapping of which bricks from a set are in which bags.
Again, this'll be limited to the sets that have a 3D instruction in the builder app, but that still is most sets in the past 4-5 years. YMMV.