Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

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.

Authorization

Authorization: Bearer $TOKEN, an access token from the client credentials grant. See Authentication.

Path parameters

connection_idstringrequired
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.

Body

connected_account_idsarray of 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_idsarray of 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_namestring
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

deleted_countinteger
How many subscriptions this call deleted. Excludes NOT_FOUND results, so a subscription an earlier attempt already deleted is not counted again.
resultsarray 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.
Show 4 child attributes
connected_account_idstring
For trigger_name with connected_account_ids, the account this result belongs to, as sent. Always empty for a subscription_ids request.
outcomestring (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.
BATCH_DELETE_OUTCOME_DELETEDBATCH_DELETE_OUTCOME_NOT_FOUNDBATCH_DELETE_OUTCOME_FAILEDBATCH_DELETE_OUTCOME_NOT_ATTEMPTED
reasonstring
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_idstring
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

Every error has the same body: code, message and details. See Errors and rate limits.

400Invalid 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.
404Not 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.
429Too many requests - this environment has sent too many batch delete requests in the last minute. Nothing was deleted; retry after a short wait.
500Internal 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.