The API key can be used via URL? That doesn’t sound safe.
The API + curl allows something to be posted at the server level, bypassing the client/browser layer, which is safer than exposing the API key via html link. Someone only needs to check the dev tools as you did and grab it.
However, this depends on what exactly @Stackfish wants this for.