Skip to content

POST /wpcom/v2/sites/$wpcom_site/hosting/code-deployments

Create or update a deployment configuration for a site.

Resource Information

   
Method POST
URL https://public-api.wordpress.com/wpcom/v2/sites/$wpcom_site/hosting/code-deployments
Requires authentication? Yes

Method Parameters

Parameter Type Required Description
wpcom_site string | integer Yes A domain or blog ID.
external_repository_id integer Yes The external repository ID.
branch_name string Yes The branch to deploy.
target_dir string Yes The target directory to deploy to.
installation_id integer Yes The installation ID.
is_automated boolean No Whether to deploy on a code push to the given branch or manually.
workflow_path string No The path to the workflow file.

Response Example

					
						{
    "id": "deployment_id",
    "blog_id": 123,
    "created_by_user_id": 123456,
    "created_on": "2024-06-03T13:52:00+00:00",
    "updated_on": "2024-06-03T13:52:00+00:00",
    "external_repository_id": "external_repository_id",
    "repository_name": "owner\/repository-name",
    "branch_name": "master",
    "target_dir": "\/wp-content\/plugins\/repository-name",
    "is_automated": true,
    "installation_id": 123,
    "created_by": {
        "id": 123456,
        "name": "Some User"
    },
    "current_deployed_run": null,
    "current_deployment_run": null,
    "workflow_path": ".github\/workflows\/wpcom.yml"
}					
				

Resource Errors

This endpoint does not return any errors.