---
updatedAt: 2026-08-19T14:14:26.000Z
agentTools:
  siteIndex: https://docs.jfrog.com/llms.txt
  projectIndex: https://docs.jfrog.com/administration/llms.txt
---

# CLI for JFrog Platform Services

Initialize, deploy, test, and manage JFrog Workers from the command line.

This page describes how to use JFrog CLI with JFrog Platform Services. For more information on the CLI in general, see [JFrog CLI](/integrations/docs/jfrog-cli).

**Managing JFrog Workers**

Workers is a JFrog Platform service that you can use to extend and control your execution flows. It provides a serverless execution environment where you can create workers to enhance the platform's functionality.

Workers run in the following ways:

* Automatically, triggered by [events](https://docs.jfrog.com/administration/docs/worker-event-types) within the JFrog Platform for specific use cases.
* On-demand, using HTTP-triggered workers.

For more information, see [JFrog Workers](https://docs.jfrog.com/administration/docs/workers). To configure workers using the JFrog Platform UI instead, see [Configure Workers for Custom Flows](https://docs.jfrog.com/administration/docs/configure-workers-for-custom-flows).

This page covers the following JFrog CLI worker commands:

* [Initialize JFrog Worker](#initialize-jfrog-worker)
* [Test-Run JFrog Worker](#test-run-jfrog-worker)
* [Deploy JFrog Worker](#deploy-jfrog-worker)
* [Add Secrets to JFrog Worker](#add-secrets-to-jfrog-worker)
* [Undeploy JFrog Worker](#undeploy-jfrog-worker)
* [Execute an HTTP-Triggered Worker](#execute-an-http-triggered-worker)
* [List Available Events](#list-available-events)
* [List Registered Workers](#list-registered-workers)
* [Show Worker Execution History](#show-worker-execution-history)
* [Edit Worker Schedule](#edit-worker-schedule)

<br />

## Initialize JFrog Worker

Use this command to initialize a new JFrog worker.

| Parameter              | Command / Description                                                                                                                           |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| Command name           | worker init                                                                                                                                     |
| Abbreviation           | worker i                                                                                                                                        |
| **Command options:**   |                                                                                                                                                 |
| `--server-id`          | \[Optional] Server ID configured using the config command.                                                                                      |
| `--timeout-ms`         | \[Default: 5000] The request timeout in milliseconds.                                                                                           |
| `--force`              | \[Default: false] Whether to overwrite existing files.                                                                                          |
| `--no-test`            | \[Default: false] Whether to skip test generation.                                                                                              |
| `--application`        | \[Optional] The application that provides the event. If omitted the service will try to guess it and raise an error if no application is found. |
| `--project-key`        | \[Optional] The key of the project that the worker should belong to.                                                                            |
| **Command arguments:** |                                                                                                                                                 |
| action                 | The name of the action to init (for example, BEFORE\_DOWNLOAD). To have the list of all available actions use `jf worker list-event`.           |
| worker-name            | The name of the worker.                                                                                                                         |

This command generates the following files:

* `manifest.json`: Contains the Worker specification, including its name, code location, secrets, and other data useful to the Worker.
* `package.json`: Describes the development dependencies of the Worker. This file is not used when executing your Worker in the runtime.
* `worker.ts`: The Worker source code, populated with sample code for the event.
* `worker.spec.ts`: The source code for the Worker's unit tests.
* `tsconfig.json`: The TypeScript configuration file.
* `types.ts`: A file containing the event's specific types that can be used in the Worker code.

### Example: Initialize a `BEFORE_DOWNLOAD` Worker

This example initializes a new `BEFORE_DOWNLOAD` Worker named `my-worker`.

```shell
jf worker init BEFORE_DOWNLOAD my-worker
```

<br />

## Test-Run JFrog Worker

Use this command to test-run a Worker. You must initialize the Worker before running this command. The command executes the Worker with its local content, so you can use it to test the Worker's execution before pushing local changes to the server.

| Parameter              | Command / Description                                                                                                                                      |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Command name**       | `worker test-run`                                                                                                                                          |
| **Abbreviation**       | worker dry-run, worker dr, worker tr                                                                                                                       |
| **Command options:**   |                                                                                                                                                            |
| `--server-id`          | \[Optional] Server ID configured using the config command.                                                                                                 |
| `--format`             | \[Default: json] Output format. Supported values: `json`, `table`. Available from JFrog CLI 2.105.0.                                                       |
| `--timeout-ms`         | \[Default: 5000] The request timeout in milliseconds.                                                                                                      |
| `--no-secrets`         | \[Default: false] Do not use registered secrets.                                                                                                           |
| **Command arguments:** |                                                                                                                                                            |
| json-payload           | The json payload expected by the worker. Use `-` to read the payload from standard input. Use `@<file-path>` to read from a file located at `<file-path>`. |

### Test-Run JFrog Worker Example

This example test-runs a Worker that has been initialized in the current directory, using a payload from a file named `payload.json` in the same directory.

```shell
jf worker dry-run @payload.json
```

**`--format json` output (default)**

```json
{
  "key": "my-worker",
  "workerKey": "my-worker",
  "triggeredByEvent": "BEFORE_DOWNLOAD",
  "statusCode": 200,
  "status": "STATUS_SUCCESS",
  "warnings": [],
  "errors": [],
  "debug": []
}
```

**`--format table` output**

```shell
jf worker dry-run @payload.json --format table
```

```text
key          workerKey   triggeredByEvent   statusCode  status          warnings  errors  debug
my-worker    my-worker   BEFORE_DOWNLOAD    200         STATUS_SUCCESS
```

<br />

## Deploy JFrog Worker

Use this command to update the worker definition (code, description, filter, secret, and so on) on your Artifactory instance.

| Parameter               | Command / Description                                                                                                                                                                        |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Command name            | worker deploy                                                                                                                                                                                |
| Abbreviation            | worker d                                                                                                                                                                                     |
| **Command options:**    |                                                                                                                                                                                              |
| `--server-id`           | \[Optional] Server ID configured using the config command.                                                                                                                                   |
| `--format`              | \[Optional] Use `--format json` to return the response as JSON. Available from JFrog CLI 2.105.0.                                                                                            |
| `--timeout-ms`          | \[Default: 5000] The request timeout in milliseconds.                                                                                                                                        |
| `--no-secrets`          | \[Default: false] Do not use registered secrets.                                                                                                                                             |
| `--changes-version`     | \[Optional] Version identifier for the worker.                                                                                                                                               |
| `--changes-description` | \[Optional] Description of your changes.                                                                                                                                                     |
| `--changes-commitsha`   | \[Optional] Commit identifier or your change in your VCS.                                                                                                                                    |
| `--base64`              | \[Default: false] Encode the Worker source code in Base64 before sending. The Worker service accepts source code as plain text or Base64. The JFrog Platform UI sends source code as Base64. |

### Deploy JFrog Worker Example

Deploy a worker to the server with id `my-server`.

```shell
jf worker deploy --server-id my-server
```

**`--format json` output**

```shell
jf worker deploy --server-id my-server --format json
```

```json
{
  "status_code": 200,
  "content": "{\"key\":\"my-worker\",\"version\":\"1\"}"
}
```

<br />

## Add Secrets to JFrog Worker

Use this command to edit a worker manifest to add or edit a secret used for deployment or execution.

Secrets are stored encrypted with a master password that will be requested by the command.

Once secrets are added to the manifest, the master password will be required by the `deploy` and `test-run` commands.

| Parameters             | Commands / Description                                  |
| ---------------------- | ------------------------------------------------------- |
| Command name           | worker add-secret                                       |
| Abbreviation           | worker as                                               |
| **Command options:**   |                                                         |
| `--edit`               | \[Default: false] Whether to update an existing secret. |
| **Command arguments:** |                                                         |
| secret-name            | The secret name                                         |

### Add Secrets to JFrog Worker Example

Add the secret name `my-secret` to a worker initialized in the current directory.

```shell
jf worker add-secret my-secret
```

<br />

## Undeploy JFrog Worker

Use this command to remove a registered worker from your Artifactory instance.

| Parameter              | Command / Description                                                                                           |
| ---------------------- | --------------------------------------------------------------------------------------------------------------- |
| Command name           | worker undeploy                                                                                                 |
| Abbreviation           | worker rm                                                                                                       |
| **Command options:**   |                                                                                                                 |
| `--server-id`          | \[Optional] Server ID configured using the config command.                                                      |
| `--format`             | \[Optional] Use `--format json` to return the response as JSON. Available from JFrog CLI 2.105.0.               |
| `--timeout-ms`         | \[Default: 5000] The request timeout in milliseconds.                                                           |
| **Command arguments:** |                                                                                                                 |
| worker-key             | \[Optional] The worker key. If not provided, it will be read from the `manifest.json` in the current directory. |

### Undeploy JFrog Worker Example

Undeploy a worker named `my-worker` from an Artifactory instance identified by `my-server`.

```shell
jf worker undeploy --server-id my-server my-worker
```

**`--format json` output**

```shell
jf worker undeploy --server-id my-server my-worker --format json
```

```json
{
  "status_code": 200,
  "message": "OK"
}
```

<br />

## Execute an HTTP-Triggered Worker

Execute an HTTP-triggered worker.

| Parameter              | Command / Description                                                                                                                                      |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Command name           | worker execute                                                                                                                                             |
| Abbreviation           | worker exec, worker e                                                                                                                                      |
| **Command options:**   |                                                                                                                                                            |
| `--server-id`          | \[Optional] Server ID configured using the config command.                                                                                                 |
| `--format`             | \[Default: json] Output format. Supported values: `json`, `table`. Available from JFrog CLI 2.105.0.                                                       |
| `--timeout-ms`         | \[Default: 5000] The request timeout in milliseconds.                                                                                                      |
| `--project-key`        | \[Optional] The key of the project that the worker belongs to.                                                                                             |
| **Command arguments:** |                                                                                                                                                            |
| worker-key             | The worker key. If not provided it will be read from the `manifest.json` in the current directory.                                                         |
| json-payload           | The json payload expected by the worker. Use `-` to read the payload from standard input. Use `@<file-path>` to read from a file located at `<file-path>`. |

### Execute an HTTP-Triggered Worker Example

Execute an HTTP-triggered worker initialized in the current directory, with a payload located in a file named `payload.json` from the same directory.

```shell
jf worker execute @payload.json
```

Execute an HTTP-triggered worker with a payload from the standard input.

```shell
jf worker execute - <<EOF
{
  "a": "key",
  "an-integer": 14
}
EOF
```

Execute an HTTP-triggered worker by providing the payload as an argument.

```shell
jf worker execute '{"my":"payload"}'
```

**`--format json` output (default)**

```json
{
  "key": "my-worker",
  "workerKey": "my-worker",
  "triggeredByEvent": "BEFORE_DOWNLOAD",
  "statusCode": 200,
  "status": "STATUS_SUCCESS",
  "warnings": [],
  "errors": [],
  "debug": []
}
```

**`--format table` output**

```shell
jf worker execute @payload.json --format table
```

```text
key          workerKey   triggeredByEvent   statusCode  status          warnings  errors  debug
my-worker    my-worker   BEFORE_DOWNLOAD    200         STATUS_SUCCESS
```

<br />

## List Available Events

This command lists all the available events on the platform. Without `--format`, the output is a plain comma-separated list of action names, kept for backward compatibility. Use `--format table` or `--format json` for structured output.

| Parameter            | Command / Description                                                                           |
| -------------------- | ----------------------------------------------------------------------------------------------- |
| Command name         | worker list-event                                                                               |
| Abbreviation         | worker le                                                                                       |
| **Command options:** |                                                                                                 |
| `--server-id`        | \[Optional] Server ID configured using the config command.                                      |
| `--format`           | \[Optional] Output format. Supported values: `table`, `json`. Available from JFrog CLI 2.105.0. |
| `--timeout-ms`       | \[Default: 5000] The request timeout in milliseconds.                                           |
| `--project-key`      | \[Optional] List events available to a specific project.                                        |

### List Available Events Example

List events supported by a server identified by `my-server`.

```shell
jf worker list-event --server-id my-server
```

**Output without `--format` (default)**

```text
BEFORE_DOWNLOAD, AFTER_CREATE, GENERIC_EVENT
```

**`--format table` output**

```shell
jf worker list-event --server-id my-server --format table
```

```text
NAME                  APPLICATION   DESCRIPTION
BEFORE_DOWNLOAD       artifactory   Triggered before a download request is fulfilled
AFTER_CREATE          artifactory   Triggered after an artifact is created
GENERIC_EVENT         artifactory   Triggered on demand via `jf worker execute`
```

**`--format json` output**

```shell
jf worker list-event --server-id my-server --format json
```

```json
[
  {
    "action": {
      "application": "artifactory",
      "name": "BEFORE_DOWNLOAD"
    },
    "description": "Triggered before a download request is fulfilled",
    "typesDefinitions": "..."
  }
]
```

<br />

## List Registered Workers

List workers saved on your Artifactory instance. The default output is a table (CSV) with columns `name`, `action`, `description`, `enabled`, sorted by worker name. Use `--format json` for full JSON output.

<Callout icon="⚠️" theme="warning">
  **Warning**

  The `--json` boolean flag is deprecated as of JFrog CLI 2.105.0 and replaced by `--format json`. It still works but prints a deprecation warning. If your scripts use `--json`, update them to use `--format json`.
</Callout>

| Parameter              | Command / Description                                                                                             |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------- |
| Command name           | worker list                                                                                                       |
| Abbreviation           | worker ls                                                                                                         |
| **Command options:**   |                                                                                                                   |
| `--server-id`          | \[Optional] Server ID configured using the config command.                                                        |
| `--format`             | \[Default: table] Output format. Supported values: `table`, `json`. Available from JFrog CLI 2.105.0.             |
| `--timeout-ms`         | \[Default: 5000] The request timeout in milliseconds.                                                             |
| `--project-key`        | \[Optional] List the events created in a specific project.                                                        |
| **Command arguments:** |                                                                                                                   |
| action                 | \[Optional] Only show workers of this type. To have the list of all available actions use `jf worker list-event`. |

### List Registered Workers Example

List all workers registered in a platform named `my-platform`.

```shell
jf worker list --server-id my-platform
```

**`--format table` output (default)**

```text
my-worker,BEFORE_DOWNLOAD,Intercepts download requests,true
another-worker,AFTER_CREATE,Post-creation hook,false
```

**`--format json` output**

```shell
jf worker list --server-id my-platform --format json
```

```json
{
  "workers": [
    {
      "key": "my-worker",
      "description": "Intercepts download requests",
      "debug": false,
      "enabled": true,
      "sourceCode": "...",
      "action": "BEFORE_DOWNLOAD",
      "secrets": [],
      "projectKey": ""
    },
    {
      "key": "another-worker",
      "description": "Post-creation hook",
      "debug": false,
      "enabled": false,
      "sourceCode": "...",
      "action": "AFTER_CREATE",
      "secrets": [],
      "projectKey": ""
    }
  ]
}
```

<br />

## Show Worker Execution History

Display the execution history of a specific worker.

| Parameter              | Command / Description                                                                                           |
| ---------------------- | --------------------------------------------------------------------------------------------------------------- |
| Command name           | worker execution-history                                                                                        |
| Abbreviation           | worker exec-hist, worker eh                                                                                     |
| **Command options:**   |                                                                                                                 |
| `--server-id`          | \[Optional] Server ID configured using the config command.                                                      |
| `--format`             | \[Default: json] Output format. Supported values: `json`, `table`. Available from JFrog CLI 2.105.0.            |
| `--timeout-ms`         | \[Default: 5000] The request timeout in milliseconds.                                                           |
| `--project-key`        | \[Optional] List events available to a specific project.                                                        |
| `--with-test-runs`     | \[Default: false] Whether to include test-runs entries.                                                         |
| **Command arguments:** |                                                                                                                 |
| worker-key             | \[Optional] The worker key. If not provided, it will be read from the `manifest.json` in the current directory. |

### Show Worker Execution History Example

Retrieves the execution history of a worker named `my-worker`, including test runs.

```shell
jf worker execution-history --with-test-runs my-worker
```

**`--format json` output (default)**

```json
[
  {
    "workerKey": "my-worker",
    "workerType": "BEFORE_DOWNLOAD",
    "workerProjectKey": "",
    "executionStatus": "STATUS_SUCCESS",
    "startTimeMillis": 1730460000000,
    "endTimeMillis": 1730460001234,
    "triggeredBy": "user@example.com",
    "testRun": false,
    "executedVersion": "3",
    "traceId": "abc123def456"
  }
]
```

**`--format table` output**

```shell
jf worker execution-history --with-test-runs my-worker --format table
```

```text
Worker Key   Worker Type       Project Key  Status          Started At            Ended At              Triggered By          Test Run  Executed Version  Trace ID
my-worker    BEFORE_DOWNLOAD                STATUS_SUCCESS  2024-11-01T12:00:00Z  2024-11-01T12:00:01Z  user@example.com      false     3                 abc123def456
```

<br />

## Edit Worker Schedule

Edit the manifest of a SCHEDULED\_EVENT worker to update the schedule criteria.

Deploy the worker afterward with `jf worker deploy` for the change to be applied to the server.

| Parameter            | Command / Description                                                                                                   |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| Command name         | worker edit-schedule                                                                                                    |
| Abbreviation         | worker es                                                                                                               |
| **Command options:** |                                                                                                                         |
| `--cron`             | \[Mandatory] A standard cron expression with minutes resolution. Seconds resolution is not supported by Worker service. |
| `--timezone`         | \[Default: UTC] The timezone to use for scheduling.                                                                     |

### Edit Worker Schedule Example

Edit a worker manifest so that it is executed every minute.

```shell
jf worker edit-schedule --cron "* * * * *"
```

## Frequently Asked Questions

This section provides answers to frequently asked questions.

<Accordion title="FAQs" icon="plus">
  ##### Q: How do I initialize a new JFrog Worker from the command line?

  **A:** Run `jf worker init <action> <worker-name>`, using an action from `jf worker list-event`. This generates the Worker's `manifest.json`, `worker.ts`, and other project files. See [Initialize JFrog Worker](#initialize-jfrog-worker).

  ##### Q: What happens if I use the deprecated `--json` flag with `jf worker list`?

  **A:** `--json` is deprecated but still works with a warning. Use `--format json` instead. See [List Registered Workers](#list-registered-workers).

  ##### Q: What is the difference between `jf worker execute` and `jf worker test-run`?

  **A:** `jf worker test-run` runs the Worker using its local content, so you can test changes before pushing them to the server. `jf worker execute` runs the HTTP-triggered worker command itself. See [Test-Run JFrog Worker](#test-run-jfrog-worker) and [Execute an HTTP-Triggered Worker](#execute-an-http-triggered-worker).

  ##### Q: What do I need before I can test-run a JFrog Worker?

  **A:** Initialize the Worker first with `jf worker init`. See [Initialize JFrog Worker](#initialize-jfrog-worker).

  ##### Q: Can I schedule a JFrog Worker to run automatically?

  **A:** Yes. Use `jf worker edit-schedule --cron` to set a cron expression on a `SCHEDULED_EVENT` worker. See [Edit Worker Schedule](#edit-worker-schedule).
</Accordion>

## Related Topics

* [Worker Event Types](https://docs.jfrog.com/administration/docs/worker-event-types)
* [Configure Workers for Custom Flows](https://docs.jfrog.com/administration/docs/configure-workers-for-custom-flows)
* [Workers Code Samples](https://docs.jfrog.com/administration/docs/workers-code-samples)
* [Understand Worker Event Workflows](https://docs.jfrog.com/administration/docs/workers-download-workflow)