# listgroups

Returns a list of all Second Life groups that the bot is a member of. (For another avatar’s groups, use the [`avatar_groups`](/doc/avatar_groups-5DuuH1iwyi) command.)

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

# Variables

The following table shows input values (you send them with the API call) and returned output values.

## Input basic parameters

| Variable | Required | Description |
|----------|----------|-------------|
| action   | yes      | = listgroups |
| apikey   | yes      | Your personal [developer's API key](/doc/developers-api-key-tw8bQj4LSJ) |
| botname  | yes      | Your bot’s SL login |
| secret   | yes      | [Bot access code](https://www.mysmartbots.com/docs/Bot_access_code) of your bot |
| dataType | optional | Set to `"json"` to get JSON reply instead of URL-encoded string |
| custom   | optional | Custom data (string) to be passed back to caller script. Returned in the HTTP response |

## Output

*(To be received in* `http_response` *LSL event — see* [*docs for details*](/doc/doing-http-api-calls-c6FSEMF7bP)*)*

| Variable | Description |
|----------|-------------|
| result   | `OK`— command completed successfully<br>`FAIL` — command failed |
| resulttext | Detailed reason for the failure |
| custom   | The value from the input `"custom"` parameter |
| groups   | List of group UUIDs and names, separated by a newline (`\n`) |

# Example

The command returns the list of groups the bot belongs to.

**Raw response (URL-encoded):**

```
groups=d175f82a-2e8a-bcd2-af0b-8012d0678f2d%3BGems%20%26%20Kisses%0A040f0cd7-254e-582c-8ef7-bc9057d6834e%3BI%20Love%20Full%20Moon%0A5a4a72f5-ba47-4dbb-48d3-ebd030148ba2%3BIllusionz%20Nightclub
```

**After URL-decoding:**

```
d175f82a-2e8a-bcd2-af0b-8012d0678f2d;Gems & Kisses

040f0cd7-254e-582c-8ef7-bc9057d6834e;I Love Full Moon

5a4a72f5-ba47-4dbb-48d3-ebd030148ba2;Illusionz Nightclub
```

Each line contains:

```
<Group UUID> ; <Group Name>
```

# Notes

* Use this command to retrieve the **group membership list** of the bot.
* To obtain **detailed group info** (permissions, fees, open enrollment, etc.), use [`listgroups_extended`](/doc/listgroups_extended-gllXgbTvxn).