```yaml
product: AlterLab
title: Sessions API Reference
category: api
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/docs/api/generated/sessions
```

# Sessions API Reference

Auto-generated API reference for sessions endpoints, built from the OpenAPI spec.

## GET /api/v1/sessions

List sessions
List session integrations for the authenticated user. Pass `include_shared=true` to include organization-shared sessions. Cookie values are never returned — only cookie names.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `include_shared` | query | `boolean` | no | Include organization-shared sessions from teams you belong to |

## POST /api/v1/sessions

Create a session
Create a new session integration with encrypted cookies. Stores browser cookies for a specific domain to enable authenticated scraping. Cookies are encrypted at rest with AES-256-GCM and never returned in plaintext. Rate limited to 10 creations per hour per user.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `name` | body | `string` | yes | User label for this session |
| `domain` | body | `string` | yes | Target domain (e.g. amazon.com) |
| `cookies` | body | `object` | no |  |
| `headers` | body | `object` | no |  |
| `encryption_mode` | body | `"server" \| "client"` | no | 'server' (default) or 'client' (zero-knowledge) |
| `encrypted_cookies` | body | `string` | no |  |
| `wrapped_key` | body | `string` | no |  |
| `cookie_names` | body | `string[]` | no |  |
| `key_version` | body | `integer` | no |  |
| `consent` | body | `boolean` | no | Explicit GDPR consent to process session cookie data. Must be true to create sessions. |
| `expires_at` | body | `string` | no |  |
| `notes` | body | `string` | no |  |
| `auto_refresh_enabled` | body | `boolean` | no | Enable proactive expiry detection and health checks |
| `notify_before_expiry` | body | `boolean` | no | Send notification when session is about to expire |
| `notify_on_failure` | body | `boolean` | no | Send notification when session validation fails |
| `organization_id` | body | `string` | no |  |
| `shared` | body | `boolean` | no | Share with organization members immediately |
| `domain_set` | body | `string[]` | no |  |
| `storage_state` | body | `object` | no |  |
| `scopes` | body | `string[]` | no |  |
| `identity_profile_id` | body | `string` | no |  |
| `connected_via` | body | `"extension" \| "remote_browser" \| "manual"` | no |  |
| `capture_context` | body | `object` | no |  |

## GET /api/v1/sessions/alerts/preferences

Get session alert preferences
Get the current session alert notification preferences for your account.

Authentication: `X-API-Key: <your key>`

## PUT /api/v1/sessions/alerts/preferences

Update session alert preferences
Update session alert notification preferences. Only provided fields are updated; omitted fields keep their current value. Changes take effect immediately.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `email_on_new_ip` | body | `boolean` | no |  |
| `email_on_unusual_volume` | body | `boolean` | no |  |
| `email_on_every_use` | body | `boolean` | no |  |
| `email_on_failure_streak` | body | `boolean` | no |  |
| `herald_alerts` | body | `boolean` | no |  |

## POST /api/v1/sessions/health-check

Trigger Session Health Check
Run a periodic health check on all active sessions. **Admin only.** Scans for sessions approaching expiry, marks expired sessions, and creates notifications. This endpoint is idempotent and safe to call frequently -- sessions are skipped if they were checked within the last 6 hours. Typically called by a cron job every 6 hours, but can be triggered manually by a platform admin.

Authentication: `X-API-Key: <your key>`

## POST /api/v1/sessions/kill-all

Emergency: deactivate all sessions
Emergency kill switch — immediately deactivate ALL sessions for your account. Sessions are NOT deleted and can be reactivated individually. Use when account compromise is suspected.

Authentication: `X-API-Key: <your key>`

## GET /api/v1/sessions/org

List organization sessions
List sessions split into personal and team views for a specific organization. Returns personal sessions (owned by you) and team sessions (shared by other members). Requires org membership.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `organization_id` | query | `string` | yes | Organization ID to list sessions for |

## POST /api/v1/sessions/privacy/consent

