# Subscribed Event resource

With this API the user can perform CRUD operations on an Event associated with a Subscription.

With the Subscribed Event API you can:

* Add an existing event type to a subscription
* Get all events associated with a subscription
* Update an event on a subscription
* Delete an event on a subscription

## SubscribedEvent Properties

```json
{"type":"object","refName":"events.v1.subscription.subscribed_event","modelName":"events_v1_subscription_subscribed_event","properties":{"account_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^AC[0-9a-fA-F]{32}$","nullable":true,"description":"The unique SID identifier of the Account."},"type":{"type":"string","nullable":true,"description":"Type of event being subscribed to."},"schema_version":{"type":"integer","default":0,"description":"The schema version that the Subscription should use."},"subscription_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^DF[0-9a-fA-F]{32}$","nullable":true,"description":"The unique SID identifier of the Subscription."},"url":{"type":"string","format":"uri","nullable":true,"description":"The URL of this resource."}}}
```

## Add an Event Type

`POST https://events.twilio.com/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents`

This endpoint adds an existing event type to a particular subscription. It is possible to specify the version of the schema to use for the given event type. Otherwise the last available schema version will be used for the added event type.

### Path parameters

```json
[{"name":"SubscriptionSid","in":"path","description":"The unique SID identifier of the Subscription.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^DF[0-9a-fA-F]{32}$"},"required":true}]
```

### Request body parameters

```json
{"schema":{"type":"object","title":"CreateSubscribedEventRequest","required":["Type"],"properties":{"Type":{"type":"string","description":"Type of event being subscribed to."},"SchemaVersion":{"type":"integer","description":"The schema version that the Subscription should use."}}},"examples":{"create":{"value":{"lang":"json","value":"{\n  \"Type\": \"com.twilio.messaging.message.delivered\",\n  \"SchemaVersion\": 2\n}","meta":"","code":"{\n  \"Type\": \"com.twilio.messaging.message.delivered\",\n  \"SchemaVersion\": 2\n}","tokens":[["{","#C9D1D9"],"\n  ",["\"Type\"","#7EE787"],[":","#C9D1D9"]," ",["\"com.twilio.messaging.message.delivered\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"SchemaVersion\"","#7EE787"],[":","#C9D1D9"]," ",["2","#79C0FF"],"\n",["}","#C9D1D9"]],"annotations":[],"themeName":"github-dark","style":{"color":"#c9d1d9","background":"#0d1117"}}},"create200":{"value":{"lang":"json","value":"{\n  \"Type\": \"com.twilio.messaging.message.delivered\",\n  \"SchemaVersion\": 2\n}","meta":"","code":"{\n  \"Type\": \"com.twilio.messaging.message.delivered\",\n  \"SchemaVersion\": 2\n}","tokens":[["{","#C9D1D9"],"\n  ",["\"Type\"","#7EE787"],[":","#C9D1D9"]," ",["\"com.twilio.messaging.message.delivered\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"SchemaVersion\"","#7EE787"],[":","#C9D1D9"]," ",["2","#79C0FF"],"\n",["}","#C9D1D9"]],"annotations":[],"themeName":"github-dark","style":{"color":"#c9d1d9","background":"#0d1117"}}}},"encodingType":"application/x-www-form-urlencoded","conditionalParameterMap":{}}
```

Add Event Type to Subscription

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function createSubscribedEvent() {
  const subscribedEvent = await client.events.v1
    .subscriptions("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .subscribedEvents.create({
      type: "com.twilio.messaging.message.delivered",
    });

  console.log(subscribedEvent.accountSid);
}

createSubscribedEvent();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

subscribed_event = client.events.v1.subscriptions(
    "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
).subscribed_events.create(type="com.twilio.messaging.message.delivered")

