> ## 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.

# How Do I Show OnlyFans Media Without Broken Images?

> Stop broken OnlyFans images: OFAuth media URLs on media.ofauth.com expire, so re-read the parent resource or use Vault+ to keep vault media available.

OnlyFans images break in your app because media URLs expire. OFAuth returns media URLs proxied through `media.ofauth.com`. They are safe to embed, but they are not permanent. To show media reliably, either re-read the parent resource (the post, message, or vault item) to get a fresh URL, or turn on Vault+, which stores vault media so it stays available after a session expires.

Do not store a media URL in your database and render it days later. Store the id of the parent resource and fetch a fresh URL when you render.

## Frequently Asked Questions

**Why do OnlyFans media URLs from OFAuth stop working?** They expire. Media URLs in Access responses are proxied through `media.ofauth.com` and have a limited lifetime. Re-read the parent resource to get a fresh one.

**Can I embed `media.ofauth.com` URLs directly in an `<img>` or `<video>` tag?** Yes. They are proxied and safe to embed while they are valid.

**What is Vault+?** Vault+ is OFAuth's persistent media cache for OnlyFans vault media. On V3 it lives under `/v3/vault-plus/*` and uses the same bearer token and `x-linked-account-id` header as Access.

**Which scopes does Vault+ need?** `vault:read` for `GET` routes and `POST /v3/vault-plus/media/batch`. `vault:write` for adding, syncing, and deleting.

**Is Vault+ on in Sandbox?** Yes. Sandbox accounts always have Vault+ on, and their setting cannot be changed.

## How do I refresh an expired media URL?

Treat media URLs as short-lived output of a read, not as data. When an image fails to load, or before you render a stale record, call the same Access operation again and use the new URL.

```ts theme={null}
// Keep the parent resource id, not the URL.
async function renderProfile(userId: string, linkedAccountId: string) {
  const profile = await access(userId, linkedAccountId, "/profile") // fresh media URLs every time
  return profile
}
```

`access()` is the helper from [Calling Access](https://docs.ofauth.com/v3/api-reference.md): it sends `Authorization: Bearer` and `x-linked-account-id`. For formats and media fields, see [Media](https://docs.ofauth.com/guides/media.md).

## How do I turn Vault+ on?

Vault+ is on or off at two levels, and both must be on.

| Level | How | Error when off |
| - | - | - |
| Environment | Your organization's Vault+ setting for the environment, in the dashboard. | `403` `vault_plus_disabled` on every route. |
| Linked account | `PATCH /v3/linked-accounts/{id}/settings` with `{ "vault_plus": { "enabled": true } }`. Needs `vault:write` on that account. | `403` `linked_account_vault_plus_disabled` on `add` and `sync`. |

Test accounts need a paid Developer plan, or the `PATCH` returns `403` `subscription_required`.

```ts theme={null}
async function enableVaultPlus(accessToken: string, linkedAccountId: string) {
  const response = await fetch(
    `https://api.ofauth.com/v3/linked-accounts/${linkedAccountId}/settings`,
    {
      method: "PATCH",
      headers: {
        authorization: `Bearer ${accessToken}`,
        "content-type": "application/json"
      },
      body: JSON.stringify({ vault_plus: { enabled: true } })
    }
  )
  const body = await response.json()
  if (!response.ok) {
    // missing_scope, subscription_required, linked_account_settings_fixed (Sandbox),
    // or linked_account_settings_conflict (retry)
    throw new Error(`${body.error} (${body.recovery?.action})`)
  }
  return body // { linked_account_id, vault_plus: { enabled: true } }
}
```

## How do I cache a vault list?

Two routes fill the cache from a current OnlyFans vault list:

* `POST /v3/vault-plus/lists/{listId}/add` caches new media from the list. It never deletes.
* `PUT /v3/vault-plus/lists/{listId}/sync` makes the cache match the list. It removes media that left the list since the last sync baseline.

The first sync creates a baseline and removes nothing. Later syncs remove only media that was in the previous baseline and is missing now. Media still owned by another cached list for the same linked account is not purged.

```ts theme={null}
async function syncVaultList(accessToken: string, linkedAccountId: string, listId: string) {
  const response = await fetch(
    `https://api.ofauth.com/v3/vault-plus/lists/${listId}/sync`,
    {
      method: "PUT",
      headers: {
        authorization: `Bearer ${accessToken}`,
        "x-linked-account-id": linkedAccountId
      }
    }
  )
  const body = await response.json()
  if (!response.ok) throw new Error(`${body.error} (${body.recovery?.action})`)
  return body
  // { synced: true, listId: "123", seen: 42, addedItems: 2, updatedItems: 1,
  //   removedItems: 4, unchangedItems: 35, adoptedItems: 0 }
}
```

## How do I read cached media?

Vault+ routes take the raw OnlyFans media id, for example `4492994399`, not a variant id such as `4492994399_720`. A media object groups its cached variants by label, such as `full`, `thumb`, and `720`.

```ts theme={null}
const headers = {
  authorization: `Bearer ${accessToken}`,
  "x-linked-account-id": linkedAccountId,
  "content-type": "application/json"
}

// One item with all variants
const item = await fetch(
  "https://api.ofauth.com/v3/vault-plus/media/4492994399",
  { headers }
).then((r) => r.json())

// Several items; unknown ids are omitted
const items = await fetch("https://api.ofauth.com/v3/vault-plus/media/batch", {
  method: "POST",
  headers,
  body: JSON.stringify({ mediaIds: ["4492994399", "4492994400"] })
}).then((r) => r.json())

// Query stored videos
const videos = await fetch(
  "https://api.ofauth.com/v3/vault-plus/media?status=stored&type=video&limit=50",
  { headers }
).then((r) => r.json())
```

`GET /v3/vault-plus/media` also filters by `contentType`, duration, creation and cache dates, and supports `cursor` and `sort`. `GET /v3/vault-plus/status` reports cache status for the linked account.

## How do I delete cached media?

* `DELETE /v3/vault-plus/media/{mediaId}` deletes one cached item.
* `DELETE /v3/vault-plus/media` deletes all cached media for the linked account.

Both need `vault:write` and the `x-linked-account-id` header.

## Learn More

* [Vault+](https://docs.ofauth.com/v3/guides/media-storage.md)
* [Linked account settings](https://docs.ofauth.com/v3/api-reference/account/linked-accounts.md#linked-account-settings)
* [Calling Access](https://docs.ofauth.com/v3/api-reference.md)
* [Media](https://docs.ofauth.com/guides/media.md)
* [Errors](https://docs.ofauth.com/v3/api-reference/errors.md)
* [How Do I Test an OnlyFans Integration Without a Real Account?](https://docs.ofauth.com/v3/agents/playbooks/test-onlyfans-integration.md)
* [What Is OFAuth?](https://docs.ofauth.com/v3/agents/playbooks/what-is-ofauth.md)


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