---
title: "Delete several trigger subscriptions"
method: POST
path: "/api/v1/connections/{connection_id}/trigger-subscriptions:batchDelete"
tags: ["Triggers"]
---

# Delete several trigger subscriptions

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

## Request

- Base URL: `https://$SCALEKIT_ENVIRONMENT_URL`
- URL: `https://$SCALEKIT_ENVIRONMENT_URL/api/v1/connections/{connection_id}/trigger-subscriptions:batchDelete`
- Auth: OAuth 2
  - Client credentials
  - Token URL: `https://$SCALEKIT_ENVIRONMENT_URL/oauth/token`
- TypeScript: <https://skmtc.dev/scalekit/apis/scalekit-api-reference/docs/api/v1/connections/:connection_id/trigger-subscriptions:batchDelete/post.ts> (a function with typed inputs; its response is checked against the schema)

Deletes many trigger subscriptions on one connection, and reports what happened to each one separately. Use this endpoint to unsubscribe a selection from the subscription list, or every subscription a set of connected accounts holds to one trigger, instead of calling DeleteTriggerSubscription once per subscription. Pass the connection ID in the path, and name the subscriptions in the body in exactly one of two ways: by `subscription_ids`, or by `trigger_name` together with `connected_account_ids`, which deletes every subscription those accounts hold to that trigger on this connection, whatever its filter. `trigger_name` alone is refused, so no request can delete every subscription to a trigger. The call is best-effort rather than all-or-nothing: a subscription that could not be deleted does not bring back one that was. Retrying the whole request is safe: a subscription deleted by an earlier attempt comes back as NOT_FOUND, so treat DELETED and NOT_FOUND alike as gone. Unlike DeleteTriggerSubscription, which answers 404 for a missing subscription, the batch reports it as one NOT_FOUND result among many. Delivery stops for each deleted subscription exactly as with DeleteTriggerSubscription: an event already handed off for delivery is still delivered. Returns one result per subscription, each with its outcome (DELETED, NOT_FOUND, FAILED, or NOT_ATTEMPTED when the request ran out of time before reaching it) and a reason, plus deleted_count.

## Path parameters

- `connection_id` string, required

## Request body

- TriggerServiceBatchDeleteTriggerSubscriptionsBody: Which subscriptions to delete: subscription_ids, or trigger_name with connected_account_ids. Send exactly one selector; any other combination is refused with 400. trigger_name alone, which would name every subscription to a trigger, is deliberately not a selector: to delete those, page ListTriggerSubscriptions and send the IDs.
  - `connected_account_ids` string[]: 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` string[]: 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: 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`

Request processed; every subscription ID, or every subscription found for the named accounts, has its own result in results, and deleted_count says how many subscriptions this call deleted

- TriggersBatchDeleteTriggerSubscriptionsResponse
  - `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` TriggersBatchDeleteTriggerSubscriptionResult[]: 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.
    - `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.
    - `outcome` 'BATCH_DELETE_OUTCOME_DELETED' | 'BATCH_DELETE_OUTCOME_NOT_FOUND' | 'BATCH_DELETE_OUTCOME_FAILED' | 'BATCH_DELETE_OUTCOME_NOT_ATTEMPTED': What happened to one subscription in a batch delete. - BATCH_DELETE_OUTCOME_DELETED: The subscription was 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, which is what makes retrying the whole batch safe. Another connection's or another tenant's subscription is reported exactly like a missing one. - BATCH_DELETE_OUTCOME_FAILED: The delete could not be completed. It may or may not have happened; retrying is safe and answers DELETED or NOT_FOUND. - BATCH_DELETE_OUTCOME_NOT_ATTEMPTED: The request ran out of time before this subscription was reached. Nothing was changed for it; send it again.
    - `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.
    - `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.

## Other responses

- `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 is not enabled for the 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.

## Changes

- **2026-10-30** `f47f1022d844`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/scalekit/apis/scalekit-api-reference/changes/api/v1/connections/:connection_id/trigger-subscriptions:batchDelete/post.md)

---

[API](https://skmtc.dev/scalekit/apis/scalekit-api-reference.md) - [All operations](https://skmtc.dev/scalekit/apis/scalekit-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/scalekit/apis/scalekit-api-reference/revisions/f47f1022d844?raw)
