API Reference background-services
Create a service
POST/projects/{project_id}/services/
Create a background service — a script that reacts to project-status changes.
Parameters
| Body field | Required | Description |
|---|---|---|
| name | yes | Display name |
| script | no | Service source — defines the on_change handler |
| script_language | no | python (default) or typescript |
| description | no | What this service reacts to |
| workspace_id | no | Workspace the handler runs against |
| docker_image_id | no | Custom environment for the handler |
| trigger_stores | no | Status-store names to watch; empty reacts to every store |
| enabled | no | Reaction on/off (default true) |
Request
curl -X POST "$ALLYBUILD_API_URL/projects/$PROJECT_ID/services/" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
-d '{
"name": "deploy-watcher",
"script_language": "python",
"script": "def on_change(mutation, state):\n ...",
"trigger_stores": ["project_status_deploy"]
}'