> For the complete documentation index, see [llms.txt](https://docs.codemash.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codemash.io/cloud/files/triggers/new.md).

# Create a trigger

**Where:** Files → Triggers → New · `/projects/<project>/files/triggers/new`

{% hint style="info" %}
Screenshot TODO — capture comes from testing-plan area **02-triggers**.
{% endhint %}

The form is a two-step flow: **If this** (the event) … **then** (the action).

## If this — pick the event

| Event                            | Fires                                                                                                                              |
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| When uploaded (`OnFileUploaded`) | A new file is uploaded — the dashboard's Upload commit or the API's [Commit Upload](/api-reference/files/commit/commit-upload.md). |
| When deleted (`OnFileDeleted`)   | A file is deleted.                                                                                                                 |

The file's data is passed to the action, so templates and payloads can use tokens from it.

## … then — pick the action

**Run Code** (invoke a serverless function with the event data), **Send Email**, **Send Push Notification**, **Send SMS** (all three from a template, with delivery settings for who receives it), **Call Webhook** (POST a signed event payload to your destinations — the webhook event name, `files.file.uploaded` or `files.file.deleted`, is implied by the chosen event; **Save** stays disabled until you select an enabled destination subscribed to that event), or **Send In-App (Realtime / SSE)** (deliver live to connected apps or AI agents). Each action opens its own settings block.

## Finish

Set the **Order** (lower numbers run earlier when several triggers share an event) and optionally **Break execution queue on failure**. Then **Name the trigger** (e.g. `When an invoice is uploaded, email accounting`), add a **Description**, and switch **Is this trigger enabled?** on when it is ready. Saving returns you to the list.

How triggers work in general — events, action types, and delivery settings — is explained in [Triggers](/other-topics/triggers.md).

## Use it from code

[Files → Triggers](/sdks-and-cli/files/triggers.md)

## API reference

Endpoints: [Save Files Trigger](/api-reference/files/triggers/save-files-trigger.md).
