Subscribe several accounts to a trigger Beta
This endpoint is in beta. Its request and response may change.
Subscribes up to 100 connected accounts to one trigger with the same filters, and returns a result for each account. An account that can't subscribe doesn't stop the others: its result is REFUSED, NOT_FOUND or FAILED, with a reason. Retrying the request is safe; an account subscribed earlier comes back as ALREADY_SUBSCRIBED. For a per-connection trigger, send an empty connected_account_ids.
Authorization
Authorization: Bearer $TOKEN, an access token from the client credentials grant. See Authentication.
Path parameters
connection_idstringrequiredBody
trigger_namestringrequiredconfigobjectconnected_account_idsarray of stringinterval_secondsintegerscalekit_client.actions.triggers.batch_create_subscriptions
Subscribe up to 100 connected accounts to a trigger in one call. Not atomic: each account gets its own outcome in results (CREATED, ALREADY_SUBSCRIBED, REFUSED, NOT_FOUND, FAILED), and those never raise. Safe to call again for the FAILED ones. For a connection-scoped trigger, leave connected_account_ids out.
scalekit_client.actions.triggers.batch_create_subscriptions( connection_id: str, trigger_name: str, connected_account_ids: Sequence[str] | None = None, interval: timedelta | None = None, config: Mapping[str, str] | None = None,) -> BatchCreateTriggerSubscriptionsResponseParameters
connection_idstrrequiredconn_...).trigger_namestrrequiredAvailableTrigger.name.connected_account_idsSequence[str] | Noneca_...), unique.intervaltimedelta | Nonecreate_subscription).configMapping[str, str] | Noneconfig_fields.Returns BatchCreateTriggerSubscriptionsResponse: Per-account results and created_count.
From scalekit-sdk-python 2.23.0.
Response 200
created_countintegerresultsarray of objectShow 4 child attributes
connected_account_idstringoutcomestring (enum)CREATEDALREADY_SUBSCRIBEDREFUSEDNOT_FOUNDFAILEDreasonstringsubscriptionobjectShow 14 child attributes
account_healthstring (enum)READYAWAITING_CONFIRMATIONWRONG_APPDISCONNECTEDNEEDS_REAUTHENTICATIONconfigobjectconnected_account_idstringconnected_account_identifierstringuser_123, so you can label the subscription without fetching each account. Empty for a connection-scoped subscription, and empty when the account has no identifier recorded — fall back to connected_account_id rather than showing a blank.connection_idstringcreated_atstringdelivery_scopestring (enum)ACCOUNTCONNECTIONeffective_interval_secondsintegeridstringpoll_stateobjectproviderstringrequested_interval_secondsintegerstatusstring (enum)ACTIVETHROTTLEDPAUSEDPAUSED_CREDENTIALtrigger_namestringErrors
Every error has the same body: code, message and details. See Errors and rate limits.
400Invalid request, nothing created - connection_id or an entry of connected_account_ids is malformed; config is invalid for this trigger; interval_seconds is below the trigger's minimum, or is set for a webhook trigger; the trigger polls and is connection-scoped, which is not supported; or connected_account_ids is empty for a trigger that is subscribed per connected account. A well-formed ID naming an account that does not exist is not this case: it comes back as a per-account NOT_FOUND result with a 200, so one bad ID in a batch of a hundred does not discard the ninety-nine that would have succeeded404Not found - the connection does not exist in this environment, the connection's provider publishes no trigger with this name, or Triggers isn't turned on for your environment500Internal error - the connection or the trigger's definition could not be read, so no account was processed; retry the request