Create a new Subscription.
Subscription to send Event Types to a Sink
Create a new Subscription.
Body
-
A human readable description for the Subscription This value should not contain PII.
-
The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created.
Minimum length is
34, maximum length is34. Format should match the following pattern:^DG[0-9a-fA-F]{32}$. -
An array of objects containing the subscribed Event Types
POST
/v1/Subscriptions
curl \
--request POST 'https://events.twilio.com/v1/Subscriptions' \
--user "username:password" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data 'Types=%7B%22type%22%3A+%22com.twilio.messaging.message.delivered%22%2C%22schema_version%22%3A+1%7D&Types=%7B%22type%22%3A+%22com.twilio.messaging.message.failed%22%2C%22schema_version%22%3A+12%7D&SinkSid=DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&Description=A+subscription'
Request example
{"Types" => ["{\"type\": \"com.twilio.messaging.message.delivered\",\"schema_version\": 1}", "{\"type\": \"com.twilio.messaging.message.failed\",\"schema_version\": 12}"], "SinkSid" => "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "Description" => "A subscription"}
Response examples (201)
{
"sid": "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"links": {
"subscribed_events": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents"
},
"sink_sid": "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"description": "A subscription",
"date_created": "2015-07-30T20:00:00Z",
"date_updated": "2015-07-30T20:01:33Z",
"receive_events_from_subaccounts": false
}