Create a new user role in your service

POST /v1/Services/{ChatServiceSid}/Roles

A Service Role resource represents a set of permissions granted to a user within a service or a conversation.

Create a new user role in your service

Path parameters

application/x-www-form-urlencoded

Body

  • FriendlyName string Required

    A descriptive string that you create to describe the new resource. It can be up to 64 characters long.

  • Permission array[string] Required

    A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's type.

  • Type string Required

    The type of role. Can be: conversation for Conversation roles or service for Conversation Service roles.

    Values are conversation or service.

Responses

  • 201

    Created

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

      The SID of the Account that created the resource

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

    • chat_service_sid string | null

      The SID of the Conversation Service that the resource is associated with

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

    • date_created string(date-time) | null

      The ISO 8601 date and time in GMT when the resource was created

    • date_updated string(date-time) | null

      The ISO 8601 date and time in GMT when the resource was last updated

    • friendly_name string | null

      The string that you assigned to describe the resource

    • permissions array[string] | null

      An array of the permissions the role has been granted

    • sid string | null

      The unique string that identifies the resource

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

    • type string | null

      The type of role

      Values are conversation or service.

    • url string(uri) | null

      An absolute URL for this user role.

POST /v1/Services/{ChatServiceSid}/Roles
curl \
 -X POST https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Roles \
 --user "username:password" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d 'FriendlyName=string&Permission=string&Type=conversation'
Request example
{
  "FriendlyName": "string",
  "Permission": [
    "string"
  ],
  "Type": "conversation"
}
Response examples (201)
{
  "account_sid": "string",
  "chat_service_sid": "string",
  "date_created": "2023-05-04T09:42:00+00:00",
  "date_updated": "2023-05-04T09:42:00+00:00",
  "friendly_name": "string",
  "permissions": [
    "string"
  ],
  "sid": "string",
  "type": "conversation",
  "url": "https://example.com"
}