Local prototype · simulated data
Quickstart
Run the prototype on your machine, then make your first autocomplete call. About five minutes.
1. Run the prototype
From the project folder:
npm install
npm run dev
The server listens on http://localhost:8787 only (loopback). It serves the API, these docs and the console prototype. Nothing is deployed and nothing is sent to third parties.
2. Get a test key
Open the console prototype and create a secret key. The full key is shown once; copy it then. You can also start the server with your own values:
LOCAL_TEST_SK=sk_test_PLACEHOLDER npm run dev
3. Make a request
Replace sk_test_PLACEHOLDER with your key:
curl "http://localhost:8787/v1/autocomplete?q=350+fifth&limit=3" \
-H "Authorization: Bearer sk_test_PLACEHOLDER"
// Server-side (Node 18+). Never ship a secret key to a browser.
const res = await fetch("http://localhost:8787/v1/autocomplete?q=350+fifth&limit=3", {
headers: { Authorization: "Bearer sk_test_PLACEHOLDER" },
});
const body = await res.json();
if (!res.ok) throw new Error(body.error.code);
import requests
res = requests.get(
"http://localhost:8787/v1/autocomplete",
params={"q": "350 fifth", "limit": "3"},
headers={"Authorization": "Bearer sk_test_PLACEHOLDER"},
timeout=10,
)
res.raise_for_status()
print(res.json())
The response (from the prototype, simulated data):
{
"data": [
{
"id": "sug_de1d7b18927d",
"label": "350 Fifth Ave, New York, NY 10118",
"street_line": "350 Fifth Ave",
"secondary": null,
"city": "New York",
"state": "NY",
"zip": "10118",
"has_secondaries": true,
"secondary_count": 12
}
],
"meta": {
"request_id": "req_0000000000000000docs",
"source": "simulated",
"billable": false
}
}
4. Next steps
- Follow Autocomplete and selection to fill a whole form, including apartment and suite numbers.
- Use a publishable key to call from a browser without a server proxy.