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

# App data API

> Fetch an app's data for the signed-in user or for a profile owner, with visibility applied.

`useAppData` reads `GET /apps/:appId`, the per-app data endpoint. Without a username it returns the signed-in user's own data; with one it returns what the caller is allowed to see of that user's data.

```tsx theme={null}
import { useAppData } from '@cskn/sdk';

interface GameData {
  score: number;
  level: number;
}

function Stats({ username }: { username?: string }) {
  const { data, isLoading } = useAppData<GameData>({ appId: 'my-game', username });

  if (isLoading || !data) return null;
  if (!data.isOwner && data.visibility === 'private') return <p>This is private.</p>;

  return <p>Score {data.data.score}, level {data.data.level}</p>;
}
```

## Options

<ParamField path="appId" type="string" required>
  The app's slug.
</ParamField>

<ParamField path="username" type="string">
  Whose data to read. Omit for the signed-in user. On a user page, pass `getAppUser()?.username`.
</ParamField>

<ParamField path="enabled" type="boolean" default="true">
  Standard TanStack Query flag.
</ParamField>

## Response

<ResponseField name="data" type="T">
  The app's data for that user.
</ResponseField>

<ResponseField name="visibility" type="'public' | 'followers' | 'private'">
  Who the owner allows to see it. Set by the owner in [app settings](/sdk/app-settings).

  | Value | Who can see it |
  | - | - |
  | `public` | Everyone |
  | `followers` | The owner's followers |
  | `private` | The owner, plus users they explicitly granted |
</ResponseField>

<ResponseField name="isOwner" type="boolean">
  Whether the caller is the owner.
</ResponseField>

<ResponseField name="isFollower" type="boolean">
  Whether the caller follows the owner, when that is relevant.
</ResponseField>

Query key: `['app-data', appId, username || 'me']`, cached for five minutes.


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