Twilio Users API

The Users API from Twilio — 4 operation(s) for users.

Documentation

Specifications

Other Resources

OpenAPI Specification

twilio-users-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Twilio - Accounts A2p Users API
  description: This is the public Twilio REST API.
  termsOfService: https://www.twilio.com/legal/tos
  contact:
    name: Twilio Support
    url: https://support.twilio.com
    email: support@twilio.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.52.0
servers:
- url: https://accounts.twilio.com
tags:
- name: Users
paths:
  /v1/Users:
    servers:
    - url: https://conversations.twilio.com
    description: A User resource represents a conversation user belonging to a default conversation service.
    x-twilio:
      defaultOutputProperties:
      - sid
      - identity
      pathType: list
      dependentProperties:
        user_conversations:
          mapping:
            user_sid: sid
          resource_url: /v1/Users/{user_sid}/Conversations
    post:
      description: Add a new conversation user to your account's default service
      tags:
      - Users
      parameters:
      - name: X-Twilio-Webhook-Enabled
        in: header
        description: The X-Twilio-Webhook-Enabled HTTP request header
        schema:
          type: string
          $ref: '#/components/schemas/user_enum_webhook_enabled_type'
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/conversations.v1.user'
          description: Created
      security:
      - accountSid_authToken: []
      operationId: CreateUser
      x-maturity:
      - GA
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CreateUserRequest'
    get:
      description: Retrieve a list of all conversation users in your account's default service
      tags:
      - Users
      parameters:
      - 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
          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
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListUserResponse'
          description: OK
      security:
      - accountSid_authToken: []
      operationId: ListUser
      x-maturity:
      - GA
  /v1/Users/{Sid}:
    servers:
    - url: https://conversations.twilio.com
    description: A User resource represents a conversation user belonging to a default conversation service.
    x-twilio:
      defaultOutputProperties:
      - sid
      - identity
      pathType: instance
      dependentProperties:
        user_conversations:
          mapping:
            user_sid: sid
          resource_url: /v1/Users/{user_sid}/Conversations
    post:
      description: Update an existing conversation user in your account's default service
      tags:
      - Users
      parameters:
      - name: Sid
        in: path
        description: The SID of the User resource to update. This value can be either the `sid` or the `identity` of the User resource to update.
        schema:
          type: string
        required: true
      - name: X-Twilio-Webhook-Enabled
        in: header
        description: The X-Twilio-Webhook-Enabled HTTP request header
        schema:
          type: string
          $ref: '#/components/schemas/user_enum_webhook_enabled_type'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/conversations.v1.user'
          description: OK
      security:
      - accountSid_authToken: []
      operationId: UpdateUser
      x-maturity:
      - GA
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/UpdateUserRequest'
    delete:
      description: Remove a conversation user from your account's default service
      tags:
      - Users
      parameters:
      - name: Sid
        in: path
        description: The SID of the User resource to delete. This value can be either the `sid` or the `identity` of the User resource to delete.
        schema:
          type: string
        required: true
      - name: X-Twilio-Webhook-Enabled
        in: header
        description: The X-Twilio-Webhook-Enabled HTTP request header
        schema:
          type: string
          $ref: '#/components/schemas/user_enum_webhook_enabled_type'
      responses:
        '204':
          description: The resource was deleted successfully.
      security:
      - accountSid_authToken: []
      operationId: DeleteUser
      x-maturity:
      - GA
    get:
      description: Fetch a conversation user from your account's default service
      tags:
      - Users
      parameters:
      - name: Sid
        in: path
        description: The SID of the User resource to fetch. This value can be either the `sid` or the `identity` of the User resource to fetch.
        schema:
          type: string
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/conversations.v1.user'
          description: OK
      security:
      - accountSid_authToken: []
      operationId: FetchUser
      x-maturity:
      - GA
  /v1/Users/{UserSid}/Conversations/{ConversationSid}:
    servers:
    - url: https://conversations.twilio.com
    description: A User Conversation resource represents a conversation of the user belonging to a default conversation service.
    x-twilio:
      defaultOutputProperties:
      - conversation_sid
      - user_sid
      - chat_service_sid
      - friendly_name
      - date_created
      pathType: instance
      parent: /Users/{Sid}
      mountName: user_conversations
    post:
      description: Update a specific User Conversation.
      tags:
      - Users
      parameters:
      - name: UserSid
        in: path
        description: The unique SID identifier of the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). This value can be either the `sid` or the `identity` of the User resource.
        schema:
          type: string
        required: true
      - name: ConversationSid
        in: path
        description: The unique SID identifier of the Conversation. This value can be either the `sid` or the `unique_name` of the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource).
        schema:
          type: string
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/conversations.v1.user.user_conversation'
          description: OK
      security:
      - accountSid_authToken: []
      operationId: UpdateUserConversation
      x-maturity:
      - GA
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/UpdateUserConversationRequest'
    delete:
      description: Delete a specific User Conversation.
      tags:
      - Users
      parameters:
      - name: UserSid
        in: path
        description: The unique SID identifier of the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). This value can be either the `sid` or the `identity` of the User resource.
        schema:
          type: string
        required: true
      - name: ConversationSid
        in: path
        description: The unique SID identifier of the Conversation. This value can be either the `sid` or the `unique_name` of the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource).
        schema:
          type: string
        required: true
      responses:
        '204':
          description: The resource was deleted successfully.
      security:
      - accountSid_authToken: []
      operationId: DeleteUserConversation
      x-maturity:
      - GA
    get:
      description: Fetch a specific User Conversation.
      tags:
      - Users
      parameters:
      - name: UserSid
        in: path
        description: The unique SID identifier of the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). This value can be either the `sid` or the `identity` of the User resource.
        schema:
          type: string
        required: true
      - name: ConversationSid
        in: path
        description: The unique SID identifier of the Conversation. This value can be either the `sid` or the `unique_name` of the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource).
        schema:
          type: string
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/conversations.v1.user.user_conversation'
          description: OK
      security:
      - accountSid_authToken: []
      operationId: FetchUserConversation
      x-maturity:
      - GA
  /v1/Users/{UserSid}/Conversations:
    servers:
    - url: https://conversations.twilio.com
    description: A User Conversation resource represents a conversation of the user belonging to a default conversation service.
    x-twilio:
      defaultOutputProperties:
      - conversation_sid
      - user_sid
      - chat_service_sid
      - friendly_name
      - date_created
      pathType: list
      parent: /Users/{Sid}
      mountName: user_conversations
    get:
      description: Retrieve a list of all User Conversations for the User.
      tags:
      - Users
      parameters:
      - name: UserSid
        in: path
        description: The unique SID identifier of the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). This value can be either the `sid` or the `identity` of the User resource.
        schema:
          type: string
        required: true
      - 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
          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
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListUserConversationResponse'
          description: OK
      security:
      - accountSid_authToken: []
      operationId: ListUserConversation
      x-maturity:
      - GA