print(subscribed_event.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Events.V1.Subscription;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var subscribedEvent = await SubscribedEventResource.CreateAsync(
            type: "com.twilio.messaging.message.delivered",
            pathSubscriptionSid: "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        Console.WriteLine(subscribedEvent.AccountSid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.events.v1.subscription.SubscribedEvent;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        SubscribedEvent subscribedEvent =
            SubscribedEvent.creator("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "com.twilio.messaging.message.delivered")
                .create();

        System.out.println(subscribedEvent.getAccountSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	events "github.com/twilio/twilio-go/rest/events/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &events.CreateSubscribedEventParams{}
	params.SetType("com.twilio.messaging.message.delivered")

	resp, err := client.EventsV1.CreateSubscribedEvent("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.AccountSid != nil {
			fmt.Println(*resp.AccountSid)
		} else {
			fmt.Println(resp.AccountSid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$subscribed_event = $twilio->events->v1
    ->subscriptions("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->subscribedEvents->create(
        "com.twilio.messaging.message.delivered" // Type
    );

print $subscribed_event->accountSid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

subscribed_event = @client
                   .events
                   .v1
                   .subscriptions('DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
                   .subscribed_events
                   .create(type: 'com.twilio.messaging.message.delivered')

puts subscribed_event.account_sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:events:v1:subscriptions:subscribed-events:create \
   --subscription-sid DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
   --type com.twilio.messaging.message.delivered
```

```bash
curl -X POST "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents" \
--data-urlencode "Type=com.twilio.messaging.message.delivered" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "subscription_sid": "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "type": "com.twilio.messaging.message.delivered",
  "schema_version": 2,
  "url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents/com.twilio.messaging.message.delivered"
}
```

Add Event Type with schema version

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function createSubscribedEvent() {
  const subscribedEvent = await client.events.v1
    .subscriptions("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .subscribedEvents.create({
      schemaVersion: 2,
      type: "com.twilio.messaging.message.delivered",
    });

  console.log(subscribedEvent.accountSid);
}

createSubscribedEvent();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

subscribed_event = client.events.v1.subscriptions(
    "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
).subscribed_events.create(
    type="com.twilio.messaging.message.delivered", schema_version=2
)

print(subscribed_event.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Events.V1.Subscription;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var subscribedEvent = await SubscribedEventResource.CreateAsync(
            type: "com.twilio.messaging.message.delivered",
            schemaVersion: 2,
            pathSubscriptionSid: "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        Console.WriteLine(subscribedEvent.AccountSid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.events.v1.subscription.SubscribedEvent;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        SubscribedEvent subscribedEvent =
            SubscribedEvent.creator("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "com.twilio.messaging.message.delivered")
                .setSchemaVersion(2)
                .create();

        System.out.println(subscribedEvent.getAccountSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	events "github.com/twilio/twilio-go/rest/events/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &events.CreateSubscribedEventParams{}
	params.SetType("com.twilio.messaging.message.delivered")
	params.SetSchemaVersion(2)

	resp, err := client.EventsV1.CreateSubscribedEvent("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.AccountSid != nil {
			fmt.Println(*resp.AccountSid)
		} else {
			fmt.Println(resp.AccountSid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$subscribed_event = $twilio->events->v1
    ->subscriptions("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->subscribedEvents->create(
        "com.twilio.messaging.message.delivered", // Type
        ["schemaVersion" => 2]
    );

print $subscribed_event->accountSid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

subscribed_event = @client
                   .events
                   .v1
                   .subscriptions('DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
                   .subscribed_events
                   .create(
                     type: 'com.twilio.messaging.message.delivered',
                     schema_version: 2
                   )

puts subscribed_event.account_sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:events:v1:subscriptions:subscribed-events:create \
   --subscription-sid DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
   --type com.twilio.messaging.message.delivered \
   --schema-version 2
```

```bash
curl -X POST "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents" \
--data-urlencode "Type=com.twilio.messaging.message.delivered" \
--data-urlencode "SchemaVersion=2" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "subscription_sid": "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "type": "com.twilio.messaging.message.delivered",
  "schema_version": 2,
  "url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents/com.twilio.messaging.message.delivered"
}
```

## Get All Events

`GET https://events.twilio.com/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents`

Get all event types associated with a particular subscription

### Path parameters

```json
[{"name":"SubscriptionSid","in":"path","description":"The unique SID identifier of the Subscription.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^DF[0-9a-fA-F]{32}$"},"required":true}]
```

### Query parameters

```json
[{"name":"PageSize","in":"query","description":"How many resources to return in each list page. The default is 50, and the maximum is 1000.","schema":{"type":"integer","format":"int64","minimum":1,"maximum":1000}},{"name":"Page","in":"query","description":"The page index. This value is simply for client state.","schema":{"type":"integer","minimum":0}},{"name":"PageToken","in":"query","description":"The page token. This is provided by the API.","schema":{"type":"string"}}]
```

Get all subscribed events types

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function listSubscribedEvent() {
  const subscribedEvents = await client.events.v1
    .subscriptions("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .subscribedEvents.list({ limit: 20 });

  subscribedEvents.forEach((s) => console.log(s.accountSid));
}

listSubscribedEvent();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

subscribed_events = client.events.v1.subscriptions(
    "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
).subscribed_events.list(limit=20)

for record in subscribed_events:
    print(record.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Events.V1.Subscription;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var subscribedEvents = await SubscribedEventResource.ReadAsync(
            pathSubscriptionSid: "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", limit: 20);

        foreach (var record in subscribedEvents) {
            Console.WriteLine(record.AccountSid);
        }
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.events.v1.subscription.SubscribedEvent;
import com.twilio.base.ResourceSet;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        ResourceSet<SubscribedEvent> subscribedEvents =
            SubscribedEvent.reader("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").limit(20).read();

        for (SubscribedEvent record : subscribedEvents) {
            System.out.println(record.getAccountSid());
        }
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	events "github.com/twilio/twilio-go/rest/events/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &events.ListSubscribedEventParams{}
	params.SetLimit(20)

	resp, err := client.EventsV1.ListSubscribedEvent("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].AccountSid != nil {
				fmt.Println(*resp[record].AccountSid)
			} else {
				fmt.Println(resp[record].AccountSid)
			}
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$subscribedEvents = $twilio->events->v1
    ->subscriptions("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->subscribedEvents->read(20);

foreach ($subscribedEvents as $record) {
    print $record->accountSid;
}
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

subscribed_events = @client
                    .events
                    .v1
                    .subscriptions('DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
                    .subscribed_events
                    .list(limit: 20)

subscribed_events.each do |record|
   puts record.account_sid
end
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:events:v1:subscriptions:subscribed-events:list \
   --subscription-sid DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
```

```bash
curl -X GET "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents?PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "types": [],
  "meta": {
    "page": 0,
    "page_size": 10,
    "first_page_url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents?PageSize=10&Page=0",
    "previous_page_url": null,
    "url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents?PageSize=10&Page=0",
    "next_page_url": null,
    "key": "types"
  }
}
```

## Update Event

`POST https://events.twilio.com/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents/{Type}`

Updates the event type

### Path parameters

```json
[{"name":"SubscriptionSid","in":"path","description":"The unique SID identifier of the Subscription.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^DF[0-9a-fA-F]{32}$"},"required":true},{"name":"Type","in":"path","description":"Type of event being subscribed to.","schema":{"type":"string"},"required":true}]
```

### Request body parameters

```json
{"schema":{"type":"object","title":"UpdateSubscribedEventRequest","properties":{"SchemaVersion":{"type":"integer","description":"The schema version that the Subscription should use."}}},"examples":{"update":{"value":{"lang":"json","value":"{\n  \"SchemaVersion\": 2\n}","meta":"","code":"{\n  \"SchemaVersion\": 2\n}","tokens":[["{","#C9D1D9"],"\n  ",["\"SchemaVersion\"","#7EE787"],[":","#C9D1D9"]," ",["2","#79C0FF"],"\n",["}","#C9D1D9"]],"annotations":[],"themeName":"github-dark","style":{"color":"#c9d1d9","background":"#0d1117"}}}},"encodingType":"application/x-www-form-urlencoded","conditionalParameterMap":{}}
```

Change schema version of subscribed event type

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function updateSubscribedEvent() {
  const subscribedEvent = await client.events.v1
    .subscriptions("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .subscribedEvents("com.twilio.messaging.message.delivered")
    .update({ schemaVersion: 1 });

  console.log(subscribedEvent.accountSid);
}

updateSubscribedEvent();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

subscribed_event = (
    client.events.v1.subscriptions("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .subscribed_events("com.twilio.messaging.message.delivered")
    .update(schema_version=1)
)

print(subscribed_event.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Events.V1.Subscription;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var subscribedEvent = await SubscribedEventResource.UpdateAsync(
            schemaVersion: 1,
            pathSubscriptionSid: "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
            pathType: "com.twilio.messaging.message.delivered");

        Console.WriteLine(subscribedEvent.AccountSid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.events.v1.subscription.SubscribedEvent;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        SubscribedEvent subscribedEvent =
            SubscribedEvent.updater("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "com.twilio.messaging.message.delivered")
                .setSchemaVersion(1)
                .update();

        System.out.println(subscribedEvent.getAccountSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	events "github.com/twilio/twilio-go/rest/events/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &events.UpdateSubscribedEventParams{}
	params.SetSchemaVersion(1)

	resp, err := client.EventsV1.UpdateSubscribedEvent("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"com.twilio.messaging.message.delivered",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.AccountSid != nil {
			fmt.Println(*resp.AccountSid)
		} else {
			fmt.Println(resp.AccountSid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$subscribed_event = $twilio->events->v1
    ->subscriptions("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->subscribedEvents("com.twilio.messaging.message.delivered")
    ->update(["schemaVersion" => 1]);

print $subscribed_event->accountSid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

subscribed_event = @client
                   .events
                   .v1
                   .subscriptions('DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
                   .subscribed_events('com.twilio.messaging.message.delivered')
                   .update(schema_version: 1)

puts subscribed_event.account_sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:events:v1:subscriptions:subscribed-events:update \
   --subscription-sid DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
   --type com.twilio.messaging.message.delivered \
   --schema-version 1
```

```bash
curl -X POST "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents/com.twilio.messaging.message.delivered" \
--data-urlencode "SchemaVersion=1" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "subscription_sid": "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "type": "com.twilio.messaging.message.delivered",
  "schema_version": 1,
  "url": "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents/com.twilio.messaging.message.delivered"
}
```

## Delete an Event

`DELETE https://events.twilio.com/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents/{Type}`

Deletes an event type on a subscription.

### Path parameters

```json
[{"name":"SubscriptionSid","in":"path","description":"The unique SID identifier of the Subscription.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^DF[0-9a-fA-F]{32}$"},"required":true},{"name":"Type","in":"path","description":"Type of event being subscribed to.","schema":{"type":"string"},"required":true}]
```

Remove an event type from a subscription

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function deleteSubscribedEvent() {
  await client.events.v1
    .subscriptions("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .subscribedEvents("com.twilio.messaging.message.delivered")
    .remove();
}

deleteSubscribedEvent();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

client.events.v1.subscriptions(
    "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
).subscribed_events("com.twilio.messaging.message.delivered").delete()
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Events.V1.Subscription;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        await SubscribedEventResource.DeleteAsync(
            pathSubscriptionSid: "DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
            pathType: "com.twilio.messaging.message.delivered");
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.events.v1.subscription.SubscribedEvent;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        SubscribedEvent.deleter("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "com.twilio.messaging.message.delivered")
            .delete();
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	err := client.EventsV1.DeleteSubscribedEvent("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"com.twilio.messaging.message.delivered")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$twilio->events->v1
    ->subscriptions("DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->subscribedEvents("com.twilio.messaging.message.delivered")
    ->delete();
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

@client
  .events
  .v1
  .subscriptions('DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
  .subscribed_events('com.twilio.messaging.message.delivered')
  .delete
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:events:v1:subscriptions:subscribed-events:remove \
   --subscription-sid DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
   --type com.twilio.messaging.message.delivered
```

```bash
curl -X DELETE "https://events.twilio.com/v1/Subscriptions/DFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SubscribedEvents/com.twilio.messaging.message.delivered" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```
