# find_objects

Returns a list of objects rezzed in the region.

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

# 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      | = find_objects |
| 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 | The custom data (string) to be passed back to caller script. This value will be returned back to the caller in HTTP response |

## Input

| Variable | Required | Description |
|----------|----------|-------------|
| uuid     | optional | Filter a specific object by UUID |
| in_search | optional | Look for objects with the “Show in search” property.<br>`0`(default)<br>`1` |
| current_parcel | optional | Look for objects within the current parcel only.<br>`0`<br>`1` (default) |
| root_only | optional | Look for root objects only (linked child objects excluded).<br>`0`<br>`1` (default) |
| parent   | optional | UUID of parent object — shows child objects of this parent UUID |
| with_props | optional | Request additional object properties (Name, Description, etc).<br>`0`<br>`1` (default) |
| range    | optional | The distance to scan in meters (default: all visible objects) |
| limit    | optional | Limit the number of returned objects (default: 100, max: 100) |

## 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 input "custom" parameter. See above |
| found    | Total number of objects found (includes objects outside the limit) |
| returned | Number of objects returned within the limit |
| objects  | JSON array of object data (UUID, position, distance, etc.) |

# Example

Returns nearby objects with a limit of 2 and a scan range of 20 meters:

```csharp
// See "LSL Helper Functions" page for this function
smartbotsAPI("find_objects", ["limit", 2, "range", 20]);
```

### Example JSON Response

```json
{
  "result": "OK",
  "action": "find_objects",
  "found": 30,
  "returned": 2,
  "objects": [
    {
      "UUID": "2e4c4962-0316-ecf4-ccf3-7c9db5b05bfc",
      "LocalID": 552702023,
      "Position": { "X": 111.69685, "Y": 234.43146, "Z": 3003.1833 },
      "LocalPosition": { "X": 111.69685, "Y": 234.43146, "Z": 3003.1833 },
      "ParcelLocalID": 7,
      "Distance": 3.2783988,
      "Flags": { "InSearch": false },
      "RootUUID": null,
      "Props": {
        "Name": "NLS",
        "Description": "",
        "OwnerID": "7351a3c1-009e-4a95-b737-413ad34ebed1",
        "CreatorID": "7351a3c1-009e-4a95-b737-413ad34ebed1",
        "SalePrice": 10,
        "Permissions": {
          "NextOwnerMask": "Transfer, Move",
          "OwnerMask": 2147483647
        },
        "TextureIDs": [
          "89556747-24cb-43ed-920b-47caed15465f"
        ]
      },
      "Type": "Primitive"
    },
    {
      "UUID": "b23bedce-cc61-5828-4d56-2e08c7cf8b17",
      "LocalID": 540403275,
      "Distance": 3.2799234,
      "Position": { "X": 117.94934, "Y": 235.63309, "Z": 3004.069 },
      "Flags": { "InSearch": false },
      "Props": {
        "Name": "S2 Pro Switch - Industrial Large - ACCESS v1.2.0",
        "Description": "LandingLights,1337",
        "OwnerID": "7351a3c1-009e-4a95-b737-413ad34ebed1"
      },
      "Type": "Primitive"
    }
  ]
}
```