Deployment using apex code in production

URI

/services/data/v46.0/metadata/deployRequest

Header

Content-Type: multipart/form-data; boundary=BOUNDARY
Accept: application/json

Body

–BOUNDARY
Content-Type: application/json
Content-Disposition: form-data; name=”entity_content”

{
“deployOptions” :
{
“allowMissingFiles” : false,
“autoUpdatePackage” : false,
“checkOnly” : false,
“ignoreWarnings” : false,
“performRetrieve” : false,
“purgeOnDelete” : false,
“rollbackOnError” : false,
“runTests” : null,
“singlePackage” : true,
“testLevel” : “RunAllTestsInOrg”
}
}

–BOUNDARY
Content-Type: application/zip
Content-Disposition: form-data; name=”content”; filename=”Archive”

<binary data>

–BOUNDARY–

Some Help Articles

https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_rest_deploy.htm

https://salesforce.stackexchange.com/questions/256731/deploying-metadata-with-rest-resources

https://developer.salesforce.com/docs/atlas.en-us.api_bulk_v2.meta/api_bulk_v2/walkthrough_upload_multipart_data.htm