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

# Set up an automation

> Create a scheduled automation for a saved reconciliation run, or run one on demand.

An automation puts a reconciliation run on a schedule — or makes it available on demand — so you are not manually running the same comparison every day. Set the input source and cadence once; Darpan handles execution and alerts from then on.

## Before you start

Confirm:

* A saved reconciliation run exists, or you are ready to create one.
* The saved run has the correct source systems, schemas, and primary IDs.
* Source access is ready: SFTP servers for file inputs, or API sources such as Shopify and HotWax for date-range extraction.
* The schedule is known: hourly, daily, weekly, monthly, or a custom schedule (you can also run an automation on demand and pause it with the **Active**/**Inactive** status).
* The remote file paths or API date window are known.
* Your user can edit tenant settings.

## Automation choices

| Choice                                                        | Use when                                                                                                                           |
| ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| **Automate an existing reconciliation**                       | The saved run already exists and only needs input and schedule setup.                                                              |
| **Create a new reconciliation and automate it**               | The saved run needs to be created before automation can be saved.                                                                  |
| **SFTP file inputs**                                          | Each run should read files from SFTP paths.                                                                                        |
| **API date-range extraction**                                 | Each run should pull source records from API-backed sources such as Shopify or HotWax.                                             |
| **Run now** or the **Active**/**Inactive** status             | The automation should be runnable on demand, or paused, instead of relying only on its schedule.                                   |
| **Hourly**, **Daily**, **Weekly**, **Monthly**, or **Custom** | The automation should run on a recurring schedule. For **Daily**, set the time in the separate **Time** field (defaults to 06:00). |

## Steps

<Steps>
  <Step title="Open automations">
    Open **Ask Darpan** with `Cmd/Ctrl+K` or the floating **Ask Darpan** button. Search for **Open Automations** and open the result.
  </Step>

  <Step title="Start the automation wizard">
    Choose **Create Automation**. Darpan asks **What is this automation for?**

    Choose **Automate an existing reconciliation** when the saved run already exists. Choose **Create a new reconciliation and automate it** when the run setup still needs to be created.
  </Step>

  <Step title="Choose the saved run">
    When Darpan asks **Which saved run should this automation use?**, select the saved reconciliation run.

    If the run is missing, go back to [Set up a reconciliation run](/guides/setup-reconciliation-run) and create it first.
  </Step>

  <Step title="Choose the input mode">
    When Darpan asks how it should get files for the run, choose one input mode:

    * **SFTP file inputs** for two remote file paths.
    * **API date-range extraction** for two API-backed sources and a date window.
  </Step>

  <Step title="Configure the sources">
    For **SFTP file inputs**, choose the SFTP server for the first file, enter the first remote path, choose the SFTP server for the second file, and enter the second remote path.

    For **API date-range extraction**, choose the API source for the first file, choose the API source for the second file, and select the date window.
  </Step>

  <Step title="Choose the schedule">
    When Darpan asks **When should Darpan run this automation?**, choose a schedule preset: **Hourly**, **Daily**, **Weekly**, **Monthly**, or **Custom**. For **Daily**, set the time in the separate **Time** field, which defaults to 06:00.

    Times are read in **the tenant's timezone**, not UTC. A daily automation set to 06:00 runs at 06:00 for the tenant, wherever the server happens to be. Set the tenant timezone in [Manage tenant settings](/guides/manage-tenant-settings) before relying on a specific hour.

    To run an automation on demand rather than on a schedule, use the **Run now** action on its dashboard. To stop scheduled runs without deleting the automation, switch its status with the **Active**/**Inactive** control — available on the automation tile from the dashboard, so pausing one does not mean opening its edit form.
  </Step>

  <Step title="Name and create the automation">
    Answer **What should this automation be called?** with a stable name that includes the compared systems and cadence. Choose **Create Automation**.
  </Step>

  <Step title="Validate the automation">
    Return to **Open Automations** and open the automation tile to view its dashboard. Confirm the **Schedule**, **Status**, and **Next Run** are as expected. Verify the input mode within the wizard.

    Use the **Run now** action for a controlled test, then open automation history to confirm the execution status and generated output.
  </Step>
</Steps>

## Keep an automation in step with its run

An automation is a **snapshot** of a saved run, not a live pointer at one. It copies the compare scope, the input mode, both source definitions and the exclusion filters at the moment you create it. Editing the underlying run afterwards does not change the automation — which is deliberate, since a nightly job silently changing shape because someone edited a run during the day is worse than one that stays put.

The cost of that choice is drift. So Darpan reports it: open an automation whose saved run has moved on and it names the fields that no longer match.

**Sync** re-derives the snapshot from the saved run. It overwrites the compare scope, the input mode, both source definitions and the exclusion filters. It preserves everything the run cannot supply — the name, the schedule, the window, the chat space, the active status, and the SFTP server, path and pattern.

<Note>
  Sync never re-points an automation at a different run. The saved run an automation was built from is fixed for its lifetime: **an automation's saved run cannot be changed — create a new automation for a different run.** If the saved run has been deleted, sync refuses rather than guessing, and the automation has to be recreated.
</Note>

Sync when the drift report names a field you care about. Ignore it when it names one you deliberately diverged from — the automation is allowed to differ from its run, and Darpan reports the difference rather than correcting it for you.

## Troubleshooting

* If no saved runs appear, finish [Set up a reconciliation run](/guides/setup-reconciliation-run) first.
* If an automation reports drift, compare the named fields against the saved run and use **Sync** only if you want the run's version to win.
* If **Sync** is refused, the automation's saved run no longer exists. Recreate the automation against a current run.
* If a schedule fires at an unexpected hour, check the tenant timezone rather than the schedule — times are interpreted in the tenant's timezone.
* If saving or syncing is refused with a view-access message, your active tenant grants you view access only; automation changes need write access.
* If no SFTP source appears, create or reactivate the required SFTP server from **Open SFTP Servers**.
* If no API source appears, confirm the relevant system setup from [Set up Shopify](/guides/setup-shopify) or [Set up HotWax](/guides/setup-hotwax).
* If a scheduled automation produces no matches, check source date ranges, remote file paths, schemas, and primary IDs before changing the schedule.
