VocalDocscontracts 1.65.0

Subscribe to a Trigger of a Connection

POST /v1/trigger-subscriptions

PropertyValue
Operationcreate_trigger_subscription
GroupTriggers
Scopeintegrations:write
Route classcontrol
IdempotencyIdempotency-Key accepted: a retry with the same key replays the first answer
AuditAudited integrations.trigger_subscription.create (mutation)
Released in1.60.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Creates a subscription at revision 1 and answers its subscription_token once (1.60.0). The filter is linted over the Trigger's data schema and every pointer checked (TriggerSubscriptionIssueCode); a revoked Connection is connection_revoked; an action 1.60.0 does not build is capability_not_available; a start_call set by a Member who is neither an owner nor an admin, or by an API key, is forbidden with owner_or_admin_required.

Request

Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the integrations:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.

curl -X POST "$VOCAL_API/v1/trigger-subscriptions" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "<name>",
    "connection_id": "con_...",
    "event_type": "<event_type>",
    "action": {
      "type": "start_call",
      "agent_id": "agt_...",
      "to": "<to>"
    }
  }'

Parameters

NameInTypeRequiredDescription
idempotency-keyheaderstringnoA client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response.

Request body

Content type application/json, required: TriggerSubscriptionCreateRequest.

FieldTypeRequiredDescription
actionTriggerActionInputyes
connection_idConnectionIdyes
enabledbooleannoTrue when omitted.
event_typeTriggerEventTypeNameyes
filterZenExpressionno
namestringyes
rate_limit_per_minuteintegerno60 when omitted (a target).

Responses

StatusContent typeShapeError codes
201application/jsonTriggerSubscription
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden, org_suspended
409application/jsonErrorEnvelopeconnection_revoked, idempotency_in_progress, idempotency_key_reused
422application/jsonErrorEnvelopevalidation_failed, capability_not_available
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 201 answer

The shape is TriggerSubscription.

FieldTypeRequiredDescription
actionTriggerActionyes
connection_idConnectionIdyes
connector_idConnectorIdyes
created_atTimestampyes
enabledbooleanyes
event_typeTriggerEventTypeNameyes
filterZenExpression or nullyesA ZEN expression over the event's typed fields; null acts on every event.
idTriggerSubscriptionIdyes
namestringyes
object"trigger_subscription"yes
organization_idOrganizationIdyes
previous_token_expires_atTimestamp or nullnoAfter a token rotation (1.61.0), when the previous token stops verifying, 24 hours later (a target); null otherwise, absent from an api before 1.61.0.
rate_limit_per_minuteintegeryes
revisionintegeryes
statusTriggerSubscriptionStatusyes
subscription_tokenstring (password) or null (password)yesThe token of the edge path /v1/triggers/{connector_id}/{subscription_token}, 32 random bytes in base64url: answered once by the create, null in every other answer.
token_hintstringyesThe last characters of the subscription token.
updated_atTimestampyes