> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Install the API clients

> Learn how to install Algolia's (legacy) API clients.

export const Legacy = ({title, href}) => {
  return <Note>

    This page documents an earlier version of the API client.
    For the latest version, see <a href={href}>{title}</a>.

    </Note>;
};

export const sdkVersions = {
  csharp: {
    v7: "7.44.0",
    v6: "6.17.0",
    v5: "5.3.1",
    v4: "4.0.0",
    v3: "3.7.3",
    v2: "2.5.1",
    v1: "1.16.0"
  },
  dart: {
    v1: "1.50.0"
  },
  go: {
    v4: "4.41.0",
    v3: "3.32.1",
    v2: "2.28.0",
    v1: "1.5.0"
  },
  java: {
    v4: "4.40.0",
    v3: "3.16.14",
    v2: "2.23.0"
  },
  javascript: {
    v5: "5.54.0",
    v4: "4.27.0",
    v3: "3.35.1",
    v2: "2.9.7"
  },
  kotlin: {
    v3: "3.43.0",
    v2: "2.1.14",
    v1: "1.13.0"
  },
  php: {
    v4: "4.45.0",
    v3: "3.4.2",
    v2: "2.8.0",
    v1: "1.28.1"
  },
  python: {
    v4: "4.42.0",
    v3: "3.0.0",
    v2: "2.6.3",
    v1: "1.20.0"
  },
  ruby: {
    v3: "3.41.0",
    v2: "2.3.4",
    v1: "1.27.5"
  },
  scala: {
    v2: "2.42.0",
    v1: "1.45.2"
  },
  swift: {
    v9: "9.44.0",
    v8: "8.21.0",
    v7: "7.0.5",
    v6: "6.3.0",
    v5: "5.4.0",
    v4: "4.8.2",
    v3: "3.2.1",
    v2: "2.2.1",
    v1: "1.4.2"
  }
};

<Legacy title="Install API clients (current)" href="/doc/libraries/sdk/install" />

