API

Belgium - Autocomplete a postal area

Get a list of postal areas matching the specified municipality name or postcode. A municipality identifier is returned for every match. This identifier can be used as a parameter to the completeStreet method.

In case of a postcode match the postcode is also returned. It should be used as an additional parameter to the completeStreet method in order to narrow down the intended postal area.

We suggest presenting matches to end users in a format similar to: 'postcode municipalityName (matchedName)', where postcode and matchedName are optional depending on the match.

URL template

The REST API requires GET requests. Parameters are added to the REST resource URL, and each parameter must be URL-encoded:

https://api.postcode.eu/be/v1/autocomplete/postal-area/{postalArea}

Example REST request

Retrieving /be/v1/autocomplete/postal-area/2610 with the proper authentication would use the following HTTP Request:

GET /be/v1/autocomplete/postal-area/2610 HTTP/1.1
Host: api.postcode.eu
Authorization: Basic 2eTpkU******…

Example response

The lookup is successful so we receive a 200 OK status in the headers, and json encoded data in the response body:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 78

[{"municipalityName":"Antwerpen","municipalityNisCode":11002,"postcode":2610}]

Parameters

postalArea: string

Either a postcode or a municipality name. A municipality name may be partial or contain spelling errors.

Returns

Array of arrays

An array of matching postal areas

municipalityName: string

The municipality name.

municipalityNisCode: int

Identifier for the matched municipality. This is the first parameter of the completeStreet method.

postcode: int

The postcode. Null for matches on municipality name. This is the second parameter of the completeStreet method.

matchedName: string

The matched name, may be null. If a postcode was found based on the name of the postcode district, this contains the district's name.