See the documentation: https://docs.mendix.com/apidocs-mxsdk/apidocs/build-api
Your looking for the Retrieve Package action. The result is a package you can use for the deployment.
Regards,
Ronald
To go into further detail on Ronald’s answer I believe there is a way to download it using the API : https://docs.mendix.com/apidocs-mxsdk/apidocs/build-api#2-4-download-package I have not tried this, so please let us know how it goes!
HTTP Method: GET
URL: https://deploy.mendix.com/api/1/apps/<AppId>/packages/<PackageId>/download