> ## Documentation Index
> Fetch the complete documentation index at: https://rust-co.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# API & events

> Public RCO Appearance integrations for editors, appearance, clothing, dress/undress, wardrobe and Quick Clothing.

The most important API rule is simple:

> **Something visible on the ped is not automatically something saved for the character.**

Use client APIs for visual/gameplay state. Use server-authorized APIs when an editor or appearance change must persist.

## Persistent editor opens

### Server: `OpenEditor(source, options)`

```lua theme={"dark"}
local ok = exports['rco-appearance']:OpenEditor(source, {
    mode = 'barber', -- creator | clothing | barber | tattoo | wardrobe
})
```

Use this from trusted **server code** when another resource needs to open a save-capable RCO editor.

### Server: `OpenWardrobe(source, options?)`

```lua theme={"dark"}
local ok = exports['rco-appearance']:OpenWardrobe(source)
```

Preferred integration for houses, hotels, camps and properties. It always opens saved-outfit/wardrobe mode. Full guide: [Wardrobe integrations](/rco-appearance/wardrobe-integration).

### Client: persistent `OpenEditor` / `OpenWardrobe`

A client cannot grant itself persistent save authorization. Direct client calls return:

```text theme={"dark"}
false, 'server_authorization_required'
```

For a deliberately local/visual-only editor:

```lua theme={"dark"}
local ok = exports['rco-appearance']:OpenEditorLocal({ mode = 'clothing' })
```

`OpenEditorLocal` is not a replacement for the server-authorized persistent flow.

## Visual appearance

### `ApplyAppearance`

```lua theme={"dark"}
exports['rco-appearance']:ApplyAppearance(snapshot)
exports['rco-appearance']:ApplyAppearance(ped, snapshot)
```

Applies an RCO snapshot visually. Useful for previews, mannequins and custom peds.

**It is not a database save.**

### `GetAppearance`

```lua theme={"dark"}
local snapshot = exports['rco-appearance']:GetAppearance(ped)
```

Reads the ped's current visual appearance.

<Warning>
  Do not blindly persist a live capture. The ped may be inside an editor, temporarily undressed or carrying a transient gameplay state. Use the server persistence API when you need the canonical character appearance.
</Warning>

### `ReloadAppearance`

Client:

```lua theme={"dark"}
exports['rco-appearance']:ReloadAppearance()
```

Server:

```lua theme={"dark"}
exports['rco-appearance']:ReloadAppearance(source)
```

Both paths request the character's saved RCO appearance instead of treating the current live ped as authority.

## Direct clothing helpers

These helpers are useful for controlled visual integrations. They do **not** replace the normal tailor/wardrobe save flow.

```lua theme={"dark"}
local item = exports['rco-appearance']:GetEquipped('hats')

local ok, reason = exports['rco-appearance']:EquipCategory('hats', itemData)
local ok, reason = exports['rco-appearance']:UnequipCategory('hats')
```

`EquipCategory` / `UnequipCategory` operate on the live ped. If you need a temporary gameplay toggle that should survive streaming/reapply correctly, use [Quick Clothing](/rco-appearance/quick-clothing) instead.

## Dress / undress

RCO exposes a simple visual undress flow for medical, bathing, prison, hotel or other gameplay resources:

```lua theme={"dark"}
local ok, reason = exports['rco-appearance']:Undress()
local ok, reason = exports['rco-appearance']:Dress()
```

Or explicitly:

```lua theme={"dark"}
exports['rco-appearance']:SetUndressed(true)
exports['rco-appearance']:SetUndressed(false)
```

Behavior:

* `Undress()` / `SetUndressed(true)` remove clothing from the live ped;
* `Dress()` / `SetUndressed(false)` request the saved RCO appearance from the server;
* this does **not** overwrite the saved snapshot just because the player was temporarily undressed;
* compatible Quick Clothing state may be reapplied after the base appearance is restored.

<Note>
  Use Quick Clothing when you want to hide one semantic category such as a hat, coat or gun belt. Use `Undress` / `Dress` when your gameplay flow needs the character's clothing removed as a whole.
</Note>

## Editor state

```lua theme={"dark"}
local open = exports['rco-appearance']:IsEditorOpen()
```

Useful for resources that should not start another appearance mutation while an RCO editor is active.

## Character persistence

### `GetAppearanceForCharacter(charId, callback)`

```lua theme={"dark"}
exports['rco-appearance']:GetAppearanceForCharacter(charId, function(snapshot, err)
    if not snapshot then
        print(err)
        return
    end

    -- canonical saved snapshot
end)
```

### `SetAppearanceForCharacter(charId, snapshot, callback)`

```lua theme={"dark"}
exports['rco-appearance']:SetAppearanceForCharacter(charId, snapshot, function(ok, err)
    if not ok then
        print(err)
        return
    end

    -- persistence completed
end)
```

`charId` is the framework character identifier (RSG citizen id / VORP character identifier). Treat it as an opaque identifier.

Saving is asynchronous. Wait for the callback before chaining logic that assumes the database write succeeded.

## Outfit helpers

Server-side integrations can also use the character's saved outfit list:

```lua theme={"dark"}
exports['rco-appearance']:ListOutfits(source, function(outfits, err)
    if not outfits then
        print(err)
        return
    end

    -- use saved outfits
end)
```

For houses/hotels, opening the built-in wardrobe is usually simpler than rebuilding the outfit UI yourself.

## Quick Clothing API

Quick Clothing is the recommended API for temporary radial-menu clothing actions.

```lua theme={"dark"}
exports['rco-appearance']:ToggleClothing('hat')
exports['rco-appearance']:ToggleClothing('holsters')
exports['rco-appearance']:SetClothingVisible('coat', false)

exports['rco-appearance']:ToggleSleeves()
exports['rco-appearance']:SetSleeves('rolled')

exports['rco-appearance']:ToggleCollar()
exports['rco-appearance']:SetCollar('open')

exports['rco-appearance']:TogglePantsTuck()
exports['rco-appearance']:SetPantsTucked(true)

exports['rco-appearance']:ToggleGunBelt()
exports['rco-appearance']:ToggleClosedCoat()
```

`ToggleGunBelt()` is a named helper for the `gunbelt` category. Gun holsters use the generic `holsters` category:

```lua theme={"dark"}
exports['rco-appearance']:ToggleClothing('holsters')
```

`ToggleClosedCoat()` is an alias for the logical `coat` group, which includes open/closed coat variants and coat accessories handled by RCO.

Server scripts can use the same semantic state:

```lua theme={"dark"}
exports['rco-appearance']:SetPlayerClothingVisible(source, 'hat', false)
exports['rco-appearance']:TogglePlayerClothing(source, 'holsters')
exports['rco-appearance']:SetPlayerClothingTransform(source, 'sleeves', 'rolled')
exports['rco-appearance']:ResetPlayerClothingToggles(source)
```

See [Quick Clothing](/rco-appearance/quick-clothing) for all categories, commands, events and failure reasons.

## Framework compatibility aliases

RCO keeps selected RSG/VORP compatibility names so existing resources can continue to call known appearance helpers. Those aliases are a compatibility layer, not the recommended API for new integrations.

New resources should prefer:

```lua theme={"dark"}
exports['rco-appearance']:...
```

so the integration has the same contract on RSG and VORP.
