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

# Server Exports

> Server-side exports for resolving permanent IDs to sources and identifiers, including offline lookups.

All server exports are called with colon syntax: `exports.vrs_permanentid:Fn(...)`.

## GetPermanentId

Returns the permanent ID of an **online** player.

```lua theme={null}
exports.vrs_permanentid:GetPermanentId(source)
```

<ParamField path="source" type="number" required>
  The player's server id.
</ParamField>

**Returns:** `number | nil`

***

## GetPermanentIdByIdentifier

Database fallback that works **even when the player is offline**.

```lua theme={null}
exports.vrs_permanentid:GetPermanentIdByIdentifier(citizenid)
```

<ParamField path="citizenid" type="string" required>
  The player's `citizenid` (QB/QBox) or `identifier` (ESX).
</ParamField>

**Returns:** `number | nil`

***

## GetIdentifierByPermanentId

Reverse lookup: resolve a permanent ID back to a stored identifier.

```lua theme={null}
exports.vrs_permanentid:GetIdentifierByPermanentId(pid)
```

<ParamField path="pid" type="number" required>
  The permanent ID to look up.
</ParamField>

**Returns:** `string | nil`

***

## GetSourceByPermanentId

Resolve a permanent ID to a live server id. **Online only.**

```lua theme={null}
exports.vrs_permanentid:GetSourceByPermanentId(pid)
```

<ParamField path="pid" type="number" required>
  The permanent ID to look up.
</ParamField>

**Returns:** `number | nil`

***

## GetAllOnline

Returns a map of every online player's source to their permanent ID.

```lua theme={null}
exports.vrs_permanentid:GetAllOnline()
```

**Returns:** `{ [source] = pid }`

## Statebags

Replicated on every online player. Read from **client or server**, no export required.

```lua theme={null}
Player(serverId).state.vrs_pid       -- number | nil
Player(serverId).state.vrs_pid_name  -- character name | nil
```
