# Running Jobs

We'll asume you have created a Job already, if you want to know how to create a new Job please read [this](https://docs.zirkul.com/devsecops/creating-jobs).

There are diverse ways you can use for running Jobs and we're going to cover each in this section.

### Webhook calls

Every Job has a webhook id that can be used for easily triggering the Job from anywhere, this webhook call information can be obtained directly from the Job by clicking the button "CICD Integration":<br>

<figure><img src="https://3824814822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2TrvRPLIHQjOEfOcBEbb%2Fuploads%2Fp2MRFn7GclmInZSJkujX%2Fimage.png?alt=media&#x26;token=cecdf237-65a5-473d-b976-61a88af10b6e" alt=""><figcaption></figcaption></figure>

This will open a window where you can copy the command used for triggering the Job

<figure><img src="https://3824814822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2TrvRPLIHQjOEfOcBEbb%2Fuploads%2FD1XDePcHqxsstPg16xxN%2Fimage.png?alt=media&#x26;token=8abaf836-cf93-4178-b476-3e6c90647d5b" alt=""><figcaption></figcaption></figure>

Let's see several ways for calling the webhook:

#### CURL command

OSX and Linux:

```sh
curl -H "X-API-KEY: <API_KEY>" https://app.zirkul.com/api/webhook/<id>
```

Windows:

```sh
curl -H @{'X-API-KEY'='<API_KEY>'} https://app.zirkul.com/api/webhook/<id>
```

If you want to send variables in your request, use the custom http request header `ZIRKUL-VARIABLES` as follows.

```sh
curl -H "X-API-KEY: <API_KEY>" -H "ZIRKUL-VARIABLES: my_var='the value' " https://app.zirkul.com/api/webhook/<id>
```

#### Zirkul Agent CLI

The Agent can be executed as a CLI interactive tool and there are some parameters that allows you to call a webhook with some extended functionalities.

This is a simple command for calling a webhook and wait until the job is completed:

```sh
zirkul --agent cicd --server https://app.zirkul.com --webhook <WEBHOOK_ID> --apikey '<API_KEY>' --wait
```

You can also send custom variables to the Job with the [variables option.](https://docs.zirkul.com/zirkul-agent/running-the-agent/command-line-interface#external-variables)

The output would be something like this:

<figure><img src="https://3824814822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2TrvRPLIHQjOEfOcBEbb%2Fuploads%2FzXdqbf4rS6pm9ys7mwrk%2Fimage.png?alt=media&#x26;token=2c9d255b-dcb0-4040-b96f-157fbada9057" alt=""><figcaption></figcaption></figure>

Use the option `--wait` if you want the Agent to wait until the Job is completed, otherwise the command will exit as soon as the webhook call is completed.

See more about [webhook calls here](#webhook-calls).

#### PowerShell

```powershell

$headers = @{
    'X-API-KEY' = '<API_KEY>'
}
Invoke-RestMethod -Uri https://app.zirkul.com/api/webhook/<id> -Method Get -Headers $headers

```

### Securing your secrets

It's strongly recommended to store your API Keys in variables instead of hardcoding the values in your pipelines to prevent unauthorized access to secrets.
