Skip to content
CLI

Tasks & schedules

Run and publish saved tasks, and manage schedules and automations through the API.

A task saves an Actor together with its input and run options under a name, so the same job can be rerun without repeating the configuration. A schedule starts an Actor or a task on a cron expression. The CLI can run, publish, and unpublish tasks. You create and edit tasks, and manage schedules, in the dashboard or through the API.

Tasks

The command group is task, singular. It has three commands:

CommandPurpose
task run <taskId>Start a run of a task
task publish <taskId>Publish a task as a public example of its Actor
task unpublish <taskId>Take a published task down

A task argument can be the task ID or the task's name. The CLI looks names up in your task list.

There are no CLI commands to list, create, change, or delete tasks. Use the dashboard, or the Tasks API through scrapely api:

.bash
scrapely api GET /v2/actor-tasks
scrapely api GET /v2/actor-tasks/<taskId>

Run a task

.bash
scrapely task run nightly-crawl
scrapely task run <taskId> --memory 4096 --timeout 0 --json

task run starts the run and returns right away. It prints the run ID, the status, and the dataset ID. To wait for the run, use scrapely runs wait <runId>.

OptionDescription
-b, --build <tag>Build tag or number to run, for example latest or 1.2.34. Your own Actors only; others run the User Build
-m, --memory <mb>Memory for the run, in megabytes
-t, --timeout <seconds>Run timeout in seconds. 0 means no timeout.
--jsonPrint { "data": <run> }

task run has no -i or -f option. The run uses the task's saved input. If the current folder contains storage/key_value_stores/default/INPUT.json, its fields are sent with the request and override the saved fields of the same name for this run. The task itself doesn't change. Run the command from a folder without that file to use the saved input as is.

Publish a task

.bash
scrapely task publish <taskId>
scrapely task unpublish <taskId>

task publish makes the task a public example of its Actor, with its own landing page. The CLI prints the slug, the publish time, the landing page URL, and the URL of a Markdown version of the page. The slug comes from the task's title or name, or is kept from an earlier publish.

While a task is published, its input can't be edited. Unpublish it, change it, and publish it again. Input fields the Actor's input schema marks as secret are hidden on the public page. An Actor can have up to 50 published tasks.

task unpublish takes the page down. The task's SEO settings are kept, so a later task publish restores them.

Schedules

The CLI has no schedules command. Create and edit schedules in the dashboard, or with the Schedules API. You can call the API with scrapely api:

.bash
scrapely api GET /v2/schedules
scrapely api GET /v2/schedules/<scheduleId>
scrapely api GET /v2/schedules/<scheduleId>/log

To create or change a schedule from a script, send the request body described in the Schedules API with scrapely api POST /v2/schedules -d '<json>', or pipe the JSON in with -d -. See Secrets, webhooks & API.

Automations

There is no automations command either. Call the Automations API with scrapely api:

.bash
scrapely api GET /v2/automations
scrapely api GET "/v2/automations?savedInputId=<taskId>"
scrapely api POST /v2/automations/<automationId>/runs
scrapely api GET /v2/automations/<automationId>/runs

Schedules are automations with a schedule trigger, so a schedule's ID works with these routes too, for example to run it now. scrapely api --list-endpoints lists the automation routes from CLI 0.1.13; the calls above work with any version.

What's next