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

# Media Storage

> How to use Media Proxy, automatic caching, and Vault+ for OnlyFans media

API responses include `media.ofauth.com` URLs for all media. These URLs automatically route to either edge cache or persistent storage (Vault+), and can trigger auto-caching based on your configuration.

|                  | Media Proxy        | Vault+                               |
| ---------------- | ------------------ | ------------------------------------ |
| **What it does** | Edge-cached URLs   | Persistent storage with access by ID |
| **Setup**        | Automatic          | Enable per connection                |
| **Best for**     | Displaying content | Media libraries, PPV features        |

***

## Displaying Media

Use `media.ofauth.com` URLs directly in your app:

```html theme={null}
<img src="https://media.ofauth.com/abc123..." />
<video src="https://media.ofauth.com/xyz789..." controls />
```

When requested:

1. If stored in Vault+ → serves from persistent storage
2. Otherwise → fetches from OnlyFans, caches at edge

***

## Setting Up Vault+

### Enable for a Connection

```bash theme={null}
curl -X PATCH 'https://api.ofauth.com/v2/account/connections/:connectionId/settings' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{ "vaultPlus": { "enabled": true } }'
```

### Configure Auto-Caching (Organization Defaults)

```bash theme={null}
curl -X PATCH 'https://api.ofauth.com/v2/account/settings' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "vaultPlus": {
      "autoEnableForNewConnections": true,
      "defaultSettings": {
        "autoCacheVault": true,
        "autoCacheMessages": false,
        "autoCachePosts": false
      }
    }
  }'
```

When `autoCacheVault` (or similar) is enabled, media is automatically queued for persistent storage when accessed via `media.ofauth.com`.

Vault+ API routes require an API key with the `ACCOUNT` scope. List and media operations also require `x-connection-id`.

Vault+ public routes use raw OnlyFans media IDs. If the same media has multiple stored versions, such as full-size and thumbnail variants, fetch the raw media ID and read the variants under the `media` object. Variant objects are keyed by label and do not include internal variant IDs.

***

## Triggering Caching

### Via Media Proxy URL

POST to any `media.ofauth.com` URL to immediately queue for persistent storage:

```bash theme={null}
curl -X POST 'https://media.ofauth.com/abc123...'
```

### Add New Media From a Vault List

Use `add` when you want to cache new media from a list without deleting anything that is already cached.

```bash theme={null}
curl -X POST 'https://api.ofauth.com/v2/vault-plus/lists/:listId/add' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'x-connection-id: conn_xxx'
```

Response:

```json theme={null}
{
  "queued": true,
  "listId": "123",
  "seen": 42,
  "queuedItems": 3,
  "skippedExisting": 39
}
```

### Sync a Vault List

Use `sync` when the cached list should match the current OnlyFans list.

The first sync creates a baseline and removes nothing. Later syncs remove only media that was present in the previous sync baseline and is now missing from the list. If another cached list still owns the same media ID, Vault+ skips the purge. `adoptedItems` counts media that was already cached and is now being added to this list's sync baseline for the first time.

```bash theme={null}
curl -X PUT 'https://api.ofauth.com/v2/vault-plus/lists/:listId/sync' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'x-connection-id: conn_xxx'
```

Response:

```json theme={null}
{
  "synced": true,
  "listId": "123",
  "seen": 42,
  "addedItems": 2,
  "updatedItems": 1,
  "removedItems": 4,
  "unchangedItems": 35,
  "adoptedItems": 0
}
```

***

## Accessing Stored Media

### List Cached Vault Lists

```bash theme={null}
curl -X GET 'https://api.ofauth.com/v2/vault-plus/lists' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'x-connection-id: conn_xxx'
```

Response:

```json theme={null}
{
  "items": [
    {
      "listId": "123",
      "mediaCount": 42,
      "lastAddedAt": "2026-06-06T20:00:00.000Z",
      "lastSyncedAt": "2026-06-06T21:00:00.000Z",
      "lastSeenAt": "2026-06-06T21:00:00.000Z"
    }
  ]
}
```

### Get Media in a Cached Vault List

```bash theme={null}
curl -X GET 'https://api.ofauth.com/v2/vault-plus/lists/:listId/media' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'x-connection-id: conn_xxx'
```

### Get by Media ID

Use the raw OnlyFans media ID. The response groups any stored variants by label.

```bash theme={null}
curl -X GET 'https://api.ofauth.com/v2/vault-plus/media/:mediaId' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'x-connection-id: conn_xxx'
```

Response:

```json theme={null}
{
  "id": "12345",
  "type": "image",
  "duration": null,
  "media": {
    "full": {
      "status": "stored",
      "quality": "full",
      "sizeBytes": 1024000,
      "contentType": "image/jpeg",
      "accessCount": 12,
      "createdAt": 1715800000,
      "expiresAt": 1715886400,
      "storedAt": 1715800100,
      "lastAccessedAt": 1715800500,
      "url": "https://..."
    },
    "thumb": {
      "status": "stored",
      "quality": "thumb",
      "sizeBytes": 32000,
      "contentType": "image/jpeg",
      "accessCount": 8,
      "createdAt": 1715800000,
      "expiresAt": 1715886400,
      "storedAt": 1715800100,
      "lastAccessedAt": 1715800500,
      "url": "https://..."
    }
  }
}
```

### Batch Get URLs (up to 100)

```bash theme={null}
curl -X POST 'https://api.ofauth.com/v2/vault-plus/media/batch' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'x-connection-id: conn_xxx' \
  -H 'Content-Type: application/json' \
  -d '{ "mediaIds": ["12345", "12346", "12347"] }'
```

### List Stored Media

```bash theme={null}
curl -X GET 'https://api.ofauth.com/v2/vault-plus/media?status=stored' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'x-connection-id: conn_xxx'
```

Supported filters include `status`, `type`, `contentType`, `durationMin`, `durationMax`, `createdAtFrom`, `createdAtTo`, `cachedAtFrom`, `cachedAtTo`, `limit`, `cursor`, and `sort`.

### Connection Status

```bash theme={null}
curl -X GET 'https://api.ofauth.com/v2/vault-plus/status' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'x-connection-id: conn_xxx'
```

### Organization Stats

```bash theme={null}
curl -X GET 'https://api.ofauth.com/v2/vault-plus/stats' \
  -H 'apikey: YOUR_API_KEY'
```

***

## Purging Stored Media

### Via Media Proxy URL

```bash theme={null}
curl -X DELETE 'https://media.ofauth.com/abc123...'
```

### Via API

```bash theme={null}
curl -X DELETE 'https://api.ofauth.com/v2/vault-plus/media/:mediaId' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'x-connection-id: conn_xxx'
```

### Purge All for a Connection

```bash theme={null}
curl -X DELETE 'https://api.ofauth.com/v2/vault-plus/media' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'x-connection-id: conn_xxx'
```

***

## Related

<CardGroup cols={2}>
  <Card title="Media & Vault" icon="photo-film" href="/guides/media">
    Full media operations guide
  </Card>

  <Card title="Access API" icon="key" href="/api-reference/access/overview">
    Complete API reference
  </Card>
</CardGroup>
