Proxy Public Beta is currently closed for new customers. Please consider using Twilio Conversations and Programmable Voice directly if you are building your masking application.
Note that this does not have any impact on Twilio Flex customers.
Twilio's Proxy API is currently available as a Public Beta product. Some features are not yet implemented and others may be changed before the product is declared as Generally Available.
Public Beta products are not covered by a Twilio SLA.
A Session is a single instance of two individuals communicating. It belongs to a Service and maps two Participants for a Proxy application. Sessions allow you to:
The unique string that we created to identify the Session resource.
^KC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Service the session is associated with.
^KS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Account that created the Session resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The ISO 8601 date when the Session last had an interaction.
The ISO 8601 date when the Session should expire. If this is value is present, it overrides the ttl
value.
An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. Supports UTF-8 characters. This value should not have PII.
The status of the Session. Can be: open
, in-progress
, closed
, failed
, or unknown
.
open
in-progress
closed
failed
unknown
The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction.
0
The Mode of the Session. Can be: message-only
, voice-only
, or voice-and-message
.
message-only
voice-only
voice-and-message
The ISO 8601 date and time in GMT when the resource was created.
The ISO 8601 date and time in GMT when the resource was last updated.
The URLs of resources related to the Session.
POST https://proxy.twilio.com/v1/Services/{ServiceSid}/Sessions
Create a new Session.
application/x-www-form-urlencoded
An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. This value should not have PII.
The ISO 8601 date when the Session should expire. If this is value is present, it overrides the ttl
value.
The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction.
The Mode of the Session. Can be: message-only
, voice-only
, or voice-and-message
and the default value is voice-and-message
.
message-only
voice-only
voice-and-message
The initial status of the Session. Can be: open
, in-progress
, closed
, failed
, or unknown
. The default is open
on create.
open
in-progress
closed
failed
unknown
The Participant objects to include in the new session.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createSession() {11const session = await client.proxy.v112.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.sessions.create();1415console.log(session.sid);16}1718createSession();
1{2"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"status": "open",4"unique_name": "Order #1234",5"date_started": "2015-07-30T20:00:00Z",6"date_ended": "2015-07-30T20:00:00Z",7"date_last_interaction": "2015-07-30T20:00:00Z",8"date_expiry": "2015-07-30T20:00:00Z",9"ttl": 3600,10"mode": "voice-and-message",11"closed_reason": "",12"sid": "KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"date_updated": "2015-07-30T20:00:00Z",14"date_created": "2015-07-30T20:00:00Z",15"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"links": {18"interactions": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions",19"participants": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants"20}21}
GET https://proxy.twilio.com/v1/Services/{ServiceSid}/Sessions/{Sid}
Retrieve a single Session.
The SID of the parent Service of the resource to fetch.
^KS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The Twilio-provided string that uniquely identifies the Session resource to fetch.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchSession() {11const session = await client.proxy.v112.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.sessions("Sid")14.fetch();1516console.log(session.sid);17}1819fetchSession();
1{2"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"status": "open",4"unique_name": "Order #1234",5"date_started": "2015-07-30T20:00:00Z",6"date_ended": "2015-07-30T20:00:00Z",7"date_last_interaction": "2015-07-30T20:00:00Z",8"date_expiry": "2015-07-30T20:00:00Z",9"ttl": 3600,10"mode": "voice-and-message",11"closed_reason": "",12"sid": "Sid",13"date_updated": "2015-07-30T20:00:00Z",14"date_created": "2015-07-30T20:00:00Z",15"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"links": {18"interactions": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions",19"participants": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants"20}21}
GET https://proxy.twilio.com/v1/Services/{ServiceSid}/Sessions
Retrieve a list of all Sessions for a given Service.
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listSession() {11const sessions = await client.proxy.v112.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.sessions.list({ limit: 20 });1415sessions.forEach((s) => console.log(s.sid));16}1718listSession();
1{2"sessions": [],3"meta": {4"previous_page_url": null,5"next_page_url": null,6"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions?PageSize=50&Page=0",7"page": 0,8"first_page_url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions?PageSize=50&Page=0",9"page_size": 50,10"key": "sessions"11}12}
POST https://proxy.twilio.com/v1/Services/{ServiceSid}/Sessions/{Sid}
Post updates to a given Session.
The SID of the parent Service of the resource to update.
^KS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The Twilio-provided string that uniquely identifies the Session resource to update.
^KC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
application/x-www-form-urlencoded
The ISO 8601 date when the Session should expire. If this is value is present, it overrides the ttl
value.
The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction.
The new status of the resource. Can be: in-progress
to re-open a session or closed
to close a session.
open
in-progress
closed
failed
unknown
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateSession() {11const session = await client.proxy.v112.services("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")13.sessions("KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")14.update({15dateExpiry: new Date("2018-07-31 00:00:00"),16status: "in-progress",17});1819console.log(session.sid);20}2122updateSession();
1{2"service_sid": "KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"status": "in-progress",4"unique_name": "Order #1234",5"date_started": "2015-07-30T20:00:00Z",6"date_ended": "2015-07-30T20:00:00Z",7"date_last_interaction": "2015-07-30T20:00:00Z",8"date_expiry": "2018-07-31",9"ttl": 3600,10"mode": "voice-and-message",11"closed_reason": "",12"sid": "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",13"date_updated": "2015-07-30T20:00:00Z",14"date_created": "2015-07-30T20:00:00Z",15"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"links": {18"interactions": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Interactions",19"participants": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sessions/KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants"20}21}
DELETE https://proxy.twilio.com/v1/Services/{ServiceSid}/Sessions/{Sid}
Deleting a Session removes it permanently. Related Participants and Interactions will also be deleted.
Any Message or Call logs created during interactions for this Session will be deleted automatically after 90 days of the Session being closed, as per our Session retention policy. If you want to delete these resources before then, you must issue DELETE
requests for the inbound and outbound resources of all child Interactions directly. Once you have deleted a Session, those resource SIDs will not be discoverable via Proxy.
The SID of the parent Service of the resource to delete.
^KS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The Twilio-provided string that uniquely identifies the Session resource to delete.
^KC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function deleteSession() {11await client.proxy.v112.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.sessions("KCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.remove();15}1617deleteSession();