How do I get the transitive API elements of a project?

I’d like to get a list of all artifacts that have to be on the classpath to compile against a project. This is what the api configuration is for, but I need all the transitive API dependencies too. This is what - from what I understand - the apiElements configuration is for.

Two problems:

  1. It’s not resolvable.

  2. If I make my own configuration that extends it and make it resolvable, I get implementation dependencies too, which is wrong.

How do I walk the dependency graph and get ONLY api dependencies? It feels like this should be easy.