Record Consent
Record GDPR consent for session data processing. Consent is required before creating any session integrations. This endpoint records the consent timestamp and can be called once per user — subsequent calls update the timestamp.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `consent` | body | `boolean` | yes | Explicit consent to process session cookie data. Must be true to create sessions. |

## DELETE /api/v1/sessions/privacy/delete-all

Delete All Session Data
GDPR right-to-deletion: permanently purge ALL session data. This is a hard delete — removes sessions from the database, clears Redis caches, and redacts audit log entries. This action is irreversible. Unlike the standard DELETE endpoint (soft-delete), this permanently removes all traces of session cookie data.

Authentication: `X-API-Key: <your key>`

## GET /api/v1/sessions/privacy/export

Export Session Data
GDPR right-to-access: export all session data for the current user. Returns session metadata (names, domains, cookie names, usage stats). Cookie values are NEVER included in the export — only cookie names. Includes data processing transparency information.

Authentication: `X-API-Key: <your key>`

## GET /api/v1/sessions/privacy/retention

Get Retention Policy
Get the current data retention policy for session data. Returns the configured retention periods and data residency information.

Authentication: `X-API-Key: <your key>`

## DELETE /api/v1/sessions/privacy/{session_id}/hard-delete

Hard Delete Single Session
GDPR hard-delete a single session. Permanently purges the session from the database, Redis cache, and redacts all associated audit log entries. Irreversible. Only the session owner can hard-delete a session.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |

## GET /api/v1/sessions/profiles

List session profiles
List all available pre-built session profile templates. Profiles provide cookie requirements, capture instructions, and validation info for popular sites. No authentication required.

Authentication: `X-API-Key: <your key>`

## GET /api/v1/sessions/profiles/{slug}

Get a session profile
Get full profile details including capture instructions, required/optional cookies, recommended tier, and validation URL. Accepts either a profile slug (e.g. 'amazon') or a domain (e.g. 'amazon.com'). No authentication required.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `slug` | path | `string` | yes | Profile slug (e.g. 'amazon') or domain (e.g. 'amazon.com') |

## GET /api/v1/sessions/public-key

Get encryption public key
Get the server's RSA public key for zero-knowledge cookie encryption. Clients wrap ephemeral AES-256-GCM session keys with this key before sending encrypted cookies. The key is versioned for rotation.

Authentication: `X-API-Key: <your key>`

## POST /api/v1/sessions/vault/rewrap

Re-wrap the caller's data key under the current KEK
KEK rotation without downtime: the data key is unchanged, so sealed sessions stay valid.

Authentication: `X-API-Key: <your key>`

## DELETE /api/v1/sessions/{session_id}

Delete a session
Soft-delete a session integration. The session is marked as deleted but retained for audit purposes. Encrypted cookies remain but are no longer usable. Only the owner or org admin can delete.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |

## GET /api/v1/sessions/{session_id}

Get session details
Get a single session integration. Returns cookie names only — values are never exposed. Accessible if you own the session or if it is shared with your organization.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |

## PATCH /api/v1/sessions/{session_id}

Update a session
Update name, cookies, headers, expiry, or notes. If cookies are provided, old cookies are replaced entirely (not merged). New cookies are encrypted with domain binding. Only the owner or org admin can update.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |
| `name` | body | `string` | no |  |
| `cookies` | body | `object` | no |  |
| `headers` | body | `object` | no |  |
| `expires_at` | body | `string` | no |  |
| `notes` | body | `string` | no |  |
| `auto_refresh_enabled` | body | `boolean` | no |  |
| `notify_before_expiry` | body | `boolean` | no |  |
| `notify_on_failure` | body | `boolean` | no |  |
| `domain_set` | body | `string[]` | no |  |
| `storage_state` | body | `object` | no |  |
| `scopes` | body | `string[]` | no |  |
| `identity_profile_id` | body | `string` | no |  |
| `connected_via` | body | `"extension" \| "remote_browser" \| "manual"` | no |  |
| `capture_context` | body | `object` | no |  |

## GET /api/v1/sessions/{session_id}/access-log

