# `$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](/docs/api/resolve-address.md) for this endpoint.

## Signature

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

## Arguments

| Name       | Type     | Required | Description                                                         |
| ---------- | -------- | -------- | ------------------------------------------------------------------- |
| `$address` | `string` | yes      | ID of address suggestion                                            |
| `$params`  | `array`  | no       | Query parameters. Keys under [Query Parameters](#query-parameters). |

## Query Parameters

Pass these as keys of `$params`.

| Name                  | Type                   | Required | Description         |
| --------------------- | ---------------------- | -------- | ------------------- |
| `tags`                | `string\|list<string>` | no       | Tags                |
| `remove_organisation` | `'true'`               | no       | Remove 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](/docs/sdks/php/errors.md).

## Example

resolve-address.phpphp

```php
<?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;
```
