# Cron Job Management (lam.cron)

lam.cron is a powerful scheduling system that allows you to create, manage, and execute scheduled tasks (cron jobs) within your workflows. Users create cron steps by defining step programs that return `lam.cron` objects containing scheduling information, with support for creating, updating, deleting, and listing scheduled tasks.

## Key Concepts

A Cron job is created by defining step programs that return `lam.cron` object. Each cron operation consists of:

* **Operation Types**: Create, update, or delete
* **Cron Schedules**: Standard cron syntax for defining when tasks run
* **URL**: Destination of the POST request and body
* **Body**: JSON body that will be sent as part of the cron job

## Creating a cron job

```javascript
(data) => {
    return {
        "lam.cron": {
            "operation": "create",
            "name": "Daily Report",
            "schedule": "0 0 9 * * *",
            "url": "https://api.laminar.run/workflow/execute/external/308?api_key=your-key&configuration_id=58",
            "body": {
                "report_type": "daily"
            }
        }
    };
}
```

<p align="right"><strong>Response to creating the cron job</strong></p>

## Updating a cron job

```javascript
(data) => {
    return {
        "lam.cron": {
            "operation": "update",
            "name": "Daily Report",
            "schedule": "0 0 10 * * *", // Change from 9 AM to 10 AM
            "url": "https://api.laminar.run/workflow/execute/external/308?api_key=your-key&configuration_id=58",
            "body": {
                "report_type": "daily"
            }
        }
    };
}
```

## Deleting a cron job

```javascript
(data) => {
  // Your code here
  return   {
    "lam.cron": {
      "operation": "delete",
      "jobId":"229988fd-0308-472a-8385-380f2b97f461"
    }
  };
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.laminar.run/cron-job-management-lam.cron.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
