Skip to content
Start here

Fetch all sessions of an App

client.RealtimeKit.Sessions.GetSessions(ctx, appID, params) (*SessionGetSessionsResponse, error)
GET/accounts/{account_id}/realtime/kit/{app_id}/sessions

Returns details of all sessions of an App.

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
params SessionGetSessionsParams
AccountID param.Field[string]

Path param: The account identifier tag.

maxLength32
AssociatedID param.Field[string]optional

Query param: ID of the meeting that sessions should be associated with

EndTime param.Field[Time]optional

Query param: The end time range for which you want to retrieve the meetings. The time must be specified in ISO format.

formatdate-time
PageNo param.Field[float64]optional

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

minimum0
Participants param.Field[string]optional

Query param

PerPage param.Field[float64]optional

Query param: Number of results per page

minimum0
SortBy param.Field[SessionGetSessionsParamsSortBy]optional

Query param

const SessionGetSessionsParamsSortByMinutesConsumed SessionGetSessionsParamsSortBy = "minutesConsumed"
const SessionGetSessionsParamsSortByCreatedAt SessionGetSessionsParamsSortBy = "createdAt"
SortOrder param.Field[SessionGetSessionsParamsSortOrder]optional

Query param

const SessionGetSessionsParamsSortOrderAsc SessionGetSessionsParamsSortOrder = "ASC"
const SessionGetSessionsParamsSortOrderDesc SessionGetSessionsParamsSortOrder = "DESC"
StartTime param.Field[Time]optional

Query param: The start time range for which you want to retrieve the meetings. The time must be specified in ISO format.

formatdate-time
Status param.Field[SessionGetSessionsParamsStatus]optional

Query param

const SessionGetSessionsParamsStatusLive SessionGetSessionsParamsStatus = "LIVE"
const SessionGetSessionsParamsStatusEnded SessionGetSessionsParamsStatus = "ENDED"
ReturnsExpand Collapse
type SessionGetSessionsResponse struct{…}
Data SessionGetSessionsResponseDataoptional
Sessions []SessionGetSessionsResponseDataSessionoptional
ID string

ID of the session

AssociatedID string

ID of the meeting this session is associated with. In the case of V2 meetings, it is always a UUID. In V1 meetings, it is a room name of the form abcdef-ghijkl

CreatedAt string

timestamp when session created

LiveParticipants float64

number of participants currently in the session

MaxConcurrentParticipants float64

number of maximum participants that were in the session

MeetingDisplayName string

Title of the meeting this session belongs to

MinutesConsumed float64

number of minutes consumed since the session started

OrganizationID string

App id that hosted this session

StartedAt string

timestamp when session started

Status SessionGetSessionsResponseDataSessionsStatus

current status of session

One of the following:
const SessionGetSessionsResponseDataSessionsStatusLive SessionGetSessionsResponseDataSessionsStatus = "LIVE"
const SessionGetSessionsResponseDataSessionsStatusEnded SessionGetSessionsResponseDataSessionsStatus = "ENDED"
Type SessionGetSessionsResponseDataSessionsType

type of session

One of the following:
const SessionGetSessionsResponseDataSessionsTypeMeeting SessionGetSessionsResponseDataSessionsType = "meeting"
const SessionGetSessionsResponseDataSessionsTypeLivestream SessionGetSessionsResponseDataSessionsType = "livestream"
const SessionGetSessionsResponseDataSessionsTypeParticipant SessionGetSessionsResponseDataSessionsType = "participant"
UpdatedAt string

timestamp when session was last updated

BreakoutRooms []unknownoptional
EndedAt stringoptional

timestamp when session ended

Meta unknownoptional

Any meta data about session.

Success booloptional

Fetch all sessions of an App

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.RealtimeKit.Sessions.GetSessions(
    context.TODO(),
    "app_id",
    realtime_kit.SessionGetSessionsParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Data)
}
{
  "data": {
    "sessions": [
      {
        "id": "id",
        "associated_id": "associated_id",
        "created_at": "created_at",
        "live_participants": 0,
        "max_concurrent_participants": 0,
        "meeting_display_name": "meeting_display_name",
        "minutes_consumed": 0,
        "organization_id": "organization_id",
        "started_at": "started_at",
        "status": "LIVE",
        "type": "meeting",
        "updated_at": "updated_at",
        "breakout_rooms": [
          {}
        ],
        "ended_at": "ended_at",
        "meta": {}
      }
    ]
  },
  "success": true
}
Returns Examples
{
  "data": {
    "sessions": [
      {
        "id": "id",
        "associated_id": "associated_id",
        "created_at": "created_at",
        "live_participants": 0,
        "max_concurrent_participants": 0,
        "meeting_display_name": "meeting_display_name",
        "minutes_consumed": 0,
        "organization_id": "organization_id",
        "started_at": "started_at",
        "status": "LIVE",
        "type": "meeting",
        "updated_at": "updated_at",
        "breakout_rooms": [
          {}
        ],
        "ended_at": "ended_at",
        "meta": {}
      }
    ]
  },
  "success": true
}