Get session access log
Get timestamped entries showing when and from where the session was accessed (last 7 days). Raw IPs are only shown within 1 hour of access; after that, only the hashed representation is shown.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |
| `limit` | query | `integer` | no | Max entries to return |

## PUT /api/v1/sessions/{session_id}/access-mode

Set session access mode
standing: scheduled runs decrypt via KMS. per_use: each run needs the extension's key share.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |
| `access_mode` | body | `"standing" \| "per_use"` | yes | Access Mode |
| `unlock_share` | body | `string` | no |  |

## GET /api/v1/sessions/{session_id}/audit

Get session audit log
Get the audit trail for a session: creation, updates, sharing, validation, and deletion events. Only the owner or org admin can view.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |
| `limit` | query | `integer` | no | Maximum entries to return |
| `offset` | query | `integer` | no | Offset for pagination |

## PATCH /api/v1/sessions/{session_id}/auto-refresh

Update auto-refresh settings
Update auto-refresh and notification preferences for a session. Controls whether the session participates in periodic health checks and whether you receive expiry notifications.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |
| `auto_refresh_enabled` | body | `boolean` | no |  |
| `notify_before_expiry` | body | `boolean` | no |  |
| `notify_on_failure` | body | `boolean` | no |  |

## POST /api/v1/sessions/{session_id}/deactivate

Deactivate a session
Deactivate a single session (non-destructive). Immediately stops the session from being used in scrapes. Can be reactivated later via POST /{session_id}/reactivate.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |

## GET /api/v1/sessions/{session_id}/decrypt-audit

List session decrypt audit
Every worker decrypt of this session (granted and denied), newest first.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |
| `limit` | query | `integer` | no |  |
| `offset` | query | `integer` | no |  |

## POST /api/v1/sessions/{session_id}/reactivate

Reactivate a session
Restore a previously deactivated session to active status and remove the invalidation flag from Redis.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |

## POST /api/v1/sessions/{session_id}/refresh

Refresh session cookies
Re-upload cookies for a session (rotation shortcut). Replaces all stored cookies and resets validation status. Use after re-authenticating in your browser.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |
| `cookies` | body | `object` | no |  |
| `headers` | body | `object` | no |  |
| `encryption_mode` | body | `"server" \| "client"` | no | 'server' (default) or 'client' (zero-knowledge) |
| `encrypted_cookies` | body | `string` | no |  |
| `wrapped_key` | body | `string` | no |  |
| `cookie_names` | body | `string[]` | no |  |
| `key_version` | body | `integer` | no |  |

## PUT /api/v1/sessions/{session_id}/sealed

Push a client-sealed refresh
AlterLab Connect refresh: replace a client-encrypted session's sealed cookies. The server validates structure only and never sees plaintext.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |
| `encrypted_cookies` | body | `string` | yes | base64(iv).base64(ciphertext) |
| `wrapped_key` | body | `string` | yes | RSA-OAEP wrapped AES-256 key (base64) |
| `cookie_names` | body | `string[]` | yes | Plaintext cookie names for UI display |
| `key_version` | body | `integer` | no |  |

## GET /api/v1/sessions/{session_id}/security

Get session security summary
Security overview for the session detail panel: known source counts, recent access summary, and alert preferences.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |

## PATCH /api/v1/sessions/{session_id}/share

Share session with organization
Make a session visible to all members of its organization. Only the session owner or an org admin can share.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |
| `organization_id` | body | `string` | no |  |

## PATCH /api/v1/sessions/{session_id}/unshare

Unshare session from organization
Revoke sharing of a session. The session remains assigned to the organization but is no longer visible to other members.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |

## POST /api/v1/sessions/{session_id}/validate

Validate a session
Check whether stored session cookies are still valid using domain-specific heuristics. Returns a confidence score (0-100), detected username, and cookie expiry warnings. After 3 consecutive failures the session is auto-marked as expired. Rate limited to 30 validations per hour.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `session_id` | path | `string` | yes | Session integration ID |
