> ## Documentation Index
> Fetch the complete documentation index at: https://replyke-feat-push-rich-payload-fields.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch user

> Fetch a user's public profile by their Sublay user ID

## Overview

`useFetchUser` returns a function that fetches a user's public profile by their Sublay user ID. Use this when you have the user's `id` and need to load their profile on demand.

## Usage Example

```tsx theme={null}
import { useFetchUser } from "@sublay/react-js";
import { useState } from "react";

function UserCard({ userId }: { userId: string }) {
  const fetchUser = useFetchUser();
  const [user, setUser] = useState(null);

  const load = async () => {
    const result = await fetchUser({ userId });
    setUser(result);
  };

  return <button onClick={load}>Load Profile</button>;
}
```

## Parameters

The hook returns a function. That function accepts:

<ParamField path="userId" type="string" required>
  The Sublay user ID to fetch.
</ParamField>

<ParamField path="include" type="string | string[]">
  Optional. Pass `"files"` to populate `avatarFile` and `bannerFile` with full `File` objects.
</ParamField>

<ParamField path="spaceReputationId" type="string">
  Optional. Resolves the returned user's reputation into a `spaceReputation` number. Accepts a space `<uuid>` or `"none"` (project-general bucket) only — `"context"` is rejected with a `400` on this endpoint. Empty string, `"general"`, and `null` are also rejected. See [Reputation](/data-models/reputation).
</ParamField>

<ParamField path="spaceReputationDescendants" type="boolean">
  Optional. When `true`, `spaceReputation` is the subtree sum (the space plus all its descendants). Only honored when `spaceReputationId` is an explicit `<uuid>`.
</ParamField>

## Returns

<ResponseField name="User" type="User">
  The user's public profile. When `spaceReputationId` is set, it carries an added `spaceReputation` number. See [User data model](/data-models/user) and [Reputation](/data-models/reputation).
</ResponseField>
