# Get a RUM session

Get one RUM session with its session replays and a timeline of its page views, clicks, errors and traces.

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

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

[[path_param]]
name = "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 = "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]

[responses]
[[response]]
status = 200
description = "Returns the RUM session."
body = '''
{
  "data": {
    "id": "c682c012-26e6-40ce-bb45-5e6e7f5a8c0f",
    "type": "rum_session",
    "attributes": {
      "application_id": "123456",
      "user_identifier": "user_123",
      "user_name": "jane@example.com",
      "group_id": "456",
      "group_name": "Acme Inc.",
      "country": "Czechia",
      "city": "Prague",
      "browser": "Chrome",
      "os": "macOS",
      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
      "first_url": "https://shop.example.com/",
      "last_url": "https://shop.example.com/checkout",
      "page_count": 4,
      "click_count": 12,
      "error_count": 1,
      "replay_count": 1,
      "first_seen_at": "2026-11-23T17:00:12.000Z",
      "last_seen_at": "2026-11-23T17:05:40.000Z",
      "duration_seconds": 328.0,
      "state": "unresolved",
      "url": "https://rum.betterstack.com/team/t12345/sessions/c682c012-26e6-40ce-bb45-5e6e7f5a8c0f?rf=1795483200000000&rt=1795483528000000&s=123456",
      "replays": [
        {
          "id": "9bfc56e1c78844d1891123bf9051be7b",
          "first_seen_at": "2026-11-23T17:00:14.000Z",
          "last_seen_at": "2026-11-23T17:05:38.000Z"
        }
      ],
      "timeline": [
        {
          "at": "2026-11-23T17:00:12.000Z",
          "type": "page_view",
          "name": "page-load",
          "url": "https://shop.example.com/"
        },
        {
          "at": "2026-11-23T17:00:20.000Z",
          "type": "click",
          "name": "click",
          "url": "https://shop.example.com/",
          "target": "button#buy"
        },
        {
          "at": "2026-11-23T17:00:21.000Z",
          "type": "error",
          "name": "TypeError",
          "message": "Cannot read properties of undefined",
          "error_id": "6f1c2b9a8e4d7f3012ab45cd"
        }
      ],
      "timeline_truncated": false
    }
  }
}
'''

[[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 `from` or `to` that isn't ISO 8601, or a `to` that isn't after `from` or is more than 90 days ago. `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."
  }
}
'''

[[response]]
status = 422
description = "Loading the session's timeline ran out of time. `errors` says why. Narrow `from` and `to` around the session."
body = '''
{
  "errors": "The query couldn't finish: Query failed: no answer within the 50 seconds the query had, so the request stopped waiting for it"
}
'''
[/responses]

[params]
title = "Response attributes"

[[param]]
name = "id"
type = "string"
description = "The ID of the RUM session, such as `c682c012-26e6-40ce-bb45-5e6e7f5a8c0f`."

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

[[param]]
name = "application_id"
type = "string"
description = "The application the session was recorded in."

[[param]]
name = "user_identifier"
type = "string or null"
description = "The identifier of the session's signed-in user, the same as the user's `id` in RUM users. `null` for an anonymous visitor."

[[param]]
name = "user_name"
type = "string or null"
description = "The signed-in user's `email`, or their `username` or IP address when there's no e-mail, as the Sessions page shows it. `null` when the application sent none of them."

[[param]]
name = "group_id"
type = "string or null"
description = "The ID of the user's group. `null` when the application sent none."

[[param]]
name = "group_name"
type = "string or null"
description = "The name of the user's group. `null` when the application sent none."

[[param]]
name = "country"
type = "string or null"
description = "The country the session came from. `null` when it isn't known."

[[param]]
name = "city"
type = "string or null"
description = "The city the session came from. `null` when it isn't known."

[[param]]
name = "browser"
type = "string or null"
description = "The browser. `null` when it isn't known."

[[param]]
name = "os"
type = "string or null"
description = "The operating system. `null` when it isn't known."

[[param]]
name = "user_agent"
type = "string or null"
description = "The browser's user agent, as the replay recorded it. `null` when it isn't known."

[[param]]
name = "first_url"
type = "string or null"
description = "The first page of the session. `null` when no page was recorded."

[[param]]
name = "last_url"
type = "string or null"
description = "The last page of the session. `null` when no page was recorded."

[[param]]
name = "page_count"
type = "integer"
description = "Number of distinct pages visited."

[[param]]
name = "click_count"
type = "integer"
description = "Number of clicks the session replay recorded."

[[param]]
name = "error_count"
type = "integer"
description = "Number of errors the session ran into."

[[param]]
name = "replay_count"
type = "integer"
description = "Number of session replays recorded in the session."

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

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

[[param]]
name = "duration_seconds"
type = "number or null"
description = "Seconds from the session's start to its last activity."

[[param]]
name = "state"
type = "string"
description = "Whether the session was resolved on the Sessions page.<br/>Valid values:<br/>`unresolved`: Nobody has resolved the session.<br/>`resolved`: Someone resolved the session on the Sessions page."

[[param]]
name = "url"
type = "string"
description = "Link to the session's page in the Better Stack web app, where its replay plays."

[[param]]
name = "replays"
type = "array of objects"
description = "The session's replays, oldest first. Returned by get only."

[[param]]
name = "replays[].id"
type = "string"
description = "The replay's ID."

[[param]]
name = "replays[].first_seen_at"
type = "datetime"
description = "When the replay's recording started. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "replays[].last_seen_at"
type = "datetime"
description = "When the replay last recorded activity. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "timeline"
type = "array of objects"
description = "What happened in the session, oldest first. Holds page views, clicks, other web events, errors and traces, at most 500 entries. Returned by get only."

[[param]]
name = "timeline[].at"
type = "datetime"
description = "When the entry happened. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "timeline[].type"
type = "string"
description = "One of `page_view`, `click`, `event`, `error` or `trace`. An `event` is any other web event, such as `session-start` or a custom event."

[[param]]
name = "timeline[].name"
type = "string"
description = "The web event's name, the error's type, or the name of the trace's first span."

[[param]]
name = "timeline[].url"
type = "string"
description = "The page the entry happened on."

[[param]]
name = "timeline[].target"
type = "string"
description = "For a click, the element clicked, such as `button#buy`."

[[param]]
name = "timeline[].error_id"
type = "string"
description = "For an error, the error's ID. Get the error's details with [Get an error](/docs/errors/api/errors/get/)."

[[param]]
name = "timeline[].message"
type = "string"
description = "For an error, its message."

[[param]]
name = "timeline[].trace_id"
type = "string"
description = "For a trace, its ID."

[[param]]
name = "timeline[].span_count"
type = "integer"
description = "For a trace, the number of its spans from this session."

[[param]]
name = "timeline[].duration_ms"
type = "number"
description = "For a trace, milliseconds from its first span's start to its last span's end."

[[param]]
name = "timeline_truncated"
type = "boolean"
description = "Whether the session holds more than the 500 timeline entries returned. Returned by get only."
[/params]

#### Example cURL

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