# Custom Workflows

Execute custom workflow definitions and check their status.

## workflow run

Execute a custom workflow definition. Accepts JSON from a file or stdin.
The command starts the workflow and waits for it to complete. While it waits, it writes the workflow ID and status to stderr as progress (hidden by `--quiet`); at the end it prints `{"success": true, "data": …}` with the whole workflow completion in `data`. If waiting times out, it exits with code `8` and an error that names the `workflowId`, so you can continue with `linkedin workflow status <id> --wait`.

Calls [`POST /workflows`](/docs/executing-workflows) – what each option means, the result fields and the errors are described there.

```bash
linkedin workflow run [flags]
```

| Flag | Type | Description |
| --- | --- | --- |
| `-f` / `--file` | string | Path to workflow JSON file |

```bash
# From file
linkedin workflow run --file workflow.json

# From stdin
cat workflow.json | linkedin workflow run

# Inline
echo '{"actionType": "st.openPersonPage", "personUrl": "https://www.linkedin.com/in/person1", "basicInfo": true}' | linkedin workflow run
```

The definition is the request body of `POST /workflows`: one action object, or an array of actions that run one after another. See [Building Workflows](/docs/building-workflows) for the schema.

## workflow status

Check status of a running workflow or wait for its completion.
In-progress responses include `status` (`pending` or `running`) and `message`.

Reads [`GET /workflows/{workflowId}`](/docs/executing-workflows#checking-for-result) – what each option means, the result fields and the errors are described there.

```bash
linkedin workflow status <id> [flags]
```

| Arg | Required | Description |
| --- | --- | --- |
| `id` | yes | Workflow ID |

| Flag | Type | Description |
| --- | --- | --- |
| `--wait` | boolean | Block until the workflow completes |

```bash
# Check current status
linkedin workflow status abc123

# Wait for completion
linkedin workflow status abc123 --wait --json
```
