Actor command-line interface (Actor CLI)

...
Installation
Via Homebrew
On macOS (or Linux), you can install the Actor CLI via the Homebrew package manager.
brew install actor-cli
Via NPM
First, make sure you have Node.js version 20 or higher with NPM installed on your computer:
node --version
npm --version
Install or upgrade Actor CLI by running:
npm -g install actor-cli
If you receive an EACCES
error, you might need to run the command as root:
sudo npm -g install actor-cli
Alternatively, you can use Node Version Manager (nvm) and install Actor CLI only into a selected user-level Node version without requiring root privileges:
nvm install 20
nvm use 20
npm -g install actor-cli
Finally, verify that Actor CLI was installed correctly by running:
apify --version
which should print something like:
actor-cli/0.10.0 darwin-x64 node-v20.14.2
You can also skip the manual global installation altogether and use npx actor-cli
with all the following commands instead.
Basic usage
The following examples demonstrate the basic usage of Actor CLI.
...
Need help?
To see all CLI commands simply run:
actor help
To get information about a specific command run:
actor help COMMAND
Still haven't found what you were looking for? Please go to Apify Help center
or contact us.
Command reference
This section contains printouts of apify help
for all commands.
actor get-input
Gets the Actor input value from the default key-value store associated with the Actor run.
USAGE
$ actor get-input
DESCRIPTION
Gets the Actor input value from the default key-value store associated with the Actor run.
See code: src/commands/get-input.ts
actor get-value KEY
Gets a value from the default key-value store associated with the Actor run.
USAGE
$ actor get-value KEY
ARGUMENTS
KEY Key of the record in key-value store
DESCRIPTION
Gets a value from the default key-value store associated with the Actor run.
See code: src/commands/get-value.ts
actor help [COMMAND]
Display help for actor.
USAGE
$ actor help [COMMAND...] [-n]
ARGUMENTS
COMMAND... Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for actor.
See code: @oclif/plugin-help
actor push-data [ITEM]
Saves data to Actor's run default dataset.
USAGE
$ actor push-data [ITEM]
ARGUMENTS
ITEM JSON string with one object or array of objects containing data to be stored in the default dataset.
DESCRIPTION
Saves data to Actor's run default dataset.
Accept input as:
- JSON argument:
$ actor push-data {"key": "value"}
- Piped stdin:
$ cat ./test.json | actor push-data
See code: src/commands/push-data.ts
actor set-value KEY [VALUE]
Sets or removes record into the default key-value store associated with the Actor run.
USAGE
$ actor set-value KEY [VALUE] [-c <value>]
ARGUMENTS
KEY Key of the record in key-value store.
VALUE Record data, which can be one of the following values:
- If empty, the record in the key-value store is deleted.
- If no `contentType` flag is specified, value is expected to be any JSON string value.
- If options.contentType is set, value is taken as is.
FLAGS
-c, --contentType=<value> Specifies a custom MIME content type of the record. By default "application/json" is used.
DESCRIPTION
Sets or removes record into the default key-value store associated with the Actor run.
It is possible to pass data using argument or stdin.
Passing data using argument:
$ actor set-value KEY my-value
Passing data using stdin with pipe:
$ cat ./my-text-file.txt | actor set-value KEY --contentType text/plain
See code: src/commands/set-value.ts