components:
  schemas:
    UpdateUserConversationRequest:
      type: object
      properties:
        NotificationLevel:
          type: string
          $ref: '#/components/schemas/user_conversation_enum_notification_level'
          description: The Notification Level of this User Conversation. One of `default` or `muted`.
        LastReadTimestamp:
          type: string
          format: date-time
          description: The date of the last message read in conversation by the user, given in ISO 8601 format.
        LastReadMessageIndex:
          type: integer
          nullable: true
          description: The index of the last Message in the Conversation that the Participant has read.
    user_conversation_enum_notification_level:
      type: string
      enum:
      - default
      - muted
    CreateUserRequest:
      type: object
      required:
      - Identity
      properties:
        Identity:
          type: string
          description: The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive.
        FriendlyName:
          type: string
          description: The string that you assigned to describe the resource.
        Attributes:
          type: string
          description: The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned.
        RoleSid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^RL[0-9a-fA-F]{32}$
          description: The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user.
    user_enum_webhook_enabled_type:
      type: string
      enum:
      - 'true'
      - 'false'
    user_conversation_enum_state:
      type: string
      enum:
      - inactive
      - active
      - closed
    conversations.v1.user:
      type: object
      properties:
        sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^US[0-9a-fA-F]{32}$
          nullable: true
          description: The unique string that we created to identify the User resource.
        account_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^AC[0-9a-fA-F]{32}$
          nullable: true
          description: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource.
        chat_service_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^IS[0-9a-fA-F]{32}$
          nullable: true
          description: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the User resource is associated with.
        role_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^RL[0-9a-fA-F]{32}$
          nullable: true
          description: The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) assigned to the user.
        identity:
          type: string
          nullable: true
          description: The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive.
          x-twilio:
            pii:
              handling: standard
              deleteSla: 30
        friendly_name:
          type: string
          nullable: true
          description: The string that you assigned to describe the resource.
          x-twilio:
            pii:
              handling: standard
              deleteSla: 30
        attributes:
          type: string
          nullable: true
          description: The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned.
          x-twilio:
            pii:
              handling: sensitive
              deleteSla: 30
        is_online:
          type: boolean
          nullable: true
          description: Whether the User is actively connected to this Conversations Service and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for this Conversations Service, even if the Service's `reachability_enabled` is `true`.
        is_notifiable:
          type: boolean
          nullable: true
          description: Whether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`.
        date_created:
          type: string
          format: date-time
          nullable: true
          description: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        date_updated:
          type: string
          format: date-time
          nullable: true
          description: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        url:
          type: string
          format: uri
          nullable: true
          description: An absolute API resource URL for this user.
        links:
          type: object
          format: uri-map
          nullable: true
    ListUserConversationResponse:
      type: object
      properties:
        conversations:
          type: array
          items:
            $ref: '#/components/schemas/conversations.v1.user.user_conversation'
        meta:
          type: object
          properties:
            first_page_url:
              type: string
              format: uri
            next_page_url:
              type: string
              format: uri
              nullable: true
            page:
              type: integer
            page_size:
              type: integer
            previous_page_url:
              type: string
              format: uri
              nullable: true
            url:
              type: string
              format: uri
            key:
              type: string
    conversations.v1.user.user_conversation:
      type: object
      properties:
        account_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^AC[0-9a-fA-F]{32}$
          nullable: true
          description: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation.
        chat_service_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^IS[0-9a-fA-F]{32}$
          nullable: true
          description: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to.
        conversation_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^CH[0-9a-fA-F]{32}$
          nullable: true
          description: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this User Conversation.
        unread_messages_count:
          type: integer
          nullable: true
          description: The number of unread Messages in the Conversation for the Participant.
        last_read_message_index:
          type: integer
          nullable: true
          description: The index of the last Message in the Conversation that the Participant has read.
        participant_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^MB[0-9a-fA-F]{32}$
          nullable: true
          description: The unique ID of the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) the user conversation belongs to.
        user_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^US[0-9a-fA-F]{32}$
          nullable: true
          description: The unique string that identifies the [User resource](https://www.twilio.com/docs/conversations/api/user-resource).
        friendly_name:
          type: string
          nullable: true
          description: The human-readable name of this conversation, limited to 256 characters. Optional.
          x-twilio:
            pii:
              handling: standard
              deleteSla: 30
        conversation_state:
          type: string
          $ref: '#/components/schemas/user_conversation_enum_state'
          nullable: true
          description: The current state of this User Conversation. One of `inactive`, `active` or `closed`.
        timers:
          nullable: true
          description: Timer date values representing state update for this conversation.
        attributes:
          type: string
          nullable: true
          description: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified.  **Note** that if the attributes are not set "{}" will be returned.
          x-twilio:
            pii:
              handling: sensitive
              deleteSla: 30
        date_created:
          type: string
          format: date-time
          nullable: true
          description: The date that this conversation was created, given in ISO 8601 format.
        date_updated:
          type: string
          format: date-time
          nullable: true
          description: The date that this conversation was last updated, given in ISO 8601 format.
        created_by:
          type: string
          nullable: true
          description: Identity of the creator of this Conversation.
        notification_level:
          type: string
          $ref: '#/components/schemas/user_conversation_enum_notification_level'
          nullable: true
          description: The Notification Level of this User Conversation. One of `default` or `muted`.
        unique_name:
          type: string
          nullable: true
          description: An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource's `conversation_sid` in the URL.
          x-twilio:
            pii:
              handling: standard
              deleteSla: 30
        url:
          type: string
          format: uri
          nullable: true
        links:
          type: object
          format: uri-map
          nullable: true
          description: Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation.
    ListUserResponse:
      type: object
      properties:
        users:
          type: array
          items:
            $ref: '#/components/schemas/conversations.v1.user'
        meta:
          type: object
          properties:
            first_page_url:
              type: string
              format: uri
            next_page_url:
              type: string
              format: uri
              nullable: true
            page:
              type: integer
            page_size:
              type: integer
            previous_page_url:
              type: string
              format: uri
              nullable: true
            url:
              type: string
              format: uri
            key:
              type: string
    UpdateUserRequest:
      type: object
      properties:
        FriendlyName:
          type: string
          description: The string that you assigned to describe the resource.
        Attributes:
          type: string
          description: The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned.
        RoleSid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^RL[0-9a-fA-F]{32}$
          description: The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user.
  securitySchemes:
    accountSid_authToken:
      type: http
      scheme: basic
x-maturity:
- name: GA
  description: This product is Generally Available.
- name: Beta
  description: PLEASE NOTE that this is a Beta product that is subject to change. Use it with caution.