# Per-User Data

> Enable personalized template storage for your users within embed instances

- **URL**: https://orshot.com/docs/orshot-embed/per-user-data

---

Give each of your users their own private workspace within your embedded Orshot instance. Users get their own templates, images, videos, fonts, and saved colors — fully isolated from other users.

## Benefits

- **Full Data Isolation**: Each user gets their own templates, images, videos, fonts, and colors
- **User A cannot see or modify User B's data**
- **Seamless Integration**: Pass user info via URL parameters — no additional auth required
- **Automatic Management**: Users are created automatically on first visit
- **Plan-Based Limits**: Control how many users can store data based on your subscription

## How It Works

1. Enable **Per-User Data & Templates** in your embed settings
2. Pass a unique `userId` parameter when loading the embed
3. Users see two sections: "My Templates" (personal) and "Workspace Templates" (shared)
4. All data created by users (templates, uploaded images, videos, fonts, saved colors) is automatically linked to their account

## Query Parameters

| Parameter   | Required | Description                                    |
| ----------- | -------- | ---------------------------------------------- |
| `userId`    | Yes      | Unique identifier for the user (from your app) |
| `userName`  | No       | Display name for the user                      |
| `userEmail` | No       | Email address for the user                     |
| `metadata`  | No       | JSON string with custom user data              |

## Basic Usage

Add the `userId` parameter to your embed URL:```html
<iframe
  src="https://orshot.com/embeds/YOUR_EMBED_ID?userId=user_123"
  title="Orshot Embed"
  width="100%"
  height="700"
  style="border: none;"
  allow="clipboard-write"
></iframe>
```## With User Details

Include optional user information:```html
<iframe
  src="https://orshot.com/embeds/YOUR_EMBED_ID?userId=user_123&userName=John%20Doe&userEmail=john@example.com"
  title="Orshot Embed"
  width="100%"
  height="700"
  style="border: none;"
  allow="clipboard-write"
></iframe>
```## With Custom Metadata

Pass additional data as a JSON string:```javascript
const metadata = JSON.stringify({
  plan: "pro",
  company: "Acme Inc",
  role: "designer",
});

const embedUrl = `https://orshot.com/embeds/YOUR_EMBED_ID?userId=user_123&metadata=${encodeURIComponent(
  metadata,
)}`;
```## Dynamic User Loading (React Example)```jsx
function DesignEditor({ user }) {
  const params = new URLSearchParams({
    userId: user.id,
    userName: user.name,
    userEmail: user.email,
  });

  return (
    <iframe
      src={`https://orshot.com/embeds/YOUR_EMBED_ID?${params}`}
      title="Orshot Embed"
      width="100%"
      height="700"
      style={{ border: "none" }}
      allow="clipboard-write"
    />
  );
}
```## Important Notes

- The `userId` must be unique per user in your system
- User IDs are securely hashed—the original ID is never exposed in the database
- Without a `userId` parameter, templates save to the workspace (shared)
- Users are automatically created on first embed load with a valid `userId`

## User Limits

For plans that support multi-tenancy or per-user data, each plan has a maximum number of embed users. When the limit is reached:

- **New users** will see a "User Limit Reached" message and the embed will not load for them
- **Existing users** (already created before the limit was hit) will continue to work normally
- Upgrade your plan to increase the allowed number of embed users

## Fetching User Templates via API

You can retrieve templates for a specific embed user using the Studio Templates API. Pass both `embedId` and `embedUserId` parameters to filter templates.

### Get User's Templates```js
await fetch(
  "https://api.orshot.com/v1/studio/templates/all?embedId=YOUR_EMBED_ID&embedUserId=user_123",
  {
    method: "GET",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Bearer <ORSHOT_API_KEY>",
    },
  },
);
```### Query Parameters

| Parameter     | Type   | Required | Description                                 |
| ------------- | ------ | -------- | ------------------------------------------- |
| `embedId`     | String | Yes\*    | Your embed instance ID                      |
| `embedUserId` | String | Yes\*    | The user ID (same as `userId` in embed URL) |

\*Both parameters are required together for user-specific filtering.

### Response

Returns only templates belonging to that specific user:```json
{
  "data": [
    {
      "id": 456,
      "name": "User's Custom Template",
      "embed_user_id": "eui_a1B2c3D4e5F6g7H8",
      "thumbnail_url": "https://storage.orshot.com/thumbnails/template-456.png",
      ...
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 3,
    "totalPages": 1
  }
}
```