# Search nearby

Discover places around a coordinate, nearest first, each with its distance in meters. Places Google returns beyond the radius are dropped and counted in the summary; optional query and type terms narrow the search.

- Platform: [Google Maps](https://docs.upscrape.com/docs/platforms/googlemaps)
- Capability ID: `googlemaps.nearby`
- Cost: 1 credit per request
- Maximum runtime: 120 seconds
- Execute endpoint: `POST https://data.upscrape.com/execute`

## Request

Use the exact public capability ID in the shared execute envelope.

```bash
curl --request POST \
  --url https://data.upscrape.com/execute \
  --header "Authorization: Bearer $UPSCRAPE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Prefer: wait=30" \
  --data '{
  "input": {
    "lat": 37.7749,
    "limit": 20,
    "lng": -122.4194,
    "query": "coffee",
    "radius": 500
  },
  "capability": "googlemaps.nearby"
}'
```

## Input


| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `country` | `string` | No | Two-letter country code (default 'us'). Default: `us`. |
| `include_exclusion_summary` | `boolean` | No | Include counts of fetched places rejected for being outside the radius or missing usable coordinates (default true). These counts do not describe all places in the area. Default: `true`. |
| `lang` | `string` | No | Language code such as 'en' or 'en-US' (default 'en'). Default: `en`. |
| `lat` | `number` | Yes | Latitude (required). From -90 to 90. |
| `limit` | `integer` | No | Max results (default 60, max 120). From 1 to 120. Default: `60`. |
| `lng` | `number` | Yes | Longitude (required). From -180 to 180. |
| `query` | `string` | No | Search terms, e.g. 'coffee'. Combined with any type terms. |
| `radius` | `integer` | No | Search radius in meters (default 1000). Results farther than this are dropped; results are sorted nearest first with distance_m. From 1 to 50000. Default: `1000`. |
| `types` | `array<string>` | No | Additional type terms combined into the search query, e.g. ['restaurant']. |

### Example input

```json
{
  "lat": 37.7749,
  "limit": 20,
  "lng": -122.4194,
  "query": "coffee",
  "radius": 500
}
```

## Response

Successful output is returned in `results[0].data`.

Raw platform output is intentionally open-ended and may evolve with the upstream source.

### Illustrative sample output

This example shows one response. Values and optional fields vary with the data available.

```json
{
  "items": [
    {
      "address": "The Coffee Berry SF, 1410 Lombard St, San Francisco, CA 94123",
      "cid": "5181132708478222499",
      "feature_id": "0x80858135f0db680b:0x47e714bf5f0080a3",
      "lat": 37.8014124,
      "lng": -122.4249979,
      "maps_url": "https://www.google.com/maps/place/?q=place_id:ChIJC2jb8DWBhYARo4AAX78U50c",
      "name": "The Coffee Berry SF",
      "phone": "[redacted:phone]",
      "place_id": "ChIJC2jb8DWBhYARo4AAX78U50c",
      "rating": 4.9,
      "types": [
        "Coffee shop"
      ],
      "website": "http://thecoffeeberrysf.com/"
    },
    {
      "address": "The Coffee Movement, 1737 Balboa St, San Francisco, CA 94121",
      "cid": "2726196137705445702",
      "feature_id": "0x808587fb77f5f64d:0x25d564f177f99946",
      "lat": 37.7764721,
      "lng": -122.47782249999999,
      "maps_url": "https://www.google.com/maps/place/?q=place_id:ChIJTfb1d_uHhYARRpn5d_Fk1SU",
      "name": "The Coffee Movement",
      "place_id": "ChIJTfb1d_uHhYARRpn5d_Fk1SU",
      "rating": 4.8,
      "types": [
        "Coffee shop"
      ],
      "website": "https://www.thecoffeemovement.com/"
    },
    {
      "address": "Delah Coffee, 450 Sansome St, San Francisco, CA 94111",
      "cid": "6645719790780935763",
      "feature_id": "0x80858173c72935df:0x5c3a56f06e47ee53",
      "lat": 37.7946518,
      "lng": -122.401139,
      "maps_url": "https://www.google.com/maps/place/?q=place_id:ChIJ3zUpx3OBhYARU-5HbvBWOlw",
      "name": "Delah Coffee",
      "phone": "[redacted:phone]",
      "place_id": "ChIJ3zUpx3OBhYARU-5HbvBWOlw",
      "rating": 4.6,
      "types": [
        "Coffee shop"
      ],
      "website": "https://delahcoffee.com/"
    }
  ],
  "summary": {
    "has_more": true,
    "query": "coffee",
    "total_items": 20
  }
}
```
### Illustrative output fields

Derived from the sample above for orientation only. These fields are not a fixed response schema.

| Path | Observed type | Example |
| --- | --- | --- |
| `items` | `array` | 3 items |
| `items` | `array` | 3 items |
| `summary` | `object` | 3 fields |
| `summary.has_more` | `boolean` | true |
| `summary.query` | `string` | coffee |
| `summary.total_items` | `integer` | 20 |

## Execution behavior

A `200` response completed inline. A `202` response was queued; poll `GET /jobs/{id}` until the job reaches `completed` or `failed`. Use an `Idempotency-Key` when retrying must not create a duplicate logical job.

## Related documentation

- [Authentication](https://docs.upscrape.com/docs/api/authentication)
- [Jobs and results](https://docs.upscrape.com/docs/api/jobs)
- [Errors and retries](https://docs.upscrape.com/docs/api/errors)
- [Idempotency](https://docs.upscrape.com/docs/api/idempotency)
