The XML-RPC and SOAP APIs used to have an exportSpace functionality, however they are deprecated since Confluence 5.5. The REST API functionality does not include an option for creating space/site exports. Even if the exported XML is not transferred via the REST interface, the action could trigger the backup of any given space or the instance to the export directory, optionally providing a download link for it
The Confluence CLI provides such functionality, but it is a paid third-party add-on. The above functionality would be important to automate migration/backup tasks for administrators.