# searchSDK for C# / .NET

.NET 10. 14 normalized web-search adapters and 493 retained native bindings across 13 providers; gateway client.

Canonical: https://searchsdk.dev/docs/sdks/dotnet
Markdown: https://searchsdk.dev/docs/sdks/dotnet.md

<a id="install"></a>

## Install from source

Package: `SearchSdk`, version `0.1.0-alpha.1`. This is an alpha source/local-artifact installation. No public registry release or release tag is assumed.

**Get the source**

```bash
git clone https://github.com/Belweave/searchSDK.git
cd searchSDK
# Record this revision with your application's dependency lock.
git rev-parse HEAD
```

**Build or install the local package**

```bash
dotnet pack packages/dotnet/src/SearchSdk/SearchSdk.csproj -c Release -o .local/nuget /m:2

# In your .NET 10 application:
dotnet add package SearchSdk --version 0.1.0-alpha.1 --source /absolute/path/searchSDK/.local/nuget
```

This creates and consumes a local NuGet artifact. No public NuGet release is assumed. The SDK uses HttpClient and System.Text.Json with no runtime NuGet dependencies.

<a id="first-search"></a>

## Make a server-side search

Set provider keys in your application's server environment or secret store. The example below makes a real provider request when invoked and can incur charges. Use the package's fixture consumer for a key-free check.

**Program.cs**

```csharp
using SearchSdk;

var key = Environment.GetEnvironmentVariable("EXA_API_KEY")
    ?? throw new InvalidOperationException("EXA_API_KEY is required");
using var transport = new SearchTransport(new() {
    Timeout = TimeSpan.FromSeconds(10)
});
var search = new SearchClient(new NormalizedProvider("exa", key, transport));
var response = await search.SearchAsync(
    new SearchRequest("SQLite write concurrency", Limit: 3),
    CancellationToken.None);
foreach (var result in response.Results)
    Console.WriteLine(result.Url);
```

Set EXA_API_KEY on your server and run dotnet run. In a service, pass the request's CancellationToken instead of CancellationToken.None. The caller owns the transport lifetime.

<a id="scope"></a>

## Supported surface and limits

14 normalized web-search adapters and 493 retained native bindings across 13 providers; gateway client.

- NativeAOT and trimming are unverified. Only net10.0 is targeted.
- No successful-result cache or in-flight deduplication in this alpha.

Preserve result order, provider-native scores and source provenance. Unknown usage is not zero cost. Cancellation and deadlines cannot undo a request already accepted by a remote system or guarantee exactly-once effects.

<a id="verify"></a>

## Verify without provider keys

**Repository checkout · local checks**

```bash
packages/dotnet/scripts/verify.sh
```

Locked .NET 10 Release build, 5,126 assertions and a fresh consumer installed from the NuGet artifact.

These are deterministic contract and artifact checks. They do not establish live-provider or account-entitlement verification. Read the package README for precise commands, dependencies and runtime coverage.

<a id="next"></a>

## Continue in your language

- [C# / .NET package reference](https://github.com/Belweave/searchSDK/tree/main/packages/dotnet#readme): Complete API, errors, streaming, packaging and platform boundaries.
- [Compare SDKs](https://searchsdk.dev/docs/sdks)
- [Choose a provider](https://searchsdk.dev/docs/providers)
