# On sandbox event

Sandbox event triggers allow you to automate pipelines based on sandbox lifecycle events: when a sandbox is created, deleted, or timed out.

Sandbox event triggers let you automate pipelines based on sandbox lifecycle events. When a sandbox is created, deleted, or times out, Buddy automatically runs all pipelines whose **Sandbox Scope** matches the sandbox.

There are three sandbox event types:

- **Sandbox: Create** - triggered when a new sandbox is created
- **Sandbox: Delete** - triggered when a sandbox is deleted
- **Sandbox: Time out** - triggered when a sandbox times out

![Sandbox event triggers in Buddy](/docs/static/articles/pipelines/triggering-pipelines/triggering-pipelines-sandboxes.png 640x937)

## Configure trigger

1. Open your pipeline and go to the **Workflow** tab.
2. Click **+** in the **Triggers** section and select one of the sandbox events: **Sandbox: Create**, **Sandbox: Delete**, or **Sandbox: Time out**.
3. Configure **Sandbox Scope** to control which sandboxes can start the pipeline.
4. Click **Save**.

## Sandbox Scope

Each sandbox trigger includes a **Sandbox Scope** section that controls which sandboxes can activate the pipeline. By default, the scope is set to `ID: *`, meaning the trigger fires for all sandboxes.

Click **+** to add a scope entry and choose between two modes:

- **Sandbox** - select one or more specific sandboxes from a searchable list of existing sandboxes in the workspace.
- **Match by filters** - define a filter manually using:
  - **ID** - a sandbox identifier pattern that supports wildcards (e.g., `my-sandbox-*`). Leave empty or use `*` to match any sandbox.
  - **Tags** - one or more tags the sandbox must have.

Multiple scope entries are evaluated with **OR logic** - the trigger fires if any entry matches the sandbox. All three event types (Create, Delete, Time out) use the same Sandbox Scope configuration.

### Examples

- `ID: preview-*` - matches all sandboxes whose name starts with `preview-`
- `Tags: staging` - matches only sandboxes tagged as `staging`
- `ID: *` + `Tags: production` - matches all sandboxes, or only those tagged `production` (OR logic)

<Hint type="info">
Sandbox triggers are available when your workspace has at least one sandbox. See [Sandboxes](/docs/sandboxes/introduction.md) to learn how to create one.
</Hint>


---
Original source: https://buddy.works/docs/pipelines/introduction/triggering-pipelines/on-sandbox-event