# Reverse geocoding

> GET /v1/reverse answers the opposite question. You give a coordinate, Findort tells you which address or place is there.

Source: https://findort.ch/en/docs/reverse/

## Request

```http
Authorization: Bearer pk_…
```

Typical uses: a "use my location" button in a form, a click on a map, or GPS points from an app that need a readable address.

## Parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `lat` | number, required | | Latitude, -90 to 90 |
| `lon` | number, required | | Longitude, -180 to 180 |
| `radius` | number | | Search radius in kilometres, 0.01 to 50. Limits the search to this distance. |
| `limit` | number | `5` | Number of results, 1 to 20 |
| `lang` | text | local language | `de`, `fr`, `it` or `en` |
| `types` | list | all types | as in [search](https://findort.ch/en/docs/search/#parameters), for example `types=address` |
| `key` | text | | API key, if you cannot send an `Authorization` header |

There is no `country`, `near` or `bbox` here: the coordinate already fixes the place.

## Example

```bash
  -H "Authorization: Bearer sk_…"
```

```json
  "results": [
    {
      "id": "N3797624451",
      "label": "Bundesplatz 3, 3011 Bern",
      "name": "Bundesplatz 3",
      "type": "address",
      "category": "place:house",
      "address": {
        "street": "Bundesplatz",
        "housenumber": "3",
        "postcode": "3011",
        "city": "Bern",
        "state": "Bern",
        "country": "Switzerland",
        "countryCode": "CH"
      },
      "location": { "lat": 46.94652, "lon": 7.44436 }
    }
  ],
  "attribution": "© OpenStreetMap contributors, ODbL"
}
```

The response has the same format as search, see [response format](https://findort.ch/en/docs/response/). The nearest result comes first. If nothing is within the radius, `results` is empty.

## With the browser's location

```js

const findort = new Findort('pk_…', { lang: 'en' });

navigator.geolocation.getCurrentPosition(async ({ coords }) => {
  const [place] = await findort.reverse(coords.latitude, coords.longitude, { limit: 1, types: 'address' });
  document.querySelector('#address').value = place?.label ?? '';
});
```
