Add a cron job to a service, or change one (by id).
API key access: full.
apiKeyAuthorizationBearer <pyo_…>An API key from the dashboard's API keys page: Authorization: Bearer pyo_…. Keys can expire, and an expired one gets a 401.
application/jsonAdd a cron job to a service, or change one (by id).
API key access: full.
op*"saveCronJob""saveCronJob"serviceId*stringid?string|nullname*stringschedule*stringFive fields, in UTC: minute, hour, day of month, month, day of week.
command*stringWhat it runs, through sh -c. Empty runs the image's default command.
paused*booleanDone. Always ok: true, and some operations add more, such as a new API key or a join command. A warning comes with a change that went through but won't fully take effect yet, such as more replicas than the servers have room for.
application/jsoncurl -X POST 'https://your-pyo.example.com/api/v1/ops' \
-H 'Content-Type: application/json' \
-d '{
"command": "python manage.py clearsessions",
"name": "nightly-cleanup",
"op": "saveCronJob",
"paused": false,
"schedule": "0 3 * * *",
"serviceId": "svc_8kq2x7ad"
}'{}