Create a new Subscription.

POST /v1/Subscriptions

Subscription to send Event Types to a Sink

Create a new Subscription.

application/x-www-form-urlencoded

Body

  • Description string Required

    A human readable description for the Subscription This value should not contain PII.

  • SinkSid string Required

    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 is 34. Format should match the following pattern: ^DG[0-9a-fA-F]{32}$.

  • Types array Required

    An array of objects containing the subscribed Event Types

Responses

  • 201 application/json

    Created

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

    Hide response attributes Show response attributes object
    • account_sid string | null

      The unique SID identifier of the Account.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

    • sid string | null

      A 34 character string that uniquely identifies this Subscription.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^DF[0-9a-fA-F]{32}$.

    • date_created string(date-time) | null

      The date that this Subscription was created, given in ISO 8601 format.

    • date_updated string(date-time) | null

      The date that this Subscription was updated, given in ISO 8601 format.

    • description string | null

      A human readable description for the Subscription

    • sink_sid string | null

      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 is 34. Format should match the following pattern: ^DG[0-9a-fA-F]{32}$.

    • url string(uri) | null

      The URL of this resource.

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
}