# Configure

Postcode Lookup exports a `setup` method to apply address verification to a form. `setup` requires the following configuration at minimum.

Minimal configuration

`apiKey`, `context` and `outputFields` below are all you need to get Postcode Lookup working. For the complete set of controller options, see [Configuration Reference](/docs/postcode-lookup/configuration-reference.md).

## API Key

`apiKey`

API Key from your Ideal Postcodes account. Typically begins `ak_`.

## Postcode Lookup Container

`context`

Specify an area on your page where Postcode Lookup can render its user interface. Typically a `<div>`, you may reference this using a CSS selector or a direct reference to the node.

postcode-lookup.jsjavascript

```javascript
{
  context: "#context_id"
}
```

## Address Targets

`outputFields`

Specify where to send address data given a selected address. `outputFields` is an object which maps an address attribute to an input field. The input field can be identified by CSS or reference to the DOM element itself.

field-mappings.jsjavascript

```javascript
{
  line_1: "#line_1",
  line_2: "#line_2",
  line_3: "input[name='line_3']",
  post_town: document.getElementById("post_town"),
  postcode: document.getElementById("postcode")
}
```

Minimum fields for reliable delivery

The fields above (`line_1`, `line_2`, `line_3`, `post_town` and `postcode`) are the minimum set needed to capture a complete, deliverable UK address. Collect all of them so the address you store reliably routes to the premises.

Up to 3 address lines, post town and postcode fields cover all the addressing information required to identify UK premises. You may extract more data for an address by passing more properties into the `outputFields` configuration object.

The configuration attributes for `outputFields` match the Address response object. For instance, street name can be populated using the [`thoroughfare`](/docs/data/paf.md#thoroughfare-elements) attribute. A list of address attributes provided by the API can be found in our [UK address data guide](/docs/data/paf.md).

More complex, dynamic assignment can be performed using the `onAddressSelected` callback.

Output fields assigned with a query selector are evaluated lazily (i.e. when an address attribute needs to be piped to a field).

[More information on addressing data can be found on our address data documentation](/docs/data.md).
