# nearbyavatars_scan

Scans the current region for other avatars.


:::warning
This API call might not be suitable for LSL because of the large amount of data received.

:::

```csharp
// See "LSL Helper Functions" page for this function
smartbotsAPI("nearbyavatars_scan", []);
```

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

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

## Input

This command has no additional input parameters.

```snippet http-api-output-JAwUcmg7i7
avatars | Nearby avatars list. See **Return value** for details
```

# Return value

The `avatars` field in the response is an array containing a list of avatars the bot can see:

```json
{
  "name": "GrrrillaBongo Resident",
  "UUID": "d8e20552-ca84-4c42-b8d3-e8fa5fbdcc6b",
  "parcelID": 177,
  "sitting": false,
  "position": {
    "X": 110,
    "Y": 75,
    "Z": 32
  },
  "localPosition": {
    "X": 110,
    "Y": 75,
    "Z": 32
  },
  "heading": 0,
  "localHeading": 0,
  "distance": 129.97195,
  "seenSince": "2022-10-18T12:36:58.2626463Z",
  "seenSeconds": 123
}
```

# Details

The `seenSince` value indicates when the bot first detected a specific avatar during `nearbyavatars_scan`.  
For example:


1. The bot logs in.
2. Time passes (say, 1 hour).
3. `nearbyavatars_scan` is called.
4. Bot sees avatar **Guest1**, `seenSince = "2022-10-18 13:00"`.
5. Five minutes later, `nearbyavatars_scan` is called again.
6. Bot now sees **Guest2**, `seenSince = "2022-10-18 13:05"`.

Subsequent calls to `nearbyavatars_scan` return:

```
Guest1: seenSince = "2022-10-18 13:00"
Guest2: seenSince = "2022-10-18 13:05"
```

The `seenSeconds` value shows how many seconds the avatar has been visible (difference between now and `seenSince`).

# Throttling

The maximum call rate for `nearbyavatars_scan` is **2 calls per 10 seconds**.  
Excessive calls will return a **"Frequent API requests throttled"** error.

# Data size

The data returned by this command can be large (up to **10 KB or more**), depending on the number of avatars nearby.