> ## Documentation Index
> Fetch the complete documentation index at: https://v3.captaindata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage Schedules

> Guide to managing and deleting scheduled runs using API endpoints

Scheduled runs play a crucial role in automating workflows, ensuring consistent and timely task execution.
This guide provides a detailed walkthrough of managing and deleting scheduled runs via API endpoints, allowing you to optimize your operations seamlessly.

As an API user, you can trigger workflows (actions) directly using the [POST Launch Workflow](/v3/api-reference/workflows/launch-workflow) API and manage repeat schedules with ease.

## Set a Repeat Schedule

To automate your workflows, include the following JSON in the request body when launching a workflow:

```json
https://api.captaindata.co/v3/workflows/:workflow_uid/schedule
```

Repeat Schedule JSON Structure:

```json
{
  "job_name": "",
  "steps": [...],
  "repeat_option": {
    "type": "minute/hour/day/week/month",
    "value": 5  // Must be an integer representing the interval
  }
}
```

* **"job\_name"**: The name of the job you want to launch.
* **"repeat\_option"**: Specifies the repeat schedule:
  * **type**: Options include **minute**, **hour**, **day**, **week**, or **month**.
  * **value**: The interval, represented as an integer.

## Delete a Repeat Schedule

If you no longer need a repeat schedule, you can delete it using the [DELETE Remove Schedule](/v3/api-reference/runs/remove-schedule) API. Here's how:

```
DELETE https://api.captaindata.co/v3/jobs/:job_name
```

Replace `:job_name` with the name of the job whose schedule you want to delete.

Which will give the following response:

```json
{
  "message": "Schedule deleted."
}
```

By setting or removing schedules, you maintain full control over your workflows, ensuring they align with your campaign needs.

## Example: Using Repeat Options to Detect Accepted Connection Requests

<Note>
  **Objective**: Automatically check for accepted LinkedIn connection requests
  every 3 hours.
</Note>

### Steps

1. **Trigger Workflow**: Use the [**Extract LinkedIn Connections**](https://app.captaindata.co/store/linkedin-connections-extractor) workflow on Captain Data.
2. **Set Repeat Options**: Add the following JSON snippet to the workflow's body:

```json
{
  "steps": [
    {
      "accounts": ["b12579a7-e15d-40ae-910b-..."],
      "parameters": {
        "skip": 0,
        "max_minutes": 180,
        "max_results": 1000
      },
      "step_uid": "6d5c29d2-8c52-4241-8759-..."
    }
  ],
  "unstructure_meta": false,
  "inputs": [], // For this Action you don't need inputs
  "job_name": "Scheduling a Run",
  "repeat_option": {
    "type": "hour",
    "value": 3
  }
}
```

### Result

* The workflow will extract the most recent connections from the past **3 hours**, with a maximum of **1,000 results** per run, scheduled to repeat every **3 hours**.
* You can detect and compare new LinkedIn connections with your leads.
* Once a connection request is accepted, you can enroll leads into the next campaign steps.

<Tip>
  Always use a frequency that matches your campaign needs (e.g., every 3 hours
  is recommended).
</Tip>

## Advanced Example: Using the Repeat Option – LinkedIn Campaign Implementation Guide

<Note>
  Checkout this more in-depth [Implementation Guide to Build LinkedIn
  Campaigns](/v3/linkedin/build-outreach-campaigns) for an advanced scheduling
  example.
</Note>
