Legichain 0.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Legichain --version 0.2.0
                    
NuGet\Install-Package Legichain -Version 0.2.0
                    
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="Legichain" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Legichain" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Legichain" />
                    
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 Legichain --version 0.2.0
                    
#r "nuget: Legichain, 0.2.0"
                    
#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 Legichain@0.2.0
                    
#: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=Legichain&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Legichain&version=0.2.0
                    
Install as a Cake Tool

Legichain .NET SDK

Official .NET client for the Legichain AML, KYC and Travel Rule API.

dotnet add package Legichain --version 0.1.0

NuGet License

  • .NET 8 + .NET Standard 2.0 (works on .NET Framework 4.6.1+)
  • System.Net.Http.HttpClient + System.Text.Json — no third-party deps on net8
  • Typed LegichainException carries the full RFC 7807 problem body
  • HMAC-SHA256 webhook verifier (constant-time compare)

Get an API key

Sign up at https://legichain.com — the Free plan ships with 1 RPS and 300 monthly credits, no card required. Once signed in:

panel.legichain.com → Settings → API Keys → New key

Keys look like lc_live_<22>.sk_live_<44> (production) or lc_test_<22>.sk_test_<44> (test mode — never spends credits, safe in CI). Store the secret half in your secret manager — the Argon2 hash means a lost key can't be recovered. See the full API guide for plans, rate limits and reference docs.

Quick start

using Legichain;
using Legichain.Models;

using var lc = new LegichainClient(Environment.GetEnvironmentVariable("LEGICHAIN_API_KEY")!);

try
{
    var r = await lc.ScreenPersonAsync(
        new PersonQuery("Vladimir Putin", Country: "RU", BirthDate: "1952-10-07"));

    switch (r.Summary.Recommendation)
    {
        case Recommendation.Block:  DenyOnboarding(customerId);                       break;
        case Recommendation.Review: QueueForCompliance(customerId, r.ScreeningId);    break;
        case Recommendation.Clear:  ApproveOnboarding(customerId);                    break;
    }

    Console.WriteLine($"{r.CostCredits} credits spent; {r.CreditsRemaining} remaining");
}
catch (LegichainException e)
{
    // RFC 7807 — branch on stable codes
    switch (e.Code)
    {
        case "BIL_001_INSUFFICIENT_CREDITS": TopUp();           break;
        case "RL_001_RATE_LIMITED":          await Backoff();   break;
        case "AUTH_002_INVALID_TOKEN":       RotateKey();       break;
        default:                             Log(e.Status, e.Detail); break;
    }
}

Company + crypto wallet

var company = await lc.ScreenCompanyAsync(
    new CompanyQuery("Rosneft Oil Company", Country: "RU"));

var wallet = await lc.ScreenCryptoAsync(
    new CryptoQuery("0x098B716B8Aaf21512996dC57EB0615e2383E2f96"));

Batch (sync + async)

var items = new object[]
{
    new PersonQuery("Acme Trading GmbH"),
    new CryptoQuery("TVj7RNVH...", "tron"),
    new PersonQuery("Maria Lopez", "ES"),
};

// up to 200 items synchronously
var results = await lc.ScreenBatchAsync(items);

// async — result delivered to your webhook
var job  = await lc.ScreenBatchAsyncJobAsync(items, webhookUrl: "https://you.example.com/webhooks/legichain");
var done = await lc.GetJobAsync(job.JobId);

PDF reports

byte[] pdf = await lc.ReportWalletAsync(new CryptoQuery(
    "0x6c0bD2BB04Fda9CBfeBb8DC1208Db32a0F8a4Edd", "eth"));
await File.WriteAllBytesAsync("wallet.pdf", pdf);

Idempotency

await lc.ScreenPersonAsync(
    new PersonQuery("Maria Lopez"),
    idempotencyKey: "onboarding-2026-05-20-7f3c");
// Re-running the same key within 24h returns the cached response.

Webhook verification (ASP.NET Core)

using Legichain;

app.MapPost("/webhooks/legichain", async (HttpContext ctx) =>
{
    using var ms = new MemoryStream();
    await ctx.Request.Body.CopyToAsync(ms);
    var body = ms.ToArray();

    var ok = Webhooks.VerifySignature(
        body,
        ctx.Request.Headers["Legichain-Signature"]!,
        Environment.GetEnvironmentVariable("LEGICHAIN_WEBHOOK_SECRET")!);

    if (!ok) return Results.Unauthorized();
    // ... handle the event
    return Results.Ok();
});

Configuration

using var lc = new LegichainClient(
    apiKey: key,
    baseUrl: "https://staging.api.legichain.com",
    requestTimeout: TimeSpan.FromSeconds(60),
    defaultHeaders: new Dictionary<string, string> { ["X-My-App"] = "billing-svc" });

Inject your own HttpClient (e.g. one that goes through a corporate proxy or uses IHttpClientFactory):

var handler = new HttpClientHandler
{
    Proxy    = new WebProxy("http://proxy.bank.tr:8080"),
    UseProxy = true,
};
var http = new HttpClient(handler);

using var lc = new LegichainClient(key, httpClient: http);

Reference

Method Endpoint
lc.ScreenPersonAsync(q) POST /v1/screen/person
lc.ScreenCompanyAsync(q) POST /v1/screen/company
lc.ScreenCryptoAsync(q) POST /v1/screen/crypto
lc.ScreenBatchAsync(items) POST /v1/screen/batch
lc.ScreenBatchAsyncJobAsync(items) POST /v1/screen/batch/async
lc.GetJobAsync(jobId) GET /v1/screen/jobs/{id}
lc.ReportWalletAsync(q) POST /v1/reports/walletbyte[] (PDF)
lc.ReportPersonAsync(q) POST /v1/reports/personbyte[] (PDF)
lc.ReportCompanyAsync(q) POST /v1/reports/companybyte[] (PDF)
lc.GetStatusAsync() GET /v1/status

Versioning & support

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.0.0 40 9/20/2026
0.2.0 135 5/27/2026
0.1.0 113 5/21/2026