Create a new Session
TODO: Resource-level docs
Create a new Session
Path parameters
-
The SID of the parent Service resource.
Body
-
DateExpiry string(date-time)
The ISO 8601 date when the Session should expire. If this is value is present, it overrides the
ttl
value. -
FailOnParticipantConflict boolean
[Experimental] For accounts with the ProxyAllowParticipantConflict account flag, setting to true enables per-request opt-in to allowing Proxy to reject a Session create (with Participants) request that could cause the same Identifier/ProxyIdentifier pair to be active in multiple Sessions. Depending on the context, this could be a 409 error (Twilio error code 80623) or a 400 error (Twilio error code 80604). If not provided, requests will be allowed to succeed and a Debugger notification (80802) will be emitted. Having multiple, active Participants with the same Identifier/ProxyIdentifier pair causes calls and messages from affected Participants to be routed incorrectly. Please note, the default behavior for accounts without the ProxyAllowParticipantConflict flag is to reject the request as described. This will eventually be the default for all accounts.
-
Mode string
The Mode of the Session. Can be:
message-only
,voice-only
, orvoice-and-message
and the default value isvoice-and-message
.Values are
message-only
,voice-only
, orvoice-and-message
. -
Participants array
The Participant objects to include in the new session.
-
Status string
The initial status of the Session. Can be:
open
,in-progress
,closed
,failed
, orunknown
. The default isopen
on create.Values are
open
,in-progress
,closed
,failed
, orunknown
. -
Ttl integer
The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction.
-
UniqueName string
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.
curl \
-X POST https://proxy.twilio.com/v1/Services/{ServiceSid}/Sessions \
--user "username:password" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d 'DateExpiry=2023-05-04T09%3A42%3A00%2B00%3A00&FailOnParticipantConflict=true&Mode=message-only&&Status=open&Ttl=42&UniqueName=string'
{
"DateExpiry": "2023-05-04T09:42:00+00:00",
"FailOnParticipantConflict": true,
"Mode": "message-only",
"Participants": [],
"Status": "open",
"Ttl": 42,
"UniqueName": "string"
}
{
"DateExpiry": "2024-05-04T09:42:00+00:00",
"FailOnParticipantConflict": true,
"Mode": "message-only",
"Participants": [],
"Status": "open",
"Ttl": 42,
"UniqueName": "string"
}
{
"account_sid": "string",
"closed_reason": "string",
"date_created": "2023-05-04T09:42:00+00:00",
"date_ended": "2023-05-04T09:42:00+00:00",
"date_expiry": "2023-05-04T09:42:00+00:00",
"date_last_interaction": "2023-05-04T09:42:00+00:00",
"date_started": "2023-05-04T09:42:00+00:00",
"date_updated": "2023-05-04T09:42:00+00:00",
"links": {},
"mode": "message-only",
"service_sid": "string",
"sid": "string",
"status": "open",
"ttl": 42,
"unique_name": "string",
"url": "https://example.com"
}
{
"account_sid": "string",
"closed_reason": "string",
"date_created": "2024-05-04T09:42:00+00:00",
"date_ended": "2024-05-04T09:42:00+00:00",
"date_expiry": "2024-05-04T09:42:00+00:00",
"date_last_interaction": "2024-05-04T09:42:00+00:00",
"date_started": "2024-05-04T09:42:00+00:00",
"date_updated": "2024-05-04T09:42:00+00:00",
"links": {},
"mode": "message-only",
"service_sid": "string",
"sid": "string",
"status": "open",
"ttl": 42,
"unique_name": "string",
"url": "https://example.com"
}