Run one-off script
Run a script on a server without creating a reusable script resource.
POST/api/servers/{server}/scripts/run
Run a one-off script
Runs the given script content on the server right away. The response contains an execution id that can be polled with the get script execution endpoint for the status and output, for up to an hour. The output is also written to the server logs.
Required attributes
- Name
content- Type
- string
- Description
The script content to run (max 7500 characters).
Optional attributes
- Name
user- Type
- string
- Description
The system user to run the script as, defaults to 'ploi'. Besides 'ploi' and 'root' this may be any system user that exists on the server, for example a site's isolated system user.
Request
POST
/api/servers/{server}/scripts/runcurl -X POST "https://ploi.io/api/servers/{server}/scripts/run" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"content": "npm install -g pm2",
"user": "deployer"
}'
Response
{
"data": {
"id": "3f4c9e9a-8b4e-4f0e-9d3b-2f6f2c1a7d42",
"server_id": 1,
"user": "deployer",
"content": "npm install -g pm2",
"status": "pending",
"exit_code": null,
"output": null,
"created_at": "2026-08-14T15:03:12+00:00",
"started_at": null,
"finished_at": null
}
}