# name2key

Returns an avatar’s UUID by their Second Life name.

```csharp
// See "LSL Helper Functions" page for this function
smartbotsAPI("name2key", [
  "name", "BarKeeeper",
  "request_case", 1
]);
```

```snippet http-api-variables-OmJyUigTgO
```


:::info
This API command applies only for **Standard bots**.

:::

```snippet http-api-input-basic-parameters-5FcVlaJbq0 action="name2key"
```

```snippet http-api-input-q5yvAagqsZ
name         | yes      | The Second Life name of the avatar
request_case | optional | Set to `1` to get the exact avatar name case from Second Life (see **Name case**)
```

```snippet http-api-output-JAwUcmg7i7
key        | Avatar’s UUID
name       | Second Life name you’ve sent
normalname | Second Life name, normalized (see **Return value**)
```

# Return value

The command returns an avatar’s UUID by searching its Second Life name.  
It provides two name fields:

* `name` — the exact name as you sent it
* `normalname` — the “normalized” name (the system adds “Resident” if necessary)

# Name case

Second Life ignores name case (e.g., `glaznah gassner` equals `Glaznah GASSner`),  
so `normalname` may appear in lowercase.

If you want the exact name case from Second Life servers, set `request_case` to `1`.

# Examples

**1. Requesting the avatar UUID by Second Life name:**

```
https://www.mysmartbots.com/api/bot.html?action=name2key&name=barKeeeper&...
```

**Result:**

```
name = barKeeeper

normalname = barkeeeper resident

key = 76e96174-ddcf-482f-86aa-c9394664082f
```

**Or, with** `**request_case=1**`**:**

```
name = barKeeeper

normalname = BarKeeeper Resident

key = 76e96174-ddcf-482f-86aa-c9394664082f
```

**2. Looking for a nonexistent avatar:**

```
https://www.mysmartbots.com/api/bot.html?action=name2key&name=ThisAvatarNotExists&...
```

**Result:**

```
result = FAIL

resulttext = name lookup failed, ThisAvatarNotExists Resident

normalname = ThisAvatarNotExists Resident

name = ThisAvatarNotExists
```