## Documentation Index

Fetch the complete documentation index at: [/llms.txt](https://docs.neynar.com/llms.txt)

Use this file to discover all available pages before exploring further.

When your app is opened it can access information about the session from `sdk.context`. This object provides basic information about the user, the client, and where your app was opened from:

```typescript
export type MiniAppPlatformType = 'web' | 'mobile';

export type MiniAppContext = {
  user: {
    fid: number;
    username?: string;
    displayName?: string;
    pfpUrl?: string;
  };
  location?: MiniAppLocationContext;
  client: {
    platformType?: MiniAppPlatformType;
    clientFid: number;
    added: boolean;
    safeAreaInsets?: SafeAreaInsets;
    notificationDetails?: MiniAppNotificationDetails;
  };
  features?: {
    haptics: boolean;
    cameraAndMicrophoneAccess?: boolean;
  };
};
```

## Properties

### `location`

Contains information about the context from which the Mini App was launched.

```typescript
export type MiniAppUser = {
  fid: number;
  username?: string;
  displayName?: string;
  pfpUrl?: string;
};

export type MiniAppCast = {
  author: MiniAppUser;
  hash: string;
  parentHash?: string;
  parentFid?: number;
  timestamp?: number;
  mentions?: MiniAppUser[];
  text: string;
  embeds?: string[];
  channelKey?: string;
};

export type CastEmbedLocationContext = {
  type: 'cast_embed';
  embed: string;
  cast: MiniAppCast;
};

export type CastShareLocationContext = {
  type: 'cast_share';
  cast: MiniAppCast;
};

export type NotificationLocationContext = {
  type: 'notification';
  notification: {
    notificationId: string;
    title: string;
    body: string;
  };
};

export type LauncherLocationContext = {
  type: 'launcher';
};

export type ChannelLocationContext = {
  type: 'channel';
  channel: {
    key: string;
    name: string;
    imageUrl?: string;
  };
};

export type OpenMiniAppLocationContext = {
  type: 'open_miniapp';
  referrerDomain: string;
};

export type LocationContext =
  | CastEmbedLocationContext
  | CastShareLocationContext
  | NotificationLocationContext
  | LauncherLocationContext
  | ChannelLocationContext
  | OpenMiniAppLocationContext;
```

#### Cast Embed

Indicates that the Mini App was launched from a cast (where it is an embed).

```json
> sdk.context.location
{
  "type": "cast_embed",
  "embed": "https://myapp.example.com",
  "cast": {
    "author": {
      "fid": 3621,
      "username": "alice",
      "displayName": "Alice",
      "pfpUrl": "https://example.com/alice.jpg"
    },
    "hash": "0xa2fbef8c8e4d00d8f84ff45f9763b8bae2c5c544",
    "timestamp": 1749160866000,
    "mentions": [],
    "text": "Check out this awesome mini app!",
    "embeds": ["https://myapp.example.com"],
    "channelKey": "farcaster"
  }
}
```

#### Cast Share

Indicates that the Mini App was launched when a user shared a cast to your app.

```json
> sdk.context.location
{
  "type": "cast_share",
  "cast": {
    "author": {
      "fid": 12152,
      "username": "pirosb3",
      "displayName": "Daniel - Bountycaster",
      "pfpUrl": "https://imagedelivery.net/..."
    },
    "hash": "0x1177603a7464a372fc358a7eabdeb70880d81612",
    "timestamp": 1749160866000,
    "mentions": [],
    "text": "Sharing this interesting cast with you!",
    "embeds": ["https://frames-v2.vercel.app/"],
    "channelKey": "staging"
  }
}
```

#### Notification

Indicates that the Mini App was launched from a notification triggered by the frame.

```json
> sdk.context.location
{
  "type": "notification",
  "notification": {
    "notificationId": "f7e9ebaf-92f0-43b9-a410-ad8c24f3333b",
    "title": "Yoinked!",
    "body": "horsefacts captured the flag from you."
  }
}
```

#### Launcher

Indicates that the Mini App was launched directly by the client app outside of a context.

```json
> sdk.context.location
{
  "type": "launcher"
}
```

#### Open Mini App

Indicates that the Mini App was launched from another Mini App using the `openMiniApp` action.

```json
> sdk.context.location
{
  "type": "open_miniapp",
  "referrerDomain": "example-app.com"
}
```

### `user`

Details about the calling user which can be used to customize the interface.

```typescript
export type UserContext = {
  fid: number;
  username?: string;
  displayName?: string;
  pfpUrl?: string;
  bio?: string;
  location?: {
    placeId: string;
    description: string;
  };
};
```

```json
> sdk.context.user
{
  "fid": 6841,
  "username": "deodad",
  "displayName": "Tony D'Addeo",
  "pfpUrl": "https://i.imgur.com/dMoIan7.jpg",
  "bio": "Building @warpcast and @farcaster, new dad, like making food",
  "location": {
    "placeId": "ChIJLwPMoJm1RIYRetVp1EtGm10",
    "description": "Austin, TX, USA"
  }
}
```

### `client`

Details about the Farcaster client running the Mini App.

```typescript
export type ClientContext = {
  platformType?: MiniAppPlatformType;
  clientFid: number;
  added: boolean;
  safeAreaInsets?: SafeAreaInsets;
  notificationDetails?: MiniAppNotificationDetails;
};
```

```json
> sdk.context.client
{
  "platformType": "mobile",
  "clientFid": 9152,
  "added": true,
  "safeAreaInsets": {
    "top": 0,
    "bottom": 20,
    "left": 0,
    "right": 0
  },
  "notificationDetails": {
    "url": "https://api.farcaster.xyz/v1/frame-notifications",
    "token": "a05059ef2415c67b08ecceb539201cbc6"
  }
}
```

### `features`

Optional object that indicates which features are available and their current state in the client.

```json
> sdk.context.features
{
  "haptics": true,
  "cameraAndMicrophoneAccess": true
}
```

Using the `features` object allows for capability detection, enabling or disabling functionality based on what features are available on the platform.
