Is there an API for the Duplo 10874 train set? I intend to buy this train set for my daughter. Apparently, the locomotive can communicate with an app via a bluetooth connection.

My question is: is there any documentation available so that I can make my own app to communicate with these trains? Preferably, I'd want to connect with multiple trains at the same time. Then it'll be fun for her to play with the set and fun for me to program for them :-)
There is now official documentation for the Bluetooth protocol used by the Powered Up product line:

https://github.com/LEGO/lego-ble-wireless-protocol-docs

The community has created some tools to interact directly with Powered Up and Boost hubs. Here is one example:

https://github.com/nathankellenicki/node-poweredup

That tool supports basically every device using the Powered Up Bluetooth protocol, including the new Duplo trains.