Node/Express
Express route at /api/locations/autocomplete, configured through placefield.config.json.
cd examples/node-express
npm install
npm run dev
Open Node/Express guide
Static examples companion - no embedded live API key
Use these examples to keep your pf_live_... key on your server, call the PlaceField API from a backend route, and return structured location autocomplete data to your app. The full API reference stays on placefield.dev; this site is for choosing and running examples.
For most apps, the browser or mobile client should call your backend. Your backend calls PlaceField with a secret server key and returns only the result data your product needs.
pf_live_xxx from server-side config and forwards safe query params.
Both backend examples use visible placeholder config files so you can see exactly where the key goes. Replace the placeholder only when you are ready to call the live API.
Express route at /api/locations/autocomplete, configured through placefield.config.json.
cd examples/node-express
npm install
npm run dev
Open Node/Express guide
Minimal API route at /api/locations/autocomplete, configured through appsettings.json.
cd examples/aspnet-minimal-api
dotnet run
Open ASP.NET guide
This preview uses fixture data only. It shows the request and response shape without making a request to api.placefield.dev or exposing a usable key on GitHub Pages.
GET /v1/locations/autocomplete?q=paris&geoBias=none&typePreset=default&limit=8 Authorization: Bearer pf_live_xxx
{
"results": [
{
"id": "fr:city:paris",
"type": "city",
"name": "Paris",
"label": "Paris, Ile-de-France, France",
"country": { "code": "FR", "name": "France" },
"hierarchy": [
{ "type": "country", "id": "country:fr", "name": "France", "code": "FR" },
{ "type": "region", "name": "Ile-de-France" }
],
"coordinates": { "lat": 48.8566, "lon": 2.3522 }
}
],
"meta": {
"query": "paris",
"geoBias": "none",
"typePreset": "default"
}
}
For complete parameter and response details, use the canonical PlaceField API reference.
Browser examples use public pf_pub_... placeholders and exact origin allowlisting. They are useful when you intentionally want browser-side autocomplete behavior.
Direct browser fetch example with a visible public-key placeholder.
Open API Fetch exampleAttach PlaceField autocomplete behavior to your own input and fields.
Open Basic JS exampleReady-made autocomplete field with bundled UI and optional fullscreen mobile search.
Open Full Widget exampleSmall React/Vite TypeScript example using @placefield/widget with the hosted Full Widget.
cd examples/react-widget
npm install
npm run typecheck
npm run dev
Open React run instructions
This examples site intentionally avoids duplicating the full docs. Use the product docs for the current API contract, billing, limits, and integration guidance.