# .NET

Use the Kirora HTTP API from .NET while the official client is planned.

The official .NET client is planned and has no announced release date. Until it is available, use the HTTP API with the example below. The NuGet package name will be confirmed when the client is released.

## What it will cover

The .NET client will follow the [SDK conformance](/docs/api/sdk-conformance) checklist and copy the shape of the [Node.js reference library](/docs/sdks/node): one namespace per API tag and one async method per `operationId` in `PascalCase` (`client.Contacts.IdentifyAsync(...)`, `client.Events.TrackAsync(...)`), a single exception carrying the API's `Code`, bounded retries with jitter on 429 and 5xx, support for `IHttpClientFactory` and a caller-supplied `HttpClient`, `IAsyncEnumerable` pagination, `CancellationToken` on every call, caller-supplied idempotency keys, and a constant-time webhook verifier.

## Use the HTTP API today

Call the API directly with your key as a bearer token, using `HttpClient` (.NET 8 or later). [`trackEvent`](/docs/api/reference/trackEvent) requires an `Idempotency-Key`; derive it from your own order or event id so a retry is recorded once. To track an event:

```csharp
using System.Net.Http.Headers;
using System.Net.Http.Json;

using var http = new HttpClient { BaseAddress = new Uri("https://api.kirora.io") };
http.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("KIRORA_API_KEY"));

using var request = new HttpRequestMessage(HttpMethod.Post, "/v1/events/track")
{
    Content = JsonContent.Create(new
    {
        externalId = "cust_1042",
        eventName = "Order Completed",
        properties = new { orderId = "1042", total = 42.5, currency = "USD" },
    }),
};
request.Headers.Add("Idempotency-Key", "order-1042-completed");

using var response = await http.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");
```

Create one `HttpClient` and reuse it (or use `IHttpClientFactory`), rather than one per request. See [Errors](/docs/api/errors) and [Idempotency](/docs/api/idempotency) before adding retries.