Well for starters did you make a node or what?
Is it possible to create a geometry cache soley from the API ?
Obviously, you can use the scripting layer trough api so it stands to reason you can do anything you can do in the scripting layer with the api. Since the gui only does scripting layer stuff you can doe everything you can do in the gui. However for maya to do anything useful you MUST provide your data in form of a node.
But yes even if you wanted to do this purely in api commands wth no scripts its possible, but counter productive. If you dont understand why then read: New To The Api? Then Read This!.
Theres really no reason to involve the API for what your doing tough. That is unless you have soime really exotic, badly made, custom node your bakeing down. All you need to do is merge the data with normal merge, possibly put a shape node in between, run cache, then delete the merge nodes and their connections. This to all intents and purposes as effective as doing it in the API. (buttakes 5 minutes to do*, and is fully forwards compatible with no need to recompile)
You only really need the API if you are missing some node to do the work for you, or you need to integrate some third party library.
- actually tested this and it took 2 minutes to do manually and then 3 minutes to script out for polygonal objects.