<Tabs>
  <Tab title="C#">
    **Latest version:** {sdkVersions.csharp.v6}

    The C# API client v6 supports [.NET Standard](https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-1) versions 1.3 to 2.1.

    To install **version 6** of the C#/.NET API clients,
    add the `Algolia.Search` package from [NuGet](https://www.nuget.org/packages/Algolia.Search/)
    as a dependency to your project.
    For example:

    ```sh Command line icon=square-terminal theme={"system"}
    dotnet add package Algolia.Search --version 6.*
    ```

    The C#/.NET API clients are open source.
    View the source code on [GitHub](https://github.com/algolia/algoliasearch-client-csharp).
  </Tab>

  <Tab title="Go">
    **Latest version:** {sdkVersions.go.v3}

    To install **version 3** of the Go API clients,
    add the `algoliasearch-client-go/v3` package as a dependency to your module.

    ```sh Command line icon=square-terminal theme={"system"}
    go get github.com/algolia/algoliasearch-client-go/v3
    ```

    The Go API clients are open source.
    View the source code on [GitHub](https://github.com/algolia/algoliasearch-client-go).
  </Tab>

  <Tab title="Java">
    **Latest version:** {sdkVersions.java.v3}

    The Java API client v3 requires Java 1.8 or later
    for all modules except `algoliasearch-java-net`,
    which requires Java 11 or later.
    Your JDK must support TLS v1.2 or later.

    The Java API clients are open source.
    View the source code on [GitHub](https://github.com/algolia/algoliasearch-client-java).

    ### Maven

    Add the following dependencies to your `pom.xml` file.
    **For Java 11 and later**, you can use the native HTTP client.

    ```xml highlight={8} theme={"system"}
    <dependency>
      <groupId>com.algolia</groupId>
      <artifactId>algoliasearch-core</artifactId>
      <version>VERSION</version>
    </dependency>
    <dependency>
      <groupId>com.algolia</groupId>
      <artifactId>algoliasearch-java-net</artifactId>
      <version>VERSION</version>
    </dependency>
    ```

    **For Java 8 and later**, use the Apache HTTP client.

    ```xml highlight={8} theme={"system"}
    <dependency>
      <groupId>com.algolia</groupId>
      <artifactId>algoliasearch-core</artifactId>
      <version>VERSION</version>
    </dependency>
    <dependency>
      <groupId>com.algolia</groupId>
      <artifactId>algoliasearch-apache</artifactId>
      <version>VERSION</version>
    </dependency>
    ```

    Replace `VERSION` with the version you want to install.
    You can find the available releases on [Maven Central](https://central.sonatype.com/artifact/com.algolia/algoliasearch-core).

    You can also add all dependencies as a single **uber-JAR** (Java 8 and later):

    ```xml highlight={3} theme={"system"}
    <dependency>
      <groupId>com.algolia</groupId>
      <artifactId>algoliasearch-apache-uber</artifactId>
      <version>VERSION</version>
    </dependency>
    ```

    ### Gradle

    Add the following dependencies to your `build.gradle` file.

    **For Java 11 and later**,
    you can use the native HTTP client with Algolia:

    ```groovy highlight={4} theme={"system"}
    dependencies {
      // ...
      implementation 'com.algolia:algoliasearch-core:VERSION'
      implementation 'com.algolia:algoliasearch-java-net:VERSION'
    }
    ```

    **For Java 8 and later**,
    use the Algolia Java API client with the Apache HTTP client:

    ```groovy highlight={4} theme={"system"}
    dependencies {
      // ...
      implementation 'com.algolia:algoliasearch-core:VERSION'
      implementation 'com.algolia:algoliasearch-apache:VERSION'
    }
    ```

    ### Manual installation

    If you don't use Maven or Gradle, you can download all JAR files:

    * [`algoliasearch-core`](https://repo1.maven.org/maven2/com/algolia/algoliasearch-core/)
    * [`algoliasearch-apache`](https://repo1.maven.org/maven2/com/algolia/algoliasearch-apache/)
    * [`algoliasearch-core-uber`](https://repo1.maven.org/maven2/com/algolia/algoliasearch-core-uber/)
    * [`algoliasearch-apache-uber`](https://repo1.maven.org/maven2/com/algolia/algoliasearch-apache-uber/)
    * [`algoliasearch-java-net`](https://repo1.maven.org/maven2/com/algolia/algoliasearch-java-net/)

    ### Adobe Experience Manager and other OSGi platforms

    OSGi platforms like Adobe Experience Manager require a single uber JAR as a dependency.
    If you want to integrate Algolia into such a platform, add `algoliasearch-apache-uber` as a dependency.
  </Tab>

  <Tab title="JavaScript">
    **Latest version:** {sdkVersions.javascript.v4}

    To install **version 4** of the JavaScript API clients,
    add the `algoliasearch` package as a dependency to your project.

    <CodeGroup>
      ```sh npm theme={"system"}
      npm install algoliasearch@4
      ```

      ```sh yarn theme={"system"}
      yarn add algoliasearch@4
      ```

      ```sh pnpm theme={"system"}
      pnpm add algoliasearch@4
      ```
    </CodeGroup>

    For quick prototyping or exploration,
    you can also include the algoliasearch package in a `<script>` tag from a content delivery network.

    <Info>
      jsDelivr is a third-party CDN.
      Algolia doesn't provide support for such third-party services.
    </Info>

    ```html HTML icon=code-xml theme={"system"}
    <!-- search only version -->
    <script
      src="https://cdn.jsdelivr.net/npm/algoliasearch@4.25.2/dist/algoliasearch-lite.umd.js"
      integrity="sha256-yi498VwhoNKaHUihPJ/PZvhJghXYiGgvQG8/P8BgddQ="
      crossorigin="anonymous"
    ></script>

    <!-- default version -->
    <script
      src="https://cdn.jsdelivr.net/npm/algoliasearch@4.25.2/dist/algoliasearch.umd.js"
      integrity="sha256-ex4R2M5mIvkgno0J1Z8F3cNBhUCzpRvYX8pxsX8+JUI="
      crossorigin="anonymous"
    ></script>
    ```

    For including **ES6 modules**, use:

    ```html HTML icon=code-xml theme={"system"}
    <script type="module">
    // search only version
    import algoliasearch from 'https://cdn.jsdelivr.net/npm/algoliasearch@4.25.2/dist/algoliasearch-lite.esm.browser.js';

    // default version
    import algoliasearch from 'https://cdn.jsdelivr.net/npm/algoliasearch@4.25.2/dist/algoliasearch.esm.browser.js';
    </script>
    ```

    The JavaScript API clients are open source.
    View the source code on [GitHub](https://github.com/algolia/algoliasearch-client-javascript).
  </Tab>

  <Tab title="Kotlin">
    **Latest version:** {sdkVersions.kotlin.v2}

    The Kotlin API clients version 2 support **Kotlin 1.6 or later**.
    The client supports both Android and JVM projects.

    To install **version 2** of the Kotlin API clients,
    add the following dependencies to your `build.gradle.kts` file:

    ```kotlin Kotlin icon=code theme={"system"}
    dependencies {
        // for Gradle version 6.0 and later
        implementation("com.algolia:algoliasearch-client-kotlin:ALGOLIA_VERSION")

        // Choose one of the following HTTP clients
        // For JVM:
        implementation("io.ktor:ktor-client-apache:KTOR_VERSION")
        implementation("io.ktor:ktor-client-java:KTOR_VERSION")
        implementation("io.ktor:ktor-client-jetty:KTOR_VERSION")
        // For JVM/Android
        implementation("io.ktor:ktor-client-okhttp:KTOR_VERSION")
        implementation("io.ktor:ktor-client-android:KTOR_VERSION")
        implementation("io.ktor:ktor-client-cio:KTOR_VERSION")
    }
    ```

    * Replace `ALGOLIA_VERSION` with the version of the Kotlin API client v2 you want to install.
      You can find the released versions on [Maven Central](https://central.sonatype.com/artifact/com.algolia/algoliasearch-client-kotlin).

    * Replace `KTOR_VERSION` with the version of the Ktor client you want to use.

    For serializing and deserializing your records,
    add the following plugin to your `build.gradle.kts` file:

    ```kotlin Kotlin icon=code theme={"system"}
    plugins {
      // Replace with latest version from:
      // https://kotlinlang.org/docs/serialization.html#add-plugins-and-dependencies
      kotlin("plugin.serialization") version "2.2.0"
    }
    ```

    The Kotlin API clients are open source.
    View the source code on [GitHub](https://github.com/algolia/algoliasearch-client-kotlin).
  </Tab>

  <Tab title="PHP">
    **Latest version:** {sdkVersions.php.v3}

    The Algolia PHP API clients version 3 support **PHP 7.2 or later**.

    To install **version 3** of the PHP API clients,
    install the `algoliasearch-client-php` package with [composer](https://getcomposer.org).

    ```sh Command line icon=square-terminal theme={"system"}
    composer require algolia/algoliasearch-client-php:^3.0
    ```

    <Columns>
      <Card icon="app-window" horizontal href="/doc/framework-integration/laravel/getting-started/introduction-to-scout-extended" title="Building Laravel apps?">
        Check the Laravel integration built on top of the PHP API client.
      </Card>

      <Card icon="app-window" horizontal href="/doc/framework-integration/symfony/getting-started/installation" title="Building Symfony apps?">
        Check the Symfony integration built on top of the PHP API client.
      </Card>
    </Columns>

    ### Manual installation

    1. [Download the client](https://github.com/algolia/algoliasearch-client-php/releases) from GitHub and unpack the archive in your project directory.
    2. Inside the root directory of the client, run `./bin/install-dependencies-without-composer`.
    3. In your code, require the `autoload.php` module in the client's root directory.

    The PHP API clients are open source.
    View the source code on [GitHub](https://github.com/algolia/algoliasearch-client-php).
  </Tab>

  <Tab title="Python">
    **Latest version:** {sdkVersions.python.v3}

    The Python API clients version 3 support **Python 3.4 or later**.

    To install **version 3** of the Python API clients,
    add the `algoliasearch` package as a dependency to your project.

    ```sh Command line icon=square-terminal theme={"system"}
    pip install algoliasearch~=3.0
    ```

    <Card icon="app-window" horizontal href="/doc/framework-integration/django/setup" title="Building Django apps?">
      Check the Django integration built on top of the Python API client.
    </Card>

    The Python API clients are open source.
    View the source code on [GitHub](https://github.com/algolia/algoliasearch-client-python).
  </Tab>

  <Tab title="Ruby">
    **Latest version:** {sdkVersions.ruby.v2}

    The Ruby API clients version 2 support **Ruby 2.2 or later**.

    To install **version 2** of the Ruby API clients,
    add the `algolia` gem as a dependency to your project:

    ```sh Command line icon=square-terminal theme={"system"}
    bundle add algolia --version'~>2.0'
    # or: gem install algolia -v '~>2.0'
    ```

    <Check>
      Be sure to install the `algolia` gem.
      The `algoliasearch` gem installs version 1 of the Ruby API clients.
      For more information, see [Update the Ruby API client](/doc/libraries/sdk/v1/upgrade/ruby).
    </Check>

    The Ruby API clients are open source.
    View the source code on [GitHub](https://github.com/algolia/algoliasearch-client-ruby).

    <Card icon="app-window" horizontal href="/doc/framework-integration/rails/getting-started/setup" title="Building Ruby on Rails apps?">
      Check the Ruby on Rails integration built on top of the Ruby API client.
    </Card>
  </Tab>

  <Tab title="Scala">
    **Latest version:** {sdkVersions.scala.v1}

    The Scala API clients version 1 support **Scala 2.13, 2.12, or 2.11**.

    With **Maven**, add the following dependency to your `pom.xml` file:

    ```xml pom.xml icon=code-xml theme={"system"}
    <dependency>
        <groupId>com.algolia</groupId>
        <artifactId>algoliasearch-scala_2.13</artifactId>
        <version>[1,)</version>
    </dependency>
    ```

    Replace `algoliasearch-scala_2.13` with `algoliasearch-scala_2.12` or `algoliasearch-scala_2.11`
    if you need to support a different Scala version.

    For snapshots, add the `sonatype` repository:

    ```xml pom.xml icon=code-xml theme={"system"}
    <repositories>
        <repository>
            <id>oss-sonatype</id>
            <name>oss-sonatype</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    ```

    With **sbt**, add the following dependency to your `build.sbt` file:

    ```txt build.sbt icon=code theme={"system"}
    libraryDependencies += "com.algolia" %% "algoliasearch-scala" % "[1.0,2.0["
    ```

    For snapshots, add the `sonatype` repository:

    ```txt build.sbt icon=code theme={"system"}
    resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
    ```

    The Scala API clients are open source.
    View the source code on [GitHub](https://github.com/algolia/algoliasearch-client-scala).
  </Tab>

  <Tab title="Swift">
    **Latest version:** {sdkVersions.swift.v8}

    The Algolia Swift API clients version 8 support Swift version 5.0 or later and supports iOS, macOS, tvOS, and watchOS platforms.

    To install **version 8** of the Swift API clients,
    add the following dependencies to your project.

    With the **Swift Package Manager**,
    add the following dependencies to your `Package.swift` file:

    ```swift Swift icon=code theme={"system"}
    let package = Package(
      dependencies: [
        .package(
          url: "https://github.com/algolia/algoliasearch-client-swift",
          from: "8.0.0"
        )
      ],
      targets: [
        // Add the client as dependency to your targets
        .executableTarget(
          name: "algolia-example",
          dependencies: [
            .product(
              name:"AlgoliaSearchClient",
              package: "algoliasearch-client-swift"
            )
          ]
        )
      ]
    )
    ```

    With **CocoaPods** add the following to your `Podfile`:

    ```ruby Podfile icon=code theme={"system"}
    pod("AlgoliaSearchClient", "~> 8.0")
    ```

    With **Carthage**, add the following to your `Cartfile`:

    ```txt Cartfile icon=code theme={"system"}
    github "algolia/algoliasearch-client-swift" ~> 8.0.0
    ```

    The Swift API clients are open source.
    View the source code on [GitHub](https://github.com/algolia/algoliasearch-client-swift).
  </Tab>
</Tabs>

## Test your installation

To test your installation,
try running a short program that adds a record to a test index,
searches your index, and prints the results.

<Steps>
  <Step title="Create account">
    If you haven't already, [create an Algolia account](https://dashboard.algolia.com/users/sign_up)
  </Step>

  <Step title="Copy code">
    Copy the following code into a new project or file.
    Replace `ALGOLIA_APPLICATION_ID` and `ALGOLIA_API_KEY` with values from your account.
    Make sure to use an API key with `addObject` and `search` permissions.

    <CodeGroup>
      ```cs C# theme={"system"}
      using System;
      using System.Linq;
      using System.Collections.Generic;
      using Algolia.Search.Clients;
      using Algolia.Search.Models.Search;

      namespace HelloAlgolia
      {
        // a simple record in your index
        class Record
        {
          public string Name { get; set; }
          public string ObjectID { get; set; }
          public override string ToString()
          {
             return $"Name: {Name}, ObjectID: {ObjectID}";
          }
        }

        class Program
        {
          static void Main(string[] args)
          {
             // Connect and authenticate with your Algolia app
             var client = new SearchClient(
                "ALGOLIA_APPLICATION_ID",
                "ALGOLIA_API_KEY"
             );

             // Create a new index and add a record
             var index = client.InitIndex("test_index");
             var record = new Record{ ObjectID = "1", Name = "test_record" };
             index.SaveObject(record).Wait();

             // Search the index and print the results
             var results = index.Search<Record>(new Query("test_record"));
             Console.WriteLine(results.Hits.ElementAt(0).ToString());
          }
        }
      }
      ```

      ```go Go theme={"system"}
      // helloAlgolia.go
      package main

      import (
      	"fmt"

      	"github.com/algolia/algoliasearch-client-go/v3/algolia/search"
      )

      type Record struct {
      	ObjectID string `json:"objectID"`
      	Name     string `json:"name"`
      }

      func main() {
      	// Connect and authenticate with your Algolia app
      	client := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")

      	// Create a new index and add a record
      	index := client.InitIndex("test_index")

      	record := Record{
      		ObjectID: "1",
      		Name:     "test_record",
      	}

      	resSave, err := index.SaveObject(record)
      	if err != nil {
      		panic(err)
      	}
      	resSave.Wait()

      	// Search the index and print the results
      	results, err := index.Search("test_record")
      	if err != nil {
      		panic(err)
      	}

      	var records []Record
      	results.UnmarshalHits(&records)
      	fmt.Println(records)
      }
      ```

      ```java Java theme={"system"}
      // File: Record.java
      import java.io.Serializable;

      public class Record implements Serializable {
         private String name;
         private String objectID;

         public Record() {}

         public Record(String name, String objectID) {
            this.name = name;
            this.objectID = objectID;
         }

         @Override
         public String toString() {
            return String.format("Name: %s, objectID: %s", this.name, this.objectID);
         }
         public String getName() { return name; }
         public void setName(String name) { this.name = name; }
         public String getObjectID() { return objectID; }
         public void setObjectID(String objectID) { this.objectID = objectID; }
      }

      // File: Program.java
      import com.algolia.search.DefaultSearchClient;
      import com.algolia.search.SearchClient;
      import com.algolia.search.SearchIndex;
      import com.algolia.search.models.indexing.Query;
      import com.algolia.search.models.indexing.SearchResult;

      public class Program {
         public static void main(String[] args) {
            // Connect and authenticate with your Algolia app
            SearchClient client = DefaultSearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");

            // Create a new index and add a record (using the `Record` class)
            SearchIndex<Record> index = client.initIndex("test_index", Record.class);
            Record record = new Record("test_record", "1");
            index.saveObject(record).waitTask();

            // Search the index and print the results
            SearchResult<Record> results = index.search(new Query("test_record"));
            System.out.println(results.getHits().get(0));
         }
      }
      ```

      ```js JavaScript theme={"system"}
      // helloAlgolia.mjs
      import algoliasearch from "algoliasearch";

      const appID = "ALGOLIA_APPLICATION_ID";
      const apiKey = "ALGOLIA_API_KEY";

      // Connect and authenticate with your Algolia app
      const client = algoliasearch(appID, apiKey);

      // Create a new index and add a record
      const index = client.initIndex("test_index");
      const record = { objectID: 1, name: "test_record" };

      await index.saveObject(record).wait();

      // Search the index for "test" and print the results
      const { hits } = await index.search("test");
      console.log(JSON.stringify(hits[0]));
      ```

      ```kotlin Kotlin theme={"system"}
      import com.algolia.search.client.ClientSearch
      import com.algolia.search.helper.deserialize
      import com.algolia.search.model.APIKey
      import com.algolia.search.model.ApplicationID
      import com.algolia.search.model.IndexName
      import com.algolia.search.model.ObjectID
      import com.algolia.search.model.indexing.Indexable
      import com.algolia.search.model.search.Query
      import kotlinx.serialization.Serializable

      // A simple record for your index
      @Serializable
      private data class Record(
         val name: String,
         override val objectID: ObjectID
      ) : Indexable

      suspend fun main() {
         // Connect and authenticate with your Algolia app
         val client = ClientSearch(
            applicationID = ApplicationID("undefined"),
            apiKey = APIKey("undefined")
         )

         // Create a new index and add a record (using the `Record` class)
         val index = client.initIndex(indexName = IndexName("test_index"))
         val record = Record("test_record", ObjectID("1"))

         index.run {
            saveObject(Record.serializer(), record).wait()
         }

         // Search the index and print the results
         val response = index.run {
            search(Query("test_record"))
         }
         val results: List<Record> = response.hits.deserialize(Record.serializer())
         println(results[0])
      }
      ```

      ```php PHP theme={"system"}
      <?php
      // helloAlgolia.php
      require __DIR__."/vendor/autoload.php";
      use Algolia\AlgoliaSearch\SearchClient;

      // Connect and authenticate with your Algolia app
      $client = SearchClient::create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");

      // Create a new index and add a record
      $index = $client->initIndex("test_index");
      $record = ["objectID" => 1, "name" => "test_record"];
      $index->saveObject($record)->wait();

      // Search the index and print the results
      $results = $index->search("test_record");
      var_dump($results["hits"][0]);
      ```

      ```python Python theme={"system"}
      # hello_algolia.py
      from algoliasearch.search_client import SearchClient

      # Connect and authenticate with your Algolia app
      client = SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")

      # Create a new index and add a record
      index = client.init_index("test_index")
      record = {"objectID": 1, "name": "test_record"}
      index.save_object(record).wait()

      # Search the index and print the results
      results = index.search("test_record")
      print(results["hits"][0])
      ```

      ```ruby Ruby theme={"system"}
      # hello_algolia.rb
      require "algolia"

      # Connect and authenticate with your Algolia app
      client = Algolia::Search::Client.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")

      # Create a new index and add a record
      index = client.init_index("test_index")
      record = {:"objectID" => 1, :"name" => "test_record"}
      index.save_object(record).wait

      # Search the index and print the results
      results = index.search("test_record")
      puts(results[:hits][0])
      ```

      ```scala Scala theme={"system"}
      package org.example

      import algolia.AlgoliaClient
      import algolia.AlgoliaDsl._
      import algolia.objects.Query

      import scala.concurrent.Await._
      import scala.concurrent.ExecutionContext.Implicits.global
      import scala.concurrent.Future
      import scala.concurrent.duration.Duration
      import scala.util.Success

      // A simple record for your index
      case class Record(name: String, objectID: String)

      object Program extends App {
         // Connect and authenticate with your Algolia app
         val client = new AlgoliaClient("undefined", "undefined")

         // Create a new index and add a record
         val indexing = client.execute(index into "test_index" `object` Record("test_record", "1"))
         ready(indexing, Duration.Inf)

         // Search the index and print the results
         val searchFuture: Future[Seq[Record]] = client
            .execute { search into "test_index" query Query(query = Some("test_record")) }
            .map { search => search.as[Record] }

         searchFuture onComplete {
            case Success(results) => println(results(0))
         }
      }
      ```

      ```swift Swift theme={"system"}
      // main.swift
      import AlgoliaSearchClient

      // A simple record for your index
      struct Record: Encodable {
         let objectID: ObjectID
         let name: String
      }

      // Add the client to the dependencies of your targets
      let client = SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY")
      let index = client.index(withName: "test_index")

       // Create a new index and add a record
      let record: Record = .init(objectID: "1", name: "test_record")
      let indexing: ()? = try? index.saveObject(record).wait()

       // Search the index and print the results
      let results = try index.search(query: "test_record")
      print(results.hits[0])
      ```
    </CodeGroup>

    <Tip>
      In production, use environment variables for your credentials.
    </Tip>
  </Step>

  <Step title="Run code">
    Run the code, depending on your development environment.

    <CodeGroup>
      ```sh C# theme={"system"}
      # For example:
      dotnet run
      ```

      ```sh Go theme={"system"}
      go run helloAlgolia.go
      ```

      ```txt Java theme={"system"}
      Depending on your development environment,
      build and run the project.
      ```

      ```sh JavaScript theme={"system"}
      node helloAlgolia.mjs
      ```

      ```txt Kotlin theme={"system"}
      Depending on your development environment,
      build and run the project.
      ```

      ```sh PHP theme={"system"}
      php helloAlgolia.php
      ```

      ```sh Python theme={"system"}
      python hello_algolia.py
      ```

      ```sh Ruby theme={"system"}
      ruby hello_algolia.rb
      ```

      ```sh Scala theme={"system"}
      sbt run
      ```

      ```sh Swift theme={"system"}
      swift run
      ```
    </CodeGroup>

    If the command is successful, you should see:

    <CodeGroup>
      ```txt C# theme={"system"}
      Name: test_record, ObjectID: 1
      ```

      ```txt Go theme={"system"}
      {1 test_record}
      ```

      ```txt Java theme={"system"}
      Name: test_record, objectID: 1
      ```

      ```txt JavaScript theme={"system"}
      {
         name: 'test_record',
         objectID: '1',
         _highlightResult: {
          // ...
      }
      ```

      ```txt Kotlin theme={"system"}
      Record(name=foo, objectID=1)
      ```

      ```txt PHP theme={"system"}
      array(3) {
         ["name"]=>
         string(11) "test_record"
         ["objectID"]=>
         string(1) "1"
         ["_highlightResult"]=>
         ... }
      ```

      ```txt Python theme={"system"}
      {'name': 'test_record', 'objectID': '1', '_highlightResult': ...}
      ```

      ```txt Ruby theme={"system"}
      {:name=>"test_record", :objectID=>"1", :_highlightResult=>...}
      ```

      ```txt Scala theme={"system"}
      Record(test_record, 1)
      ```

      ```txt Swift theme={"system"}
      Hit<JSON>(objectID: 1, object: {
        name: "test_record",
        objectID: "1",
      }
      ```
    </CodeGroup>
  </Step>
</Steps>
