Skip to content
Start here

Fetch participants list of a session

client.RealtimeKit.Sessions.GetSessionParticipants(ctx, appID, sessionID, params) (*SessionGetSessionParticipantsResponse, error)
GET/accounts/{account_id}/realtime/kit/{app_id}/sessions/{session_id}/participants

Returns a list of participants for the given session ID.

Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
Accepted Permissions (at least one required)
Realtime AdminRealtime
ParametersExpand Collapse
appID string

The app identifier tag.

maxLength32
sessionID string
formatuuid
params SessionGetSessionParticipantsParams
AccountID param.Field[string]

Path param: The account identifier tag.

maxLength32
IncludePeerEvents param.Field[bool]Optional

Query param: if true, response includes all the peer events of participants.

PageNo param.Field[float64]Optional

Query param: The page number from which you want your page search results to be displayed.

minimum0
PerPage param.Field[float64]Optional

Query param: Number of results per page

minimum0
SortBy param.Field[SessionGetSessionParticipantsParamsSortBy]Optional

Query param

const SessionGetSessionParticipantsParamsSortByJoinedAt SessionGetSessionParticipantsParamsSortBy = "joinedAt"
const SessionGetSessionParticipantsParamsSortByDuration SessionGetSessionParticipantsParamsSortBy = "duration"
SortOrder param.Field[SessionGetSessionParticipantsParamsSortOrder]Optional

Query param

const SessionGetSessionParticipantsParamsSortOrderAsc SessionGetSessionParticipantsParamsSortOrder = "ASC"
const SessionGetSessionParticipantsParamsSortOrderDesc SessionGetSessionParticipantsParamsSortOrder = "DESC"
View param.Field[SessionGetSessionParticipantsParamsView]Optional

Query param: In breakout room sessions, the view parameter can be set to raw for session specific duration for participants or consolidated to accumulate breakout room durations.

const SessionGetSessionParticipantsParamsViewRaw SessionGetSessionParticipantsParamsView = "raw"
const SessionGetSessionParticipantsParamsViewConsolidated SessionGetSessionParticipantsParamsView = "consolidated"
ReturnsExpand Collapse
type SessionGetSessionParticipantsResponse struct{…}
Data SessionGetSessionParticipantsResponseDataOptional
Participants []SessionGetSessionParticipantsResponseDataParticipantOptional
ID stringOptional

Participant ID. This maps to the corresponding peerId.

CreatedAt stringOptional

timestamp when this participant was created.

CustomParticipantID stringOptional

ID passed by client to create this participant.

DisplayName stringOptional

Display name of participant when joining the session.

Duration float64Optional

number of minutes for which the participant was in the session.

JoinedAt stringOptional

timestamp at which participant joined the session.

LeftAt stringOptional

timestamp at which participant left the session.

PeerEvents []SessionGetSessionParticipantsResponseDataParticipantsPeerEventOptional

Connection lifecycle events for the participant’s peer. Only included when include_peer_events is true.

ID stringOptional

ID of the peer event.

CreatedAt stringOptional

Timestamp when this peer event was created.

EventName SessionGetSessionParticipantsResponseDataParticipantsPeerEventsEventNameOptional

Name of the peer event.

One of the following:
const SessionGetSessionParticipantsResponseDataParticipantsPeerEventsEventNamePeerCreated SessionGetSessionParticipantsResponseDataParticipantsPeerEventsEventName = "PEER_CREATED"
const SessionGetSessionParticipantsResponseDataParticipantsPeerEventsEventNamePeerJoining SessionGetSessionParticipantsResponseDataParticipantsPeerEventsEventName = "PEER_JOINING"
const SessionGetSessionParticipantsResponseDataParticipantsPeerEventsEventNamePeerLeaving SessionGetSessionParticipantsResponseDataParticipantsPeerEventsEventName = "PEER_LEAVING"
MinutesConsumed float64Optional

Minutes consumed attributed to this event.

ParticipantID stringOptional

ID of the participant this event belongs to.

PeerID stringOptional

Peer ID this event belongs to.

PresetViewType SessionGetSessionParticipantsResponseDataParticipantsPeerEventsPresetViewTypeOptional

View type of the preset associated with the peer.

One of the following:
const SessionGetSessionParticipantsResponseDataParticipantsPeerEventsPresetViewTypeGroupCall SessionGetSessionParticipantsResponseDataParticipantsPeerEventsPresetViewType = "GROUP_CALL"
const SessionGetSessionParticipantsResponseDataParticipantsPeerEventsPresetViewTypeWebinar SessionGetSessionParticipantsResponseDataParticipantsPeerEventsPresetViewType = "WEBINAR"
const SessionGetSessionParticipantsResponseDataParticipantsPeerEventsPresetViewTypeAudioRoom SessionGetSessionParticipantsResponseDataParticipantsPeerEventsPresetViewType = "AUDIO_ROOM"
const SessionGetSessionParticipantsResponseDataParticipantsPeerEventsPresetViewTypeLivestream SessionGetSessionParticipantsResponseDataParticipantsPeerEventsPresetViewType = "LIVESTREAM"
const SessionGetSessionParticipantsResponseDataParticipantsPeerEventsPresetViewTypeChat SessionGetSessionParticipantsResponseDataParticipantsPeerEventsPresetViewType = "CHAT"
SessionID stringOptional

