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

# Triggers

> Choose what starts a workflow — a database event, an API request, an invoice past due, or a tenancy milestone.

The trigger is the first node on the canvas. Select it, then choose a **Trigger type**. Only **Active** workflows run when the trigger fires.

## Trigger types

| Trigger type          | When it runs                                                                                      |
| --------------------- | ------------------------------------------------------------------------------------------------- |
| **Database event**    | Whenever the event you choose occurs — for example a tenancy is activated or an invoice is paid.  |
| **API request**       | When your systems call the workflow through the API.                                              |
| **Invoice past due**  | Once, on the morning an open invoice reaches the number of days you set past its due date.        |
| **Tenancy milestone** | Once, on the morning an active tenancy reaches the number of months you set after its start date. |

## Database event

Use **Database event** when something happening in Yorlet should start the workflow.

To configure it, follow these steps:

1. Set **Trigger type** to **Database event**.
2. Choose an **Event** from the list. Events are grouped by record type, such as invoice, tenancy, application, and maintenance.

The workflow runs whenever that event occurs. Common examples:

* `tenancy.activated` — a tenancy becomes active
* `invoice.paid` — an invoice is paid
* `application.accepted` — an application is accepted
* `maintenance.issue.created` — a maintenance issue is raised
* `contract.completed` — a contract is signed

The record that caused the event is available to later steps as the trigger object. Use **Insert variable** to add fields such as the record ID or a related customer. See [Variables](/business-automation/workflows/variables).

<Tip>
  Use an [If / else](/business-automation/workflows/conditions-and-loops) step after the trigger if you only want the workflow to continue for some records — for example, only invoices above a certain amount.
</Tip>

## API request

Use **API request** when you want to start the workflow from your own systems, rather than from something happening in Yorlet.

There is no **Run** or **Test** button in the Dashboard. A teammate with an [API key](/development/api-keys) triggers the workflow by sending a request to it.

You can add **Input parameters** so the request can pass values in. Click **Add** for each parameter, then set:

* A **key** — the name you will send, and the name you reference later as `{{ trigger.input.<key> }}`
* A type — **String**, **Number**, or **Boolean**
* **Required** — turn this on if the request must include the parameter

<Note>
  Developers trigger the workflow with `POST /v1/workflows/:id/trigger` and an optional `input` object keyed by the parameter names you defined.
</Note>

## Invoice past due

Use **Invoice past due** to run a workflow once an open invoice has gone unpaid for a set number of days.

Set **Days past due** to a value from 1 to 30. The workflow runs once when an open invoice is that many days past its due date.

Yorlet checks each morning and only includes invoices that are still open and unpaid. It skips invoices that are already being collected, invoices created as a late fee, and invoices that have been sent to [Recover](/billing/arrears).

<Tip>
  A typical use is a **Create task** or **Send letter** step when rent is 7 days overdue. Combine it with an [If / else](/business-automation/workflows/conditions-and-loops) step if you only want to act on certain customers or amounts.
</Tip>

The invoice is available to later steps as the trigger object, so you can insert the customer, amount, or invoice ID.

## Tenancy milestone

Use **Tenancy milestone** to run a workflow once an active tenancy reaches a set number of months after its start date — for example a two-month check-in or a twelve-month renewal reminder.

Set **Months after tenancy start** to a value from 1 to 120. The workflow runs once when an active tenancy reaches that many months after it started.

Yorlet checks each morning and only includes tenancies that are still active.

The tenancy is available to later steps as the trigger object, so you can insert the tenants, unit, or start date.
