Soenneker.Close.HttpClients 4.0.81

Prefix Reserved
dotnet add package Soenneker.Close.HttpClients --version 4.0.81
                    
NuGet\Install-Package Soenneker.Close.HttpClients -Version 4.0.81
                    
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="Soenneker.Close.HttpClients" Version="4.0.81" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Close.HttpClients" Version="4.0.81" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Close.HttpClients" />
                    
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 Soenneker.Close.HttpClients --version 4.0.81
                    
#r "nuget: Soenneker.Close.HttpClients, 4.0.81"
                    
#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 Soenneker.Close.HttpClients@4.0.81
                    
#: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=Soenneker.Close.HttpClients&version=4.0.81
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Close.HttpClients&version=4.0.81
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Close.HttpClients

Provides a reusable HttpClient configured for the Close CRM API and dependency injection.

Installation

dotnet add package Soenneker.Close.HttpClients

API-key configuration

{
  "Close": {
    "ApiKey": "<Close API key>",
    "ClientBaseUrl": "https://api.close.com/api/v1"
  }
}

Close:ApiKey is required; the base URL above is the default. The client applies Close's required HTTP Basic authorization by encoding the API key as the username with an empty password. See Close's API-key authentication documentation.

OAuth or custom authorization

Override the header template when Close:ApiKey contains an OAuth access token:

{
  "Close": {
    "ApiKey": "<OAuth access token>",
    "AuthHeaderName": "Authorization",
    "AuthHeaderValueTemplate": "Bearer {token}"
  }
}

{token} is replaced with the configured value. AuthHeaderName defaults to Authorization.

Keep API keys and OAuth tokens in a secret provider rather than source control or checked-in settings files.

Registration

using Microsoft.Extensions.DependencyInjection;
using Soenneker.Close.HttpClients.Registrars;

services.AddCloseOpenApiHttpClientAsSingleton();

AddCloseOpenApiHttpClientAsScoped() creates one wrapper and cached client per dependency-injection scope.

Usage

using Soenneker.Close.HttpClients.Abstract;

public sealed class CloseProfileClient
{
    private readonly ICloseOpenApiHttpClient _closeHttpClient;

    public CloseProfileClient(ICloseOpenApiHttpClient closeHttpClient)
    {
        _closeHttpClient = closeHttpClient;
    }

    public async ValueTask<string> GetCurrentUser(
        CancellationToken cancellationToken)
    {
        HttpClient client = await _closeHttpClient.Get(cancellationToken);

        using HttpResponseMessage response = await client.GetAsync(
            "/api/v1/me/",
            cancellationToken);

        response.EnsureSuccessStatusCode();
        return await response.Content.ReadAsStringAsync(cancellationToken);
    }
}

For a typed request-builder API, use this package through Soenneker.Close.OpenApiClientUtil.

Lifecycle and behavior

  • Get returns the same HttpClient for the lifetime of the wrapper.
  • Do not dispose the returned client. Let dependency injection dispose ICloseOpenApiHttpClient and its cache entry.
  • Configuration and credentials are captured when the client is first created. Recreate the owning scope or application instance after rotating them.
  • The cancellation token passed to Get applies to initialization. Pass a token separately to each HTTP operation.
  • Non-success responses remain ordinary HttpResponseMessage instances until the caller inspects them or calls EnsureSuccessStatusCode.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.Close.HttpClients:

Package Downloads
Soenneker.Close.OpenApiClientUtil

A thread-safe utility for obtaining Close's OpenApiClient singleton.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.81 78 9/17/2026
4.0.80 52 9/16/2026
4.0.79 61 9/16/2026
4.0.78 56 9/16/2026
4.0.77 45 9/16/2026
4.0.76 45 9/15/2026
4.0.74 155 9/13/2026
4.0.73 101 9/13/2026
4.0.72 109 9/13/2026
4.0.71 103 9/13/2026
4.0.69 96 9/12/2026
4.0.68 131 9/12/2026
4.0.67 136 9/9/2026
4.0.66 103 9/9/2026
4.0.65 100 9/8/2026
4.0.64 143 9/8/2026
4.0.63 107 9/8/2026
4.0.62 112 9/7/2026
4.0.61 107 9/7/2026
4.0.60 105 9/7/2026
Loading failed