Deploy site

Deploy your site using the configured deploy script.


POST/api/servers/{server}/sites/{id}/deploy

Deploy site

This endpoint triggers a deployment for your site. The response holds the deployment_id: follow the deployment with Get deployment, which reports deploying until it finished, and read its output with Get deployment log.

Returns a 422 when the site is already deploying, has no repository or is a WordPress site.

Optional parameters

  • Name
    scheduled
    Type
    datetime
    Description

    Schedule a deployment for a future time. Format: 2023-01-01 10:00 in your timezone.

  • Name
    variables
    Type
    object
    Description

    Variables to pass to your deploy script.

Using variables in your deploy script

Variables passed via the API are available as environment variables in your deploy script (uppercased):

cd /home/ploi/examplehosting.com

echo $BRANCH

Request

POST
/api/servers/{server}/sites/{id}/deploy
curl -X POST "https://ploi.io/api/servers/{server}/sites/{id}/deploy" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json"

With variables (cURL)

curl -X POST "https://ploi.io/api/servers/{server}/sites/{id}/deploy" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "variables": {
      "branch": "main"
    }
  }'

Response

{
  "message": "Site example.com has been queued for deployment",
  "deployment_id": "9b2f6c1e-4d3a-4f8b-a7e2-1c5d9e0f3a6b"
}