Stream Resource
A Stream is a pub-sub primitive that lets you broadcast JSON messages at a high rate to an elastic group of subscribers.
Messages are ephemeral - they can be published (created), but they cannot be queried, updated or deleted
The maximum Message payload size as serialized JSON is 4KB.
The maximum Message publishing rate per Stream is 30 per second.
Message delivery to remote endpoints is not guaranteed.
Messages may be received by remote endpoints in a different order than they were published.
See also Stream Message for information about the messages in a stream.
Property name Type PII Description
The unique string that we created to identify the Sync Stream resource.
Pattern: ^TO[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
An application-defined string that uniquely identifies the resource. It can be used in place of the resource's sid
in the URL to address the resource.
The SID of the Account that created the Sync Stream resource.
Pattern: ^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Sync Service the resource is associated with.
Pattern: ^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The absolute URL of the Message Stream resource.
The URLs of the Stream's nested resources.
date_expires string<date-time> The date and time in GMT when the Message Stream expires and will be deleted, specified in ISO 8601(link takes you to an external page) format. If the Message Stream does not expire, this value is null
. The Stream might not be deleted immediately after it expires.
date_created string<date-time> date_updated string<date-time> The identity of the Stream's creator. If the Stream is created from the client SDK, the value matches the Access Token's identity
field. If the Stream was created from the REST API, the value is 'system'.
POST https://sync.twilio.com/v1/Services/{ServiceSid}/Streams
Property name Type Required PII Description
Property name Type Required PII Description
An application-defined string that uniquely identifies the resource. This value must be unique within its Service and it can be up to 320 characters long. The unique_name
value can be used as an alternative to the sid
in the URL path to address the resource.
How long, in seconds , before the Stream expires and is deleted (time-to-live).
_18 // Download the helper library from https://www.twilio.com/docs/node/install
_18 const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18 // Find your Account SID and Auth Token at twilio.com/console
_18 // and set the environment variables. See http://twil.io/secure
_18 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18 const authToken = process.env.TWILIO_AUTH_TOKEN;
_18 const client = twilio(accountSid, authToken);
_18 async function createSyncStream() {
_18 const syncStream = await client.sync.v1
_18 .services("ServiceSid")
_18 .syncStreams.create();
_18 console.log(syncStream.sid);
_14 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14 "created_by": "created_by",
_14 "date_expires": "2015-07-30T21:00:00Z",
_14 "date_created": "2015-07-30T20:00:00Z",
_14 "date_updated": "2015-07-30T20:00:00Z",
_14 "messages": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages"
_14 "service_sid": "ServiceSid",
_14 "sid": "TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14 "unique_name": "unique_name",
_14 "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
GET https://sync.twilio.com/v1/Services/{ServiceSid}/Streams/{Sid}
Property name Type Required PII Description
The SID of the Sync Service with the Sync Stream resource to fetch.
The SID of the Stream resource to fetch.
_19 // Download the helper library from https://www.twilio.com/docs/node/install
_19 const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19 // Find your Account SID and Auth Token at twilio.com/console
_19 // and set the environment variables. See http://twil.io/secure
_19 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19 const authToken = process.env.TWILIO_AUTH_TOKEN;
_19 const client = twilio(accountSid, authToken);
_19 async function fetchSyncStream() {
_19 const syncStream = await client.sync.v1
_19 .services("ServiceSid")
_19 console.log(syncStream.sid);
_14 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14 "created_by": "created_by",
_14 "date_expires": "2015-07-30T21:00:00Z",
_14 "date_created": "2015-07-30T20:00:00Z",
_14 "date_updated": "2015-07-30T20:00:00Z",
_14 "messages": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages"
_14 "service_sid": "ServiceSid",
_14 "unique_name": "unique_name",
_14 "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
GET https://sync.twilio.com/v1/Services/{ServiceSid}/Streams
Note: Without a PageSize
query parameter, this will return only the first 50 Message Streams. Add a PageSize
query parameter to fetch up to 100 items at once. The example has a PageSize
value of 20.
See paging for more information.
Property name Type Required PII Description
The SID of the Sync Service with the Stream resources to read.
Property name Type Required PII Description
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Minimum: 1
Maximum: 1000
The page index. This value is simply for client state.
Minimum: 0
The page token. This is provided by the API.
_18 // Download the helper library from https://www.twilio.com/docs/node/install
_18 const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18 // Find your Account SID and Auth Token at twilio.com/console
_18 // and set the environment variables. See http://twil.io/secure
_18 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18 const authToken = process.env.TWILIO_AUTH_TOKEN;
_18 const client = twilio(accountSid, authToken);
_18 async function listSyncStream() {
_18 const syncStreams = await client.sync.v1
_18 .services("ServiceSid")
_18 .syncStreams.list({ limit: 20 });
_18 syncStreams.forEach((s) => console.log(s.sid));
_12 "first_page_url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams?PageSize=50&Page=0",
_12 "next_page_url": null,
_12 "previous_page_url": null,
_12 "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams?PageSize=50&Page=0"
POST https://sync.twilio.com/v1/Services/{ServiceSid}/Streams/{Sid}
Property name Type Required PII Description
The SID of the Sync Service with the Sync Stream resource to update.
The SID of the Stream resource to update.
Property name Type Required PII Description
How long, in seconds , before the Stream expires and is deleted (time-to-live).
_19 // Download the helper library from https://www.twilio.com/docs/node/install
_19 const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19 // Find your Account SID and Auth Token at twilio.com/console
_19 // and set the environment variables. See http://twil.io/secure
_19 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19 const authToken = process.env.TWILIO_AUTH_TOKEN;
_19 const client = twilio(accountSid, authToken);
_19 async function updateSyncStream() {
_19 const syncStream = await client.sync.v1
_19 .services("ServiceSid")
_19 .update({ ttl: 227 });
_19 console.log(syncStream.sid);
_14 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14 "created_by": "created_by",
_14 "date_expires": "2015-07-30T21:00:00Z",
_14 "date_created": "2015-07-30T20:00:00Z",
_14 "date_updated": "2015-07-30T20:00:00Z",
_14 "messages": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages"
_14 "service_sid": "ServiceSid",
_14 "unique_name": "unique_name",
_14 "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
DELETE https://sync.twilio.com/v1/Services/{ServiceSid}/Streams/{Sid}
Property name Type Required PII Description
The SID of the Sync Service with the Sync Stream resource to delete.
The SID of the Stream resource to delete.
_14 // Download the helper library from https://www.twilio.com/docs/node/install
_14 const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_14 // Find your Account SID and Auth Token at twilio.com/console
_14 // and set the environment variables. See http://twil.io/secure
_14 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14 const authToken = process.env.TWILIO_AUTH_TOKEN;
_14 const client = twilio(accountSid, authToken);
_14 async function deleteSyncStream() {
_14 await client.sync.v1.services("ServiceSid").syncStreams("Sid").remove();