Skip to main content

$client->resolveAddress()

Resolve Address

Returns the complete address for an autocomplete suggestion, identified by its address ID.

This is the step of the autocomplete flow that costs a lookup. Fetching suggestions is free.

The API returns resolved addresses, including addresses outside the UK, in a UK format (up to 3 address lines) using UK nomenclature such as postcode and county.

An ID that matches no address returns 404.

Endpoint​

GET /autocomplete/addresses/{address}/gbr

See the API reference for this endpoint.

Signature​

public function resolveAddress(string $address, array $params = []): GbrResolveAddressResponse

Arguments​

NameTypeRequiredDescription
$addressstringyesID of address suggestion
$paramsarraynoQuery parameters. Keys under Query Parameters.

Query Parameters​

Pass these as keys of $params.

NameTypeRequiredDescription
tagsstring|list<string>noTags
remove_organisation'true'noRemove Organisation

Response​

IdealPostcodes\Responses\GbrResolveAddressResponse. Read fields as properties, such as $response->result, or as an array with the API's field names. toArray() returns the decoded body.

Errors​

An HTTP error throws ApiException with the HTTP status, the API error code from getCode() and the decoded body. A transport failure throws TransporterException. See error handling.

Example​

resolve-address.phpphp
<?php

declare(strict_types=1);

use IdealPostcodes\IdealPostcodes;

require 'vendor/autoload.php';

$client = IdealPostcodes::client('ak_test');

$response = $client->resolveAddress('paf_2670849');

$address = $response->result;

echo $address->line1, PHP_EOL;
echo $address->postTown, ', ', $address->postcode, PHP_EOL;
echo 'UPRN ', $address->uprn, ' from ', $address->dataset, PHP_EOL;