> ## Documentation Index
> Fetch the complete documentation index at: https://docs.videodb.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Security & Privacy

> VideoDB handles sensitive media data. Understand storage modes, data retention, and privacy patterns to build compliant systems.

## When to Reference This

Use this page when you're:

* Designing systems with privacy requirements
* Choosing storage and retention policies
* Implementing consent workflows
* Securing API access patterns

## Quick Example

```python theme={null}
import videodb

# Secure connection
conn = videodb.connect()  # Uses VIDEO_DB_API_KEY env var

# Desktop capture with client tokens (never expose API key)
cap = conn.create_capture_session(
    end_user_id="user_abc",
    callback_url="https://your-backend.com/webhooks"
)
token = conn.generate_client_token(expires_in=600)  # Short-lived
```

## Next Steps

<CardGroup cols={2}>
  <Card icon="camera" title="Capture Session" href="/pages/core-concepts/data-model#capturesession">
    Secure desktop capture patterns
  </Card>

  <Card icon="code" title="API Reference" href="/api-reference/authentication/index">
    API key management
  </Card>
</CardGroup>

***

## Storage Modes

### Persistent Storage (Default)

Media and derived data are stored for retrieval and search:

```python theme={null}
video = coll.upload(url="https://...")  # Stored
understanding = video.understand(
    analyzers=[{"type": "vlm", "name": "scene"}]
)
understanding.wait_until_complete()
scene = understanding.get_analyzer("scene")
index = video.index(name="scene", source=scene)  # Retrieval-ready
index.wait_until_complete()
```

**Use for:**

* Video archives and libraries
* Searchable knowledge bases
* Long-term agent memory

### Data Minimization

Choose capture channels deliberately and retain only the media your workflow needs. The released RTStream V2 indexing flow requires `store=True` when a continuous VLM output will be indexed.

```python theme={null}
# Indexing a continuous live output requires stored records.
understanding = rtstream.understand(
    segmentation={"type": "time", "window": "5s"},
    analyzers=[
        {
            "type": "vlm",
            "name": "scene",
            "sampling": {"frame_count": 1},
            "config": {"prompt": "Monitor for activity"},
        }
    ],
    store=True,
)
index = rtstream.index(
    name="live_scene",
    source=understanding.outputs["scene"],
    use_for=["semantic"],
)
```

**Use for:**

* Live monitoring dashboards with deliberate channel selection
* Privacy-sensitive contexts that minimize captured inputs
* Workflows with documented retention controls

***

## Retention Patterns

### Define Your Retention Policy

* Document what is captured, why it is retained, and who can access it
* Use the capture SDK's per-channel `store` control to minimize collection
* Confirm product- and account-specific retention controls before making guarantees to users

### Manual Deletion

```python theme={null}
# Delete video and all associated data
video.delete()

# Delete specific index
index.delete()

# Delete collection
coll.delete()
```

### Recommended Patterns

| Use Case | Pattern |
| :- | :- |
| Temporary analysis | Select only necessary capture channels and define retention |
| GDPR compliance | Implement deletion on user request |
| Meeting recordings | Define retention policy, batch delete |
| Security footage | Time-based archival and deletion |

***

## API Key Security

### Key Management

```python theme={null}
# Environment variable (recommended)
conn = videodb.connect()  # Uses VIDEO_DB_API_KEY

# Explicit key (server-side only)
conn = videodb.connect(api_key="your-key")
```

**Best practices:**

* Never embed keys in client applications
* Use environment variables
* Rotate keys periodically
* Use separate keys for dev/prod

Manage API keys through the VideoDB platform controls. The released Python and Node SDKs do not expose API-key creation, listing, or deletion methods; see the [Authentication API reference](/api-reference/authentication/index) for the supported platform workflow.

***

## Client Token Pattern

For desktop and mobile clients, use short-lived tokens instead of API keys:

```python theme={null}
# Backend (holds API key)
token = conn.generate_client_token(expires_in=600)  # 10 minutes

# Client (uses token, never sees API key)
client = CaptureClient(client_token=token)
```

**Why this matters:**

* Tokens expire automatically
* Tokens have limited scope
* Compromised tokens have limited blast radius
* API key never leaves your backend

***

## Consent Patterns

### User Consent for Capture

Before capturing screen, mic, or camera:

```python theme={null}
# Request explicit permission
await client.request_permission("microphone")
await client.request_permission("screen_capture")

# User must grant permission in OS dialog
channels = await client.list_channels()
```

### Data Subject Access

Map consent and capture records to your own user identity, then implement authenticated access and deletion-request workflows in your application. Python can list capture sessions by collection and status, but it has no `end_user_id` filter and `CaptureSession.delete()` is not available. Keep the user-to-resource mapping and deletion orchestration in your application until a supported lifecycle API is available.

***

## Network Security

### HTTPS

All API communication uses HTTPS. No configuration needed.

### Webhook Security

Verify webhook payloads to prevent spoofing:

```python theme={null}
@app.post("/webhooks/videodb")
async def handle_webhook(request):
    # Verify signature (implementation depends on your setup)
    signature = request.headers.get("X-VideoDB-Signature")
    if not verify_signature(request.body, signature):
        return {"error": "Invalid signature"}, 401

    event = await request.json()
    process_event(event)
    return {"status": "ok"}
```

***

## Compliance Considerations

### GDPR

* Implement data access endpoints
* Implement deletion endpoints
* Document data processing purposes
* Minimize stored channels when storage is not needed

### HIPAA

* Minimize captured and stored data for sensitive content
* Implement strict access controls
* Audit all data access
* Consider on-premise deployment for PHI

### SOC 2

* VideoDB maintains SOC 2 compliance
* Implement access logging
* Use separate keys per environment
* Regular key rotation

***

## Best Practices Summary

1. **Never expose API keys** - Use client tokens for untrusted clients

2. **Minimize collection** - Only persist data when needed

3. **Implement deletion** - Honor data deletion requests

4. **Short token lifetimes** - 10-15 minutes for desktop capture

5. **Audit access** - Log who accesses what data

6. **Encrypt at rest** - VideoDB encrypts stored data

7. **Get consent** - Always get user permission before capture


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.