Skip to main content
Keep your C# API client up to date to benefit from improvements and bug fixes. The C# API client follows semantic versioning.

Upgrade to version 6

The design of version 6 of the .NET client is almost the same as the previous version to make upgrading as smooth as possible. The names of the client and index classes changed to SearchClient and SearchIndex with similar method names. This new version is compatible with the same .NET versions as before: from .NET 4.5 to .NET Core 2.2.

Upgrade the library

With the .NET command-line tool

Command line

With the NuGet package manager console

Command line

With the NuGet website

Download the package on NuGet.org.

Client instantiation

Replace the instantiation of the client as shown below.
C#

Configure the client

You can instantiate all clients with configuration objects. This is useful to change how a client behaves. You can configure:
  • BatchSize to customize the size of batch for save methods
  • Hosts to set custom hosts
You can also add entries in the DefaultHeaders dictionary to set some HTTP Headers for every request. Example:
C#

Analytics instantiation

Similarly, you need to update the way you initialize the Analytics client.
C#

New methods

The client has some new methods to help implement commonly used features. These features were always available but required either a deeper understanding or custom code.
  • CopySettings: lets you copy settings between indices.
  • CopySynonyms: lets you copy synonyms between indices.
  • CopyRules: lets you copy rules between indices.
  • ReplaceAllObjects: lets you add new objects to an index and remove all existing ones, atomically.
  • ReplaceAllSynonyms: lets you add new synonyms to an index and remove all existing ones, atomically.
  • ReplaceAllRules: lets you add new Rules to an index and remove all existing ones, atomically.
  • AccountClient.CopyIndex: lets you copy an index between Algolia applications.
  • CustomRequest: lets you request the Algolia API with custom parameters, URLs, and headers.

Review breaking changes

JObject and types

The v6 of the client, in contrast to the previous one, is typed for every method. This implies a breaking change on most methods. You can still save and retrieve your records with JObject. For Settings, Rules, APIkeys, and Synonyms, you need to convert your JObject to a class.

How to export JObject to new types

Example with settings:
C#
This snippet also works for all other classes in the client, such as Rules, APIkeys, and Synonyms.

List of method changes

List of return type changes

AlgoliaClient/SearchClient

AlgoliaClient/AnalyticsClient

Index/SearchIndex

Last modified on March 23, 2026