Postio.Sdk 0.1.1

dotnet add package Postio.Sdk --version 0.1.1
                    
NuGet\Install-Package Postio.Sdk -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Postio.Sdk" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Postio.Sdk" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Postio.Sdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Postio.Sdk --version 0.1.1
                    
#r "nuget: Postio.Sdk, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Postio.Sdk@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Postio.Sdk&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Postio.Sdk&version=0.1.1
                    
Install as a Cake Tool

Postio .NET SDK

NuGet .NET License: MIT

.NET SDK for the Postio API — UK address, email, and phone validation. Backed by Royal Mail PAF and Ordnance Survey. Async-first via HttpClient, immutable record types, source-only System.Text.Json.

Install

dotnet add package Postio.Sdk

Targets net8.0+.

30-second example

using Postio.Sdk;

using var client = new PostioClient("pk_live_...");  // or read POSTIO_API_KEY env

var result = await client.Address.SearchAsync("downing street");
foreach (var hit in result.Results)
    Console.WriteLine($"{hit.Udprn}: {hit.Suggestion}");

Console.WriteLine($"request id: {result.Meta.RequestId}");

API

Method Returns
client.Address.SearchAsync(q, maxResults?) AddressSearchEnvelope
client.Address.PostcodeAsync(postcode, maxResults?) AddressPostcodeEnvelope
client.Address.UdprnAsync(udprn) AddressUdprnEnvelope
client.Email.ValidateAsync(address) EmailEnvelope
client.Phone.ValidateAsync(number) PhoneEnvelope
client.ConnectAsync() ConnectSuccess

Every method takes an optional CancellationToken. All return types are immutable records.

Errors

Every non-2xx response throws a typed exception. PostioException is the base; subclasses match HTTP status:

try
{
    await client.Address.PostcodeAsync("not-a-postcode");
}
catch (PostioInvalidKeyException e)         { /* 401 */ }
catch (PostioOutOfCreditException e)        { /* 402 */ }
catch (PostioRateLimitException e)          { /* 429 — e.RetryAfter */ }
catch (PostioValidationException e)         { /* 400 / 422 */ }
catch (PostioServerException e)             { /* 5xx */ }
catch (PostioException e)
{
    Console.WriteLine($"{e.Status} {e.ErrorCode} ({e.RequestId}): {e.Details}");
}

Every exception carries Status, ErrorCode, Details, RequestId, and the raw Envelope.

Configuration

var client = new PostioClient(new PostioClientOptions
{
    ApiKey         = "pk_live_...",
    BaseUrl        = "https://api.postio.co.uk/v1",       // default
    Timeout        = TimeSpan.FromSeconds(10),             // default
    Retries        = 2,                                    // 0 disables
    RetryBaseDelay = TimeSpan.FromMilliseconds(500),
    RetryCapDelay  = TimeSpan.FromSeconds(8),
});
client.GetType();  // pretend this isn't here

// Or inject your own HttpClient (proxies, custom handlers, IHttpClientFactory):
using var http = new HttpClient();
using var c = new PostioClient(options, http);

Default retry policy: 2 retries on 408/409/429/5xx + network/timeout, exponential backoff with full jitter (500ms → 8s cap).

ASP.NET Core / DI

Register once via IHttpClientFactory:

builder.Services.AddHttpClient("postio");
builder.Services.AddSingleton(sp =>
{
    var http = sp.GetRequiredService<IHttpClientFactory>().CreateClient("postio");
    return new PostioClient(new PostioClientOptions
    {
        ApiKey = builder.Configuration["Postio:ApiKey"],
    }, http);
});

License

MIT — see LICENSE.

Postio is a trading name of Onno Group Limited, registered in England & Wales (company no. 08622799). Registered office: Suite 22 Trym Lodge, 1 Henbury Road, Westbury-On-Trym, Bristol BS9 3HQ.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 101 5/2/2026
0.1.0 95 5/2/2026