Mongo was open source. They copied the api under that license.
My understanding, and I’m not a lawyer so don’t consider this legal advice, is that you can’t copy a commercial api or it’s infringing on their intellectual property.
The copyrightability of APIs (specifically Oracle’s APIs, even!) is at the heart of a lengthy and still-ongoing legal battle, with several decisions in both directions.
The mongo example is a bit odd since the open source license was AGPL. Sounds like you can copy an AGPL API signature without releasing your own source?
My understanding, and I’m not a lawyer so don’t consider this legal advice, is that you can’t copy a commercial api or it’s infringing on their intellectual property.