# `client.RetrieveAddress()`

Retrieve Address

Returns the full address for an autocomplete suggestion id.

This is the charged step of address autocomplete. A successful retrieval decrements your lookup balance. An id which resolves to no address returns `404`.

Every address comes back in one US-shaped format, whatever country or dataset it came from: up to two address lines and US field names such as `zip_code`, `state` and `city`.

## Endpoint

`GET /autocomplete/addresses/{address}/usa`

See the [API reference](/docs/api/retrieve-address.md) for this endpoint.

## Signature

```go
func (c *Client) RetrieveAddress(ctx context.Context, address string, params *RetrieveAddressParams) (*UsaResolveAddressResponse, error)
```

## Arguments

| Name      | Type                     | Required | Description                                                                            |
| --------- | ------------------------ | -------- | -------------------------------------------------------------------------------------- |
| `ctx`     | `context.Context`        | yes      | Cancels the request and sets its deadline.                                             |
| `address` | `string`                 | yes      | ID of address suggestion                                                               |
| `params`  | `*RetrieveAddressParams` | no       | Optional query parameters, or nil. Fields under [Query Parameters](#query-parameters). |

## Query Parameters

A required parameter is a method argument. Set the rest as fields of `params`, named in Studly case (`post_town` is `PostTown`); a field left at its zero value is not sent.

| Name          | Type     | Required | Description            |
| ------------- | -------- | -------- | ---------------------- |
| `licensee`    | `string` | no       | Licensee Key           |
| `filter`      | `string` | no       | Restrict Result Fields |
| `tags`        | `string` | no       | Tags                   |
| `remove_firm` | `string` | no       | Remove Firm            |

## Response

`*addresszen.UsaResolveAddressResponse`. Fields the API may leave out or send as null are pointers. `RawJSON()` returns the body as received. See [responses](/docs/sdks/go/responses.md).

## Errors

An HTTP error returns `*addresszen.APIError` with the HTTP status, the API error code and the body; match it with `errors.AsType`. A transport failure returns the `net/http` error, wrapped. See [error handling](/docs/sdks/go/errors.md).

## Example

retrieve-address/main.gogo

```go
package main

import (
	"context"
	"fmt"
	"log"

	addresszen "go.addresszen.com/sdk"
)

func main() {
	client := addresszen.NewClient("ak_test")
	res, err := client.RetrieveAddress(context.Background(), "usps_Z108703633|123||1119", nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(res.Result.Line1)
	fmt.Println(res.Result.LastLine)
}
```
