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

# Fire-and-Delete

> Auto-delete a webhook subscription after its first successful delivery with one_shot.

<Note>
  **Filter:** `one_shot` (boolean) \
  **Applies to:** every webhook event
</Note>

Set `one_shot: true` in a webhook's `filters` to make it a one-time trigger: the subscription delivers once, then deletes itself. It is the webhook equivalent of a single-use alert, useful when you only care about the *first* time something happens and do not want to manage cleanup yourself.

## How it works

When a delivery for a `one_shot` webhook succeeds, Struct deletes the subscription automatically. No further events are delivered, and the webhook no longer appears in [`GET /v1/webhooks`](/webhooks/getting-started#managing-webhooks).

* **Fires exactly once.** If several events match in the same instant, only the first delivery goes out; the rest are dropped before the subscription is removed.
* **Deletes only on success.** The subscription is removed after a delivery your endpoint acknowledges with a `2xx`. If every retry fails, the webhook is not deleted: it follows the normal [retry and auto-disable](/webhooks/delivery) path instead, so a one-shot is never silently lost to a flaky endpoint.
* **Test deliveries are safe.** A [test delivery](/webhooks/getting-started) never consumes the one-shot or deletes the subscription, so you can verify your endpoint as many times as you like before the real event arrives.

## Enabling it

Add `one_shot` to the `filters` object alongside any other filters for the event. The best fit is [`price_threshold`](/webhooks/price-threshold): watch a market and fire the first time its price crosses your target, then remove the subscription. Here it fires once when a market's YES outcome crosses up through 75%:

<CodeGroup>
  ```typescript SDK theme={null}
  import { StructClient } from "@structbuild/sdk";

  const client = new StructClient({ apiKey: "sk_live_xxx" });

  const { data: webhook } = await client.webhooks.create({
    url: "https://your-server.com/webhooks",
    event: "price_threshold",
    filters: {
      condition_ids: ["0x4fec624c0ff2bfae89956cebd6fbc9c58f995f824382dc587dc5a32a4b15940b"],
      min_price: 0.75,
      one_shot: true,
    },
  });
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.struct.to/v1/webhooks \
    -H "X-API-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "url": "https://your-server.com/webhooks",
      "event": "price_threshold",
      "filters": {
        "condition_ids": ["0x4fec624c0ff2bfae89956cebd6fbc9c58f995f824382dc587dc5a32a4b15940b"],
        "min_price": 0.75,
        "one_shot": true
      }
    }'
  ```
</CodeGroup>

<Note>
  `price_threshold` requires `position_ids` or `condition_ids` when `one_shot` is set, so the subscription targets a bounded set of markets. The `condition_ids` above satisfies that.
</Note>

## Common patterns

* **First-of-a-kind events.** Beyond `price_threshold`, catch the first whale trade on a market, the first new market in a category, or a single resolution, without leaving a long-lived subscription behind.
* **Self-cleaning automations.** Spin up a webhook for a transient interest (a market you are watching today) and let it remove itself once it fires.

## Notes

* `one_shot` is available on every event's filters and defaults to `false`.
* The deletion is recorded with the event that triggered it, so you can trace why a subscription disappeared.
* [`price_threshold`](/webhooks/price-threshold) additionally requires `position_ids` or `condition_ids` when `one_shot` is set, so the target stays bounded.
