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

# Profiles

> Read a member's BloxCord profile and their departments.

export const badgeStyle = {
  display: 'inline-block',
  padding: '2px 10px',
  borderRadius: '9999px',
  fontSize: '12px',
  fontWeight: 600,
  lineHeight: '20px',
  marginRight: '6px',
  verticalAlign: 'middle'
};

export const V2 = () => <span style={{
  ...badgeStyle,
  backgroundColor: 'rgba(88, 101, 242, 0.15)',
  color: '#5865F2',
  border: '1px solid rgba(88, 101, 242, 0.4)'
}}>V2 · Batchable</span>;

export const GameApi = () => <span style={{
  ...badgeStyle,
  backgroundColor: 'rgba(245, 158, 11, 0.15)',
  color: '#D97706',
  border: '1px solid rgba(245, 158, 11, 0.4)'
}}>Requires Org Functions</span>;

These methods surface a member's BloxCord profile and the departments they belong
to, so your game can display or gate on them in real time.

## getUserProfile

<V2 />

<GameApi />

Returns a member's profile: their About Me, pronouns, reputation total, the 10
most recent reputations, and whether it is currently their birthday.

```lua theme={null}
local profile = BloxCord:Invoke("getUserProfile", userId)
```

<Note>
  Batchable as the `user.getProfile` op with args `{ userId }` — see
  [`apiBatch`](/reference/webhooks-batch#apibatch). Requires the **Profiles**
  module; the reputation fields also require the **Reputations** module.
</Note>

### Parameters

<ParamField body="userId" type="number | string" required>
  The `UserId` whose profile to fetch.
</ParamField>

### Returns

<ResponseField name="profile" type="table | nil">
  The profile payload, or `nil` if the request was rejected (e.g. the Profiles
  module is disabled) or the backend was unreachable.

  <Expandable title="profile fields">
    <ResponseField name="userId" type="string">The member's `UserId`.</ResponseField>

    <ResponseField name="hidden" type="boolean">
      Whether the member has hidden their profile. When `true`, `aboutme`,
      `pronouns`, `pronounsRaw`, and `birthday` are withheld.
    </ResponseField>

    <ResponseField name="aboutme" type="string | null">The member's About Me text.</ResponseField>
    <ResponseField name="pronouns" type="string | null">Display pronouns.</ResponseField>
    <ResponseField name="pronounsRaw" type="string | null">The raw pronoun selection.</ResponseField>
    <ResponseField name="reputationEnabled" type="boolean">Whether the Reputations module is enabled.</ResponseField>
    <ResponseField name="reputation" type="number">The member's total reputation.</ResponseField>

    <ResponseField name="recentReputations" type="object[]">
      Up to the 10 most recent reputations received.

      <Expandable title="reputation fields">
        <ResponseField name="giver" type="object">`{ id, username }` of who gave it.</ResponseField>
        <ResponseField name="amount" type="number">The reputation amount.</ResponseField>
        <ResponseField name="comment" type="string | null">The attached comment, if any.</ResponseField>
        <ResponseField name="date" type="number | null">When it was given (ms).</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="birthday" type="boolean">
      `true` when it is currently the member's birthday, evaluated at local
      midnight using their last-seen timezone offset.
    </ResponseField>
  </Expandable>
</ResponseField>

### Example

```lua theme={null}
local BloxCord = game:WaitForChild("BloxCord")

local profile = BloxCord:Invoke("getUserProfile", player.UserId)
if profile then
    if profile.birthday then
        print("It's " .. player.Name .. "'s birthday!")
    end
    print(player.Name .. " has " .. profile.reputation .. " reputation.")
end
```

***

## getUserDepartments

<V2 />

<GameApi />

Returns the distinct departments (with color) of a member's assigned roles.

```lua theme={null}
local departments = BloxCord:Invoke("getUserDepartments", userId)
```

<Note>
  Batchable as the `user.getDepartments` op with args `{ userId }` — see
  [`apiBatch`](/reference/webhooks-batch#apibatch). The op result is
  `{ departments = {...} }`.
</Note>

### Parameters

<ParamField body="userId" type="number | string" required>
  The `UserId` whose departments to fetch.
</ParamField>

### Returns

<ResponseField name="departments" type="object[]">
  An array of the member's departments. Empty if none (or the member is not in
  the organization).

  <Expandable title="department fields">
    <ResponseField name="name" type="string">The department name.</ResponseField>
    <ResponseField name="color" type="string | null">The department's role color, if set.</ResponseField>
  </Expandable>
</ResponseField>

### Example

```lua theme={null}
local BloxCord = game:WaitForChild("BloxCord")

local departments = BloxCord:Invoke("getUserDepartments", player.UserId)
for _, dept in ipairs(departments) do
    print(player.Name .. " is in " .. dept.name)
end
```
