Quickstart
Five minutes from an empty form to an address field with suggestions. You need a key, one script line and one HTML element.
Base URL
All endpoints live under:
https://api.findort.ch/v1The API has two endpoints: GET /v1/search searches by text, GET /v1/reverse finds what is at a coordinate.
1. Get a key
Create a free account and add a key in the dashboard. There are two kinds:
| Key | For | Check |
|---|---|---|
pk_… public | Browser, HTML, Web Component | only works on the domains you list |
sk_… secret | Servers, scripts, backends | no origin check, never in a browser |
More under authentication.
2. First request
Try the API with curl and your secret key:
curl "https://api.findort.ch/v1/search?q=Bundesplatz%203%20Bern&country=ch&limit=1" \
-H "Authorization: Bearer sk_…"The response is flat JSON with a ready-made label:
{
"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.94649, "lon": 7.44433 }
}
],
"attribution": "© OpenStreetMap contributors, ODbL"
}Every field is explained in response format.
3. Add the search field
Two lines of HTML are enough. The script loads the <findort-search> Web Component, which works with any framework or none:
<script type="module" src="https://api.findort.ch/sdk/v1/search.js"></script>
<findort-search key="pk_…" country="ch" lang="en" name="address"></findort-search>When someone picks a suggestion, the element fires a findort-select event. It carries the whole place with address parts and coordinates:
<script>
document.querySelector('findort-search').addEventListener('findort-select', (e) => {
const place = e.detail.place;
console.log(place.label, place.location.lat, place.location.lon);
});
</script>Inside a <form> the element submits the chosen text under the name from name. Attributes, styling and keyboard support are covered in Web Component.
Local development: add your local address to the public key too, for example http://localhost:5173. Otherwise the API answers with 403 origin_not_allowed.
4. On the server
For servers there are libraries with no dependencies. Use the secret key there.
import { Findort } from 'findort';
const findort = new Findort(process.env.FINDORT_KEY, { lang: 'en', country: 'ch' });
const place = await findort.geocode('Bundesplatz 3, Bern');$findort = new Findort\Findort(getenv('FINDORT_KEY'), ['lang' => 'en']);
$place = $findort->geocode('Bundesplatz 3, Bern', ['country' => 'ch']);import os
from findort import Findort
findort = Findort(os.environ["FINDORT_KEY"], lang="en")
place = findort.geocode("Bundesplatz 3, Bern", country="ch")Details: JavaScript, PHP, Python.