# List RUM session segments

List the recorded segments of a RUM session's session replays in recording order, with their rrweb events, to export the recording. Needs a role with **View sessions and replays** under **Applications**. A session without a replay lists none.

[endpoint]
method = "GET"
base_url = "https://errors.betterstack.com"
path = "/api/v4/applications/{application_id}/sessions/{session_id}/segments"

[[path_param]]
name = "application_id"
required = true
type = "string"
description = "The RUM application the session was recorded in."

[[path_param]]
name = "session_id"
required = true
type = "string"
description = "The session's `id` from listing RUM sessions."

[[query_param]]
name = "from"
type = "datetime"
description = "Start of the time range to look for the session in, in ISO 8601. Defaults to 90 days before `to`. RUM data is kept for 90 days, so an earlier `from` counts from 90 days ago."

[[query_param]]
name = "to"
type = "datetime"
description = "End of the time range to look for the session in, in ISO 8601. Defaults to now. Must be after `from` and within the last 90 days."

[[query_param]]
name = "page"
type = "integer"
description = "Page to return, starting at 1."

[[query_param]]
name = "per_page"
default = "10"
type = "integer"
description = "Results per page. Maximum 50."

[[query_param]]
name = "team_id"
type = "string"
description = "Team to use, such as `t123`. Get the ID via [List teams](/docs/uptime/api/teams/list/). Required when you can access more than one team."

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"
[/endpoint]

[info]
#### Results are paginated
Use `pagination.next` and `pagination.prev` to move through pages or jump to a specific one using `page` and `per_page`. See [Pagination](/docs/getting-started/integrations/api/#pagination).
[/info]

[responses]
[[response]]
status = 200
description = "Returns the list of RUM session segments."
body = '''
{
  "data": [
    {
      "id": "9bfc56e1c78844d1891123bf9051be7b:0",
      "type": "rum_session_segment",
      "attributes": {
        "replay_id": "9bfc56e1c78844d1891123bf9051be7b",
        "segment_id": 0,
        "at": "2026-11-23T17:00:14.957Z",
        "events": [
          {
            "type": 4,
            "timestamp": 1795483214957,
            "data": {
              "href": "https://shop.example.com/",
              "width": 1280,
              "height": 800
            }
          }
        ]
      }
    }
  ],
  "pagination": {
    "first": "https://errors.betterstack.com/api/v4/applications/123456/sessions/c682c012-26e6-40ce-bb45-5e6e7f5a8c0f/segments?page=1",
    "last": "https://errors.betterstack.com/api/v4/applications/123456/sessions/c682c012-26e6-40ce-bb45-5e6e7f5a8c0f/segments?page=1",
    "prev": null,
    "next": null,
    "total_count": 1
  }
}
'''

[[response]]
status = 401
description = "The API token is missing or invalid."
body = '''
{
  "errors": "Invalid Team API token. How to find your Team API token: https://betterstack.com/docs/logs/api/getting-started/#obtaining-a-logtail-api-token"
}
'''

[[response]]
status = 403
description = "Your role doesn't allow viewing this, or the token can't be used for this API."

[[response]]
status = 404
description = "No application with that ID, or the session isn't in the time range."
body = '''
{
  "errors": "Resource with the provided ID was not found"
}
'''

[[response]]
status = 422
description = "A `page` that isn't a whole number, a `from` or `to` that isn't ISO 8601, a `to` that isn't after `from` or is more than 90 days ago, or a token that can access several teams with a `team_id` that doesn't name one of them. `invalid_values` names the attribute. An unknown query parameter is listed in `invalid_attributes`."
body = '''
{
  "errors": "Sorry, some values are incorrect",
  "invalid_values": {
    "to": "to must be after from."
  }
}
'''
[/responses]

[params]
title = "Response attributes"

[[param]]
name = "id"
type = "string"
description = "The ID of the RUM session segment, such as `9bfc56e1c78844d1891123bf9051be7b:0`."

[[param]]
name = "type"
type = "string"
description = "Always `rum_session_segment`."

[[param]]
name = "replay_id"
type = "string"
description = "The replay the segment belongs to."

[[param]]
name = "segment_id"
type = "integer"
description = "The segment's number in its replay, from 0."

[[param]]
name = "at"
type = "datetime or null"
description = "When the segment was recorded. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "events"
type = "array of objects"
description = "The segment's rrweb events, in the format the rrweb player reads."

[[param]]
name = "pagination.first"
type = "string"
description = "The URL of the first page of results."

[[param]]
name = "pagination.last"
type = "string"
description = "The URL of the last page of results."

[[param]]
name = "pagination.prev"
type = "string or null"
description = "The URL of the previous page, or `null` on the first page."

[[param]]
name = "pagination.next"
type = "string or null"
description = "The URL of the next page, or `null` on the last page."

[[param]]
name = "pagination.total_count"
type = "integer"
description = "How many results the whole list holds, across every page."
[/params]

#### Example cURL

```shell
[label List a session's segments]
curl --request GET \
  --url https://errors.betterstack.com/api/v4/applications/123456/sessions/c682c012-26e6-40ce-bb45-5e6e7f5a8c0f/segments \
  --header "Authorization: Bearer $TOKEN"
```
