Questions · Addresses

How do I add address autocomplete to my form?

You attach the widget to the address field of your form: while the user types, the streets that really exist appear with their city, and on selection the fields fill themselves with the address already in the correct form, postcode included. Your server acts as a go-between towards our API, so the token never passes through the browser.

What the person filling in the form sees

They type “kalverstr” and see “Kalverstraat”, with the cities where that street exists; if they have already filled in the city, the suggestions narrow down to it. Once the street is chosen, they type the house number and the form tells them whether it exists: in the Netherlands it is street and house number that decide the postcode, and the postcode that arrives is the one for that number, in the form with the space, not a code from the neighbouring stretch of street.

On selection the street, postcode and city fields fill in with the record passed through the engine, the same one as the address verification. The database is born clean instead of being cleaned afterwards.

How it is charged

Per session, not per keystroke. The suggestion requests while typing are free; one operation is counted when the user selects the address and the fields fill in. If they then change the house number and select again in the same session, nothing is charged again. Each session allows up to thirty requests and lasts ten minutes. The price list is on the pricing page.

How it is integrated

Three pieces:

  1. An API token, from your account area.
  2. A small proxy on your server, a page that receives the request from the browser, adds the token and forwards it to our endpoint. It is needed because the token must never sit in the code that runs in the browser.
  3. The widget ra-suggerisci.js, with no dependencies: you give it the address of the proxy and the selectors of the form fields, and it does the rest: it handles the pause while typing, the context of the fields already filled in and the filling on selection.

If you prefer to do it yourself, you call the endpoint /api/v1/suggest directly: a session identifier generated by the client, the text typed, the fields already known as context; then the selection action with the chosen street and the house number. It is all in the API documentation and in the OpenAPI specification.

Special cases

  • Several countries: suggestions are available in every country whose address register is in service (the list); the form passes the country chosen by the user and the widget searches there, with the house number and postcode form of that country — the number before the street in France, after it in the Netherlands and Germany. The user can write everything in one field (“Kalverstraat 92 Amsterdam”): the answer says how it was read (parsed: street, house number, postcode). In a country without a register the answer says so and opens no session: the form goes on by hand, with nothing charged.
  • WooCommerce and PrestaShop: nothing to write, there are the WooCommerce plugin and the PrestaShop module with autocomplete at checkout and verification of the orders.
  • A street that does not appear: the user can always write the address in full; the record will go through verification later, from a file or from the API.
  • Several forms, several sites: the same token serves all the forms; the proxy can sit on each site or be a single one.

What happens to the fields

Before
address: kalverstr 92
city: amsterdam
After
Kalverstraat 92
1012 PH AMSTERDAM

The street is completed in its correct form, the city chosen among those that have that street, the postcode put in by the engine from street and house number and written in the Dutch form, with the space.

The questions that follow

Do I need a particular library or framework?

No. The widget is a JavaScript file with no dependencies that hooks onto the existing fields through their selectors. It works with any HTML form, inside a CMS as in a home-made application.

Why do I need a proxy on my server?

Because the API token is a key to your account: if it sat in the code that runs in the browser, anyone could read it and use it at your expense. The proxy is a page of a few lines that receives the request, adds the token and forwards it.

What does it cost if the user types and then selects nothing?

Nothing. Suggestion requests are free: one operation is counted only when the user selects an address and the fields are filled in.

Does it work on house numbers too?

Yes. Once the street is chosen, a partial house number brings up the existing numbers of that street, and the form knows whether the one typed exists. In the Netherlands it is the house number, with the street, that determines the exact postcode.

Can I use it for addresses in other countries?

Yes, in every country whose address register is in service: the form passes the country and the suggestions come from that register, in the form of that country. In a country without a register the answer flags it without opening a session, so the form continues with manual entry at no cost.

What arrives in the fields on selection?

The address already passed through the verification engine: street in its correct form, postcode and city, in the form of the country. It is the same record you would get from verifying an address, obtained the moment the data comes in.

I have a WooCommerce or PrestaShop shop: do I have to integrate the widget by hand?

No: the RadarAddress plugin for WooCommerce and the module for PrestaShop put autocomplete at checkout and verify every order. You install them, paste the token, and they work.

Read the autocomplete documentation

Endpoint, session, widget and proxy: everything you need to put it in your form.

Read the autocomplete documentation

Read also: An API to normalize addresses · Verifying the addresses in an Excel file · The WooCommerce plugin · The PrestaShop module