ID of the session this event belongs to.

SocketSessionID stringOptional

ID of the socket session associated with this event.

UpdatedAt stringOptional

Timestamp when this peer event was last updated.

PresetName stringOptional

Name of the preset associated with the participant.

UpdatedAt stringOptional

timestamp when this participant’s data was last updated.

UserID stringOptional

User id for this participant.

Success boolOptional

Fetch participants list of a session

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/cloudflare-go"
  "github.com/stainless-sdks/cloudflare-go/option"
  "github.com/stainless-sdks/cloudflare-go/realtime_kit"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.RealtimeKit.Sessions.GetSessionParticipants(
    context.TODO(),
    "app_id",
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    realtime_kit.SessionGetSessionParticipantsParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Data)
}
{
  "data": {
    "paging": {
      "end_offset": 2,
      "start_offset": 1,
      "total_count": 123
    },
    "participants": [
      {
        "created_at": "2023-02-01T10:51:08.039Z",
        "custom_participant_id": "83qi0i",
        "display_name": "Mark",
        "duration": 5.8097,
        "id": "005f4e0c-4d08-4d4e-a391-a76be75cd296",
        "joined_at": "2023-02-01T10:51:08.030Z",
        "left_at": "2023-02-01T10:56:56.612Z",
        "preset_name": "webinar_participant",
        "updated_at": "2023-02-01T10:56:56.618Z",
        "user_id": "0a08343d-a9dc-45f0-9feb-6a64afcc4f81"
      },
      {
        "created_at": "2023-02-01T10:50:36.853Z",
        "custom_participant_id": "3uggr",
        "display_name": "Henry",
        "duration": 6.9263,
        "id": "51fdf95f-d893-471a-922b-7db7adb14453",
        "joined_at": "2023-02-01T10:50:36.846Z\"",
        "left_at": "2023-02-01T10:57:32.424Z",
        "preset_name": "webinar_participant",
        "updated_at": "2023-02-01T10:57:32.431Z",
        "user_id": "85e7f0fd-7c16-45e9-9d68-f17ef007c4eb"
      }
    ]
  },
  "success": true
}
{
  "data": {
    "paging": {
      "end_offset": 2,
      "start_offset": 1,
      "total_count": 123
    },
    "participants": [
      {
        "created_at": "2023-02-01T10:51:08.039Z",
        "custom_participant_id": "83qi0i",
        "display_name": "Mark",
        "duration": 5.8097,
        "id": "005f4e0c-4d08-4d4e-a391-a76be75cd296",
        "joined_at": "2023-02-01T10:51:08.030Z",
        "left_at": "2023-02-01T10:56:56.612Z",
        "peer_events": [
          {
            "created_at": "2023-02-01T10:51:50.786Z",
            "event_name": "PEER_JOINING",
            "id": "94af3bac-f30b-40b9-ab45-4b9e6eff191a",
            "peer_id": "79d87ca5-7e47-452a-b3c1-b6842ad84bf5",
            "updated_at": "2023-02-01T10:51:50.792Z"
          },
          {
            "created_at": "2023-02-01T10:56:50.786Z",
            "event_name": "PEER_LEAVING",
            "id": "94af3bac-f30b-40b9-ab45-4b9e6eff191b",
            "peer_id": "79d87ca5-7e47-452a-b3c1-b6842ad84bf5",
            "updated_at": "2023-02-01T10:56:50.792Z"
          }
        ],
        "preset_name": "webinar_participant",
        "updated_at": "2023-02-01T10:56:56.618Z",
        "user_id": "0a08343d-a9dc-45f0-9feb-6a64afcc4f81"
      },
      {
        "created_at": "2023-02-01T10:50:36.853Z",
        "custom_participant_id": "3uggr",
        "display_name": "Henry",
        "duration": 6.9263,
        "id": "51fdf95f-d893-471a-922b-7db7adb14453",
        "joined_at": "2023-02-01T10:50:36.846Z\"",
        "left_at": "2023-02-01T10:57:32.424Z",
        "peer_events": [
          {
            "created_at": "2023-02-01T10:51:50.786Z",
            "event_name": "PEER_JOINING",
            "id": "94af3bac-f30b-40b9-ab45-4b9e6eff191a",
            "peer_id": "51fdf95f-d893-471a-922b-7db7adb14453",
            "updated_at": "2023-02-01T10:51:50.792Z"
          },
          {
            "created_at": "2023-02-01T10:56:50.786Z",
            "event_name": "PEER_LEAVING",
            "id": "94af3bac-f30b-40b9-ab45-4b9e6eff191b",
            "peer_id": "51fdf95f-d893-471a-922b-7db7adb14453",
            "updated_at": "2023-02-01T10:56:50.792Z"
          }
        ],
        "preset_name": "webinar_participant",
        "updated_at": "2023-02-01T10:57:32.431Z",
        "user_id": "85e7f0fd-7c16-45e9-9d68-f17ef007c4eb"
      }
    ]
  },
  "success": true
}
Returns Examples
{
  "data": {
    "paging": {
      "end_offset": 2,
      "start_offset": 1,
      "total_count": 123
    },
    "participants": [
      {
        "created_at": "2023-02-01T10:51:08.039Z",
        "custom_participant_id": "83qi0i",
        "display_name": "Mark",
        "duration": 5.8097,
        "id": "005f4e0c-4d08-4d4e-a391-a76be75cd296",
        "joined_at": "2023-02-01T10:51:08.030Z",
        "left_at": "2023-02-01T10:56:56.612Z",
        "preset_name": "webinar_participant",
        "updated_at": "2023-02-01T10:56:56.618Z",
        "user_id": "0a08343d-a9dc-45f0-9feb-6a64afcc4f81"
      },
      {
        "created_at": "2023-02-01T10:50:36.853Z",
        "custom_participant_id": "3uggr",
        "display_name": "Henry",
        "duration": 6.9263,
        "id": "51fdf95f-d893-471a-922b-7db7adb14453",
        "joined_at": "2023-02-01T10:50:36.846Z\"",
        "left_at": "2023-02-01T10:57:32.424Z",
        "preset_name": "webinar_participant",
        "updated_at": "2023-02-01T10:57:32.431Z",
        "user_id": "85e7f0fd-7c16-45e9-9d68-f17ef007c4eb"
      }
    ]
  },
  "success": true
}
{
  "data": {
    "paging": {
      "end_offset": 2,
      "start_offset": 1,
      "total_count": 123
    },
    "participants": [
      {
        "created_at": "2023-02-01T10:51:08.039Z",
        "custom_participant_id": "83qi0i",
        "display_name": "Mark",
        "duration": 5.8097,
        "id": "005f4e0c-4d08-4d4e-a391-a76be75cd296",
        "joined_at": "2023-02-01T10:51:08.030Z",
        "left_at": "2023-02-01T10:56:56.612Z",
        "peer_events": [
          {
            "created_at": "2023-02-01T10:51:50.786Z",
            "event_name": "PEER_JOINING",
            "id": "94af3bac-f30b-40b9-ab45-4b9e6eff191a",
            "peer_id": "79d87ca5-7e47-452a-b3c1-b6842ad84bf5",
            "updated_at": "2023-02-01T10:51:50.792Z"
          },
          {
            "created_at": "2023-02-01T10:56:50.786Z",
            "event_name": "PEER_LEAVING",
            "id": "94af3bac-f30b-40b9-ab45-4b9e6eff191b",
            "peer_id": "79d87ca5-7e47-452a-b3c1-b6842ad84bf5",
            "updated_at": "2023-02-01T10:56:50.792Z"
          }
        ],
        "preset_name": "webinar_participant",
        "updated_at": "2023-02-01T10:56:56.618Z",
        "user_id": "0a08343d-a9dc-45f0-9feb-6a64afcc4f81"
      },
      {
        "created_at": "2023-02-01T10:50:36.853Z",
        "custom_participant_id": "3uggr",
        "display_name": "Henry",
        "duration": 6.9263,
        "id": "51fdf95f-d893-471a-922b-7db7adb14453",
        "joined_at": "2023-02-01T10:50:36.846Z\"",
        "left_at": "2023-02-01T10:57:32.424Z",
        "peer_events": [
          {
            "created_at": "2023-02-01T10:51:50.786Z",
            "event_name": "PEER_JOINING",
            "id": "94af3bac-f30b-40b9-ab45-4b9e6eff191a",
            "peer_id": "51fdf95f-d893-471a-922b-7db7adb14453",
            "updated_at": "2023-02-01T10:51:50.792Z"
          },
          {
            "created_at": "2023-02-01T10:56:50.786Z",
            "event_name": "PEER_LEAVING",
            "id": "94af3bac-f30b-40b9-ab45-4b9e6eff191b",
            "peer_id": "51fdf95f-d893-471a-922b-7db7adb14453",
            "updated_at": "2023-02-01T10:56:50.792Z"
          }
        ],
        "preset_name": "webinar_participant",
        "updated_at": "2023-02-01T10:57:32.431Z",
        "user_id": "85e7f0fd-7c16-45e9-9d68-f17ef007c4eb"
      }
    ]
  },
  "success": true
}