# parcel_buy

Purchases the parcel at a specific point in the region.

```csharp
// See "LSL Helper Functions" page for this function
smartbotsAPI("parcel_buy", [
  "x", 30,
  "y", 60
]);
```

# 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      | = parcel_buy |
| 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 |
|----------|----------|-------------|
| x        | optional | The X coordinate of the parcel (default - at bot's position) |
| y        | optional | The Y coordinate of the parcel (default - at bot's position) |
| group    | optional | The UUID of the group to buy the parcel for (if buying for the group) |
| remove_contribution | optional | `1` - remove the land contribution from the group after purchasing the parcel (if buying for the group) |

## 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 |

# Permissions

* The land must be set for sale (see `parcel_info_update` command to sell land)
* The bot must have enough money on balance
* If purchasing for a group, the “Deed land and buy land for group” group ability is required

# Return values

The command returns:

```
result = OK
```

if the parcel has been purchased successfully.