# Profiles Feed (alpha)

## Introduction

The profiles feed returns the list of user profiles associated with an authenticated account, formatted as an Applicaster feed. Apps use it to render a profile picker screen ("Who's watching?").

## Feed Response

The feed returns a top-level object with a `title` and an `entry` array. Each entry represents one user profile.

```json
{
  "title": "Who's watching?",
  "entry": [
    {
      "id": "abc123",
      "title": "John",
      "type": {
        "value": "profile"
      },
      "media_group": [
        {
          "type": "image",
          "media_item": [
            {
              "src": "https://example.com/avatars/avatar1.png",
              "key": "image_base"
            }
          ]
        }
      ],
      "extensions": {
        "tap_actions": {
          "actions": [
            {
              "type": "sessionStorageSet",
              "options": {
                "content": {
                  "user_account": {
                    "profile_selected": true,
                    "profile": "abc123"
                  },
                  "quick-brick-login-flow": {
                    "profile_id": "<profile-specific-token>"
                  }
                }
              }
            },
            {
              "type": "finishHook",
              "options": {
                "success": true
              }
            }
          ]
        },
        "master": 1,
        "token": "<profile-specific-token>",
        "email": "john@example.com"
      }
    },
    {
      "id": "def456",
      "title": "Sarah",
      "type": {
        "value": "profile"
      },
      "media_group": [
        {
          "type": "image",
          "media_item": [
            {
              "src": "https://example.com/avatars/avatar2.png",
              "key": "image_base"
            }
          ]
        }
      ],
      "extensions": {
        "tap_actions": {
          "actions": [
            {
              "type": "sessionStorageSet",
              "options": {
                "content": {
                  "user_account": {
                    "profile_selected": true,
                    "profile": "def456"
                  },
                  "quick-brick-login-flow": {
                    "profile_id": "<profile-specific-token>"
                  }
                }
              }
            },
            {
              "type": "finishHook",
              "options": {
                "success": true
              }
            }
          ]
        },
        "master": 0,
        "token": "<profile-specific-token>"
      }
    }
  ]
}
```

When a user selects a profile, the actions in `tap_actions.actions` fire in sequence. The example above shows the common pattern, but additional action types can be included — for example `sendCloudEvent` to notify a server of the profile selection.

For `sessionStorageSet`, the `content` object can carry any keys needed by your app under the relevant namespaces. The `quick-brick-login-flow` namespace supports additional keys beyond `profile_id`, such as:

- `profile_token` — the profile-scoped authentication token
- `kids` — a boolean indicating whether this is a kids profile
- Any other profile attributes your screens need at runtime

The final action is typically `finishHook` with `success: true`, which signals the hook to proceed and grants access to the screen.

## Profile Entry Fields

| Field | Type | Description |
|---|---|---|
| `id` | string | Unique profile identifier |
| `title` | string | Profile display name |
| `type.value` | string | `"profile"` |
| `media_group[0].media_item[0].src` | string | Avatar image URL |
| `extensions.tap_actions` | object | Actions fired when the user selects this profile |
| `extensions.master` | number | `1` if this is the primary (master) profile, `0` for all other profiles. Present on every entry. |
| `extensions.token` | string | Profile-scoped authentication token. Treat this as sensitive — store it only in session storage, not persistent storage. |
| `extensions.email` | string | Account email — only present on the master profile |

## Profile Avatars

The profile avatars feed returns the list of available avatar images that users can assign to a profile.

Use the entry `id` as the `profileImage` value when creating or updating a profile.

```json
{
  "id": "profile-avatars-<app-id>",
  "title": "Profile Avatars",
  "type": {
    "value": "profile-avatars"
  },
  "entry": [
    {
      "id": "avatar1",
      "title": "avatar1",
      "type": {
        "value": "avatar"
      },
      "media_group": [
        {
          "type": "image",
          "media_item": [
            {
              "src": "https://example.com/avatars/avatar1.png",
              "key": "image_base"
            }
          ]
        }
      ],
      "extensions": {}
    }
  ]
}
```

| Field | Type | Description |
|---|---|---|
| `id` | string | Avatar name — use this as the `profileImage` value when updating a profile |
| `title` | string | Avatar display name |
| `type.value` | string | `"avatar"` |
| `media_group[0].media_item[0].src` | string | Full avatar image URL |
