> **Building with AI coding agents?** Install the authstack plugin with one command. This equips your agent with accurate Scalekit implementation patterns.
>
> **Recommended** (the `-y` flags skip prompts, so the command runs without an interactive terminal):
> ```bash
> npx -y @scalekit-inc/cli setup -y
> ```
>
> Global:
> ```bash
> npm install -g @scalekit-inc/cli
> scalekit setup -y
> ```
>
> Supports Claude Code, Cursor, GitHub Copilot, Codex + skills for other Agent Skills-compatible agents in `~/.agents/skills`.
> Skills: integrate-agentkit, implement-saaskit, add-mcp-oauth, implement-sso, implement-scim.
> [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Delete several trigger subscriptions (beta)

`POST /api/v1/connections/{connection_id}/trigger-subscriptions:batchDelete`

This endpoint is in beta. Its request and response may change.

Deletes trigger subscriptions on one connection and returns a result for each. Name them in one of two ways: by `subscription_ids`, or by `trigger_name` together with `connected_account_ids`, which deletes every subscription those accounts have to that trigger. A subscription that's already gone, such as one you deleted earlier, comes back as `BATCH_DELETE_OUTCOME_NOT_FOUND`, so retrying the request is safe. Up to 60 requests a minute per environment.

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `connection_id` | string | Yes | ID of the connection whose subscriptions to delete. Only subscriptions on this connection are deleted: a subscription ID from another connection comes back as NOT_FOUND. |

**Request body**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `connected_account_ids` | array of string | No | With trigger_name, the other selector: connected account IDs (`ca_`) whose subscriptions to trigger_name to delete, at most 100, with no repeats. One account can hold several subscriptions to one trigger, one per filter; each is deleted and gets its own result. Results are grouped by account in the order sent and, within an account, ordered by ascending subscription ID. An account with no matching subscription gets one NOT_FOUND result with an empty subscription_id. A connection-scoped subscription names no account, so it is never matched here: delete it by subscription_ids. |
| `subscription_ids` | array of string | No | Trigger subscription IDs (`trgs_`) to delete, at most 100, with no repeats. One of the two selectors: send either this, or trigger_name with connected_account_ids, never both. Results come back one per ID, in the order sent. Works for account-scoped and connection-scoped subscriptions alike. |
| `trigger_name` | string | No | With connected_account_ids, the other selector: deletes every subscription the listed accounts hold to this trigger on this connection, whatever its filter. Must be sent together with connected_account_ids; sent alone it is refused, so no request can delete every subscription to a trigger. Not checked against the trigger catalogue: a name no subscription uses gives NOT_FOUND for every account. At most 128 characters. |

**Response (200)**

| Name | Type | Description |
| --- | --- | --- |
| `deleted_count` | integer | How many subscriptions this call deleted. Excludes NOT_FOUND results, so a subscription an earlier attempt already deleted is not counted again. |
| `results` | array of object | For subscription_ids, one result per ID in the order sent, so a client can pair them up positionally. For trigger_name with connected_account_ids, the results are grouped by account in the order sent, ordered by ascending subscription ID within an account, with one NOT_FOUND result for an account that held no matching subscription. |
| `results.connected_account_id` | string | For trigger_name with connected_account_ids, the account this result belongs to, as sent. Always empty for a subscription_ids request. |
| `results.outcome` | string (enum) | What happened to this subscription. BATCH_DELETE_OUTCOME_DELETED — deleted by this call. BATCH_DELETE_OUTCOME_NOT_FOUND — no such subscription on this connection in this environment, including one an earlier attempt already deleted; treat it like DELETED when retrying. BATCH_DELETE_OUTCOME_FAILED — the delete could not be completed and may or may not have happened; retrying is safe. BATCH_DELETE_OUTCOME_NOT_ATTEMPTED — the request ran out of time before reaching this subscription; nothing was changed for it, so send it again. One of: `BATCH_DELETE_OUTCOME_DELETED`, `BATCH_DELETE_OUTCOME_NOT_FOUND`, `BATCH_DELETE_OUTCOME_FAILED`, `BATCH_DELETE_OUTCOME_NOT_ATTEMPTED`. |
| `results.reason` | string | One sentence explaining the outcome. Empty for BATCH_DELETE_OUTCOME_DELETED. Never contains internal error detail. The wording can change: match on outcome, not on this text. |
| `results.subscription_id` | string | The subscription this result is about. For subscription_ids, the ID exactly as sent. For trigger_name with connected_account_ids, a subscription found for the account; empty only on the single NOT_FOUND result of an account that held no matching subscription. |

**Errors**

- `400`: Invalid request, nothing deleted - both selectors or neither were sent, or `trigger_name` and `connected_account_ids` were not sent together; a list holds more than 100 IDs or repeats one, including two spellings of the same ID; `connection_id` is not a valid connection ID, an entry of `subscription_ids` is not a trigger subscription ID (`trgs_`), or an entry of `connected_account_ids` is not a connected account ID (`ca_`); or the named accounts hold more than 1000 subscriptions to the trigger, so fewer `connected_account_ids` must be sent per request. A well-formed ID naming a subscription that does not exist, was already deleted, or belongs to another connection is not this case: it comes back as a NOT_FOUND result with a 200, so one stale ID does not discard the rest of the batch.
- `404`: Not found - Triggers isn't turned on for your environment, or `connection_id` can never name a connection. Nothing was deleted. A missing subscription is not this case: it is a NOT_FOUND result with a 200.
- `429`: Too many requests - this environment has sent too many batch delete requests in the last minute. Nothing was deleted; retry after a short wait.
- `500`: Internal error - the subscriptions that `trigger_name` and `connected_account_ids` name could not be read, so nothing was deleted. Only that selector fails this way; retrying is safe.

**Request**

```bash
curl -sS -X POST \
  "$SCALEKIT_ENVIRONMENT_URL/api/v1/connections/conn_133400101014995480/trigger-subscriptions:batchDelete" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "subscription_ids": [
      "trgs_141020933185734981",
      "trgs_141020933185736602"
    ]
  }'
```

**Response**

```json
{
  "results": [
    {
      "subscription_id": "trgs_141020933185734981",
      "connected_account_id": "",
      "outcome": "BATCH_DELETE_OUTCOME_NOT_FOUND",
      "reason": "trigger subscription not found"
    },
    {
      "subscription_id": "trgs_141020933185736602",
      "connected_account_id": "",
      "outcome": "BATCH_DELETE_OUTCOME_DELETED",
      "reason": ""
    }
  ],
  "deleted_count": 1
}
```

**Python SDK:** `scalekit_client.actions.triggers.batch_delete_subscriptions`

Delete many trigger subscriptions in one call. Choose one selector: `subscription_ids` (up to 100), or `trigger_name` with `connected_account_ids` (up to 100). Each subscription gets its own outcome in `results` (`DELETED`, `NOT_FOUND`, `FAILED`, `NOT_ATTEMPTED`), and those never raise. Safe to call again.

```python
scalekit_client.actions.triggers.batch_delete_subscriptions(
    connection_id: str,
    subscription_ids: Sequence[str] | None = None,
    trigger_name: str | None = None,
    connected_account_ids: Sequence[str] | None = None,
) -> BatchDeleteTriggerSubscriptionsResponse
```

Example:

```python
result = scalekit_client.actions.triggers.batch_delete_subscriptions(
    connection_id="conn_133400101014995480",
    subscription_ids=["trgs_141020933185734981", "trgs_141020933185736602"],
)
```

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `connection_id` | `str` | Yes | The connection (`conn_...`). |
| `subscription_ids` | `Sequence[str] \| None` | No | The subscriptions to delete (`trgs_...`). |
| `trigger_name` | `str \| None` | No | With `connected_account_ids`: the trigger to unsubscribe. |
| `connected_account_ids` | `Sequence[str] \| None` | No | With `trigger_name`: the accounts (`ca_...`). |

Returns `BatchDeleteTriggerSubscriptionsResponse`: Per-subscription results and `deleted_count`.


Part of [Triggers](https://docs.scalekit.com/agentkit/reference/triggers/) in the [AgentKit API reference](https://docs.scalekit.com/agentkit/reference/). Authentication: https://docs.scalekit.com/agentkit/reference/authentication.md. Errors and rate limits: https://docs.scalekit.com/agentkit/reference/errors.md. Pagination: https://docs.scalekit.com/agentkit/reference/pagination.md


---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
