# C# SDK Migration

## Overview

The [GetAddress .NET SDK](https://www.nuget.org/packages/getAddress.Sdk) can be used with Ideal Postcodes via our compatibility API. Update the base URL and API key to continue using your existing code.

## Quick Start

### 1. Get an API Key

Create an API key at [account.ideal-postcodes.co.uk](https://account.ideal-postcodes.co.uk)

### 2. Update Configuration

Point the SDK to the Ideal Postcodes compatibility endpoint and use your new API key.

**Direct HttpClient:**

Program.cscsharp

```csharp
using System.Net.Http;
using getAddress.Sdk;

var httpClient = new HttpClient
{
    BaseAddress = new Uri("https://ga.ideal-postcodes.co.uk/")
};

// Ideal Postcodes API Keys all begin `ak_` You can leave "admin-key" as is
var apiKeys = new ApiKeys("your-ideal-postcodes-api-key", "admin-key");

var api = new Api(apiKeys, httpClient);
```

**With Dependency Injection (ASP.NET Core):**

### 3. Use as Normal

The main methods provided by the SDK are supported.

Program.cscsharp

```csharp
// Autocomplete
var findResult = await api.Find("SW1A 2AA");

var autocompleteResult = await api.Autocomplete("10 downing street");
```

All SDK methods, request parameters and response formats remain the same.

## SDK v1 (GetAddressApi)

If you're using the older `GetAddressApi` class, set the `BaseAddress` property:

Program.cscsharp

```csharp
using getAddress.Sdk;

var api = new GetAddressApi(new ApiKey("your-ideal-postcodes-api-key"));
api.BaseAddress = new Uri("https://ga.ideal-postcodes.co.uk/");
```

## Need Help?

Contact <support@ideal-postcodes.co.uk> for migration assistance.

## Next Steps

For full functionality and better performance, consider migrating to the native Ideal Postcodes API:

* [API Documentation](/docs/api.md)
* [Postcode Lookup Migration](/docs/migrate/getaddressio/postcode-lookup.md)
* [Autocomplete Migration](/docs/migrate/getaddressio/autocomplete.md)
