---
title: Session Recordings
description: Capture HAR files, screenshots, and video recordings of browser sessions.
section: Guides
---

# Session Recordings

Capture detailed recordings of your browser sessions for debugging, compliance, and monitoring.

## Recording Types

| Type | Format | Size | Use Case |
|------|--------|------|----------|
| HAR | `.har` (JSON) | ~1MB/min | Network debugging, performance analysis |
| Screenshots | `.png` | ~200KB each | Visual validation, diff testing |
| Video | `.webm` | ~5MB/min | Full replay, bug reproduction |

## Enable Recording

```typescript
const session = await sk.sessions.create({
  stealth: 'max',
  recording: {
    har: true,
    screenshots: true,
    video: true,
  },
})
```

## Retrieve Recordings

After destroying a session, recordings are available for 24 hours:

```typescript
// Destroy session and get recording URLs
const result = await sk.sessions.destroy(session.id)

console.log(result.recordings)
// {
//   har: 'https://recordings.sessionkit.dev/sess_abc/network.har',
//   screenshots: ['https://.../.../0001.png', '...'],
//   video: 'https://recordings.sessionkit.dev/sess_abc/recording.webm',
// }
```

## Screenshot Triggers

Configure when screenshots are automatically captured:

```typescript
const session = await sk.sessions.create({
  recording: {
    screenshots: true,
    screenshotTriggers: [
      'navigation',    // On every page navigation
      'network-idle',  // When network becomes idle
      'interval:5s',   // Every 5 seconds
    ],
  },
})
```

## Manual Screenshots

Take screenshots on demand via the API:

```typescript
const screenshot = await sk.pages.screenshot(session.id, {
  fullPage: true,
  format: 'png',
  quality: 90,
})

// Returns a base64-encoded image or URL
console.log(screenshot.url)
```

## HAR Analysis

HAR files capture all network requests and responses:

```typescript
const har = await sk.sessions.getHar(session.id)

// Analyze requests
for (const entry of har.log.entries) {
  console.log(`${entry.request.method} ${entry.request.url} → ${entry.response.status}`)
}
```

## Storage & Retention

| Plan | Retention | Storage per Session |
|------|-----------|-------------------|
| Free | 1 hour | 50 MB |
| Pro | 24 hours | 500 MB |
| Scale | 7 days | 2 GB |
| Enterprise | 30 days | Unlimited |
