Modern computation relies crucially on modular architectures, breaking a complex algorithm into self-contained subroutines. A client can then call upon a remote server to implement parts of the computation independently via an application programming interface (API). Present APIs relay only classical information. Here we implement a quantum API that enables a client to estimate the absolute value of the trace of a server-provided unitary $U$. We demonstrate that the algorithm functions correctly irrespective of what unitary $U$ the server implements or how the server specifically realizes $U$. Our experiment involves pioneering techniques to coherently swap qubits encoded within the motional states of a trapped Yb ion, controlled on its hyperfine state. This constitutes the first demonstration of modular computation in the quantum regime, providing a step towards scalable, parallelization of quantum computation.