Skip to main content
Required ACL: editSettings

Usage

// Initialize the client
var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"));

// Call the API
var response = await client.BatchDictionaryEntriesAsync(
  Enum.Parse<DictionaryType>("Plurals"),
  new BatchDictionaryEntriesParams
  {
    ClearExistingDictionaryEntries = true,
    Requests = new List<BatchDictionaryEntriesRequest>
    {
      new BatchDictionaryEntriesRequest
      {
        Action = Enum.Parse<DictionaryAction>("AddEntry"),
        Body = new DictionaryEntry
        {
          ObjectID = "1",
          Language = Enum.Parse<SupportedLanguage>("En"),
          Word = "fancy",
          Words = new List<string> { "believe", "algolia" },
          Decomposition = new List<string> { "trust", "algolia" },
          State = Enum.Parse<DictionaryEntryState>("Enabled"),
        },
      },
    },
  }
);

// print the response
Console.WriteLine(response);
// Initialize the client
final client =
    SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY');

// Call the API
final response = await client.batchDictionaryEntries(
  dictionaryName: DictionaryType.fromJson("plurals"),
  batchDictionaryEntriesParams: BatchDictionaryEntriesParams(
    clearExistingDictionaryEntries: true,
    requests: [
      BatchDictionaryEntriesRequest(
        action: DictionaryAction.fromJson("addEntry"),
        body: DictionaryEntry(
          objectID: "1",
          language: SupportedLanguage.fromJson("en"),
          word: "fancy",
          words: [
            "believe",
            "algolia",
          ],
          decomposition: [
            "trust",
            "algolia",
          ],
          state: DictionaryEntryState.fromJson("enabled"),
        ),
      ),
    ],
  ),
);

// print the response
print(response);
// Initialize the client
client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
if err != nil {
  // The client can fail to initialize if you pass an invalid parameter.
  panic(err)
}

// Call the API
response, err := client.BatchDictionaryEntries(client.NewApiBatchDictionaryEntriesRequest(
  search.DictionaryType("plurals"),
  search.NewEmptyBatchDictionaryEntriesParams().SetClearExistingDictionaryEntries(true).SetRequests(
    []search.BatchDictionaryEntriesRequest{
      *search.NewEmptyBatchDictionaryEntriesRequest().SetAction(search.DictionaryAction("addEntry")).SetBody(
        search.NewEmptyDictionaryEntry().SetObjectID("1").SetLanguage(search.SupportedLanguage("en")).SetWord("fancy").SetWords(
          []string{"believe", "algolia"}).SetDecomposition(
          []string{"trust", "algolia"}).SetState(search.DictionaryEntryState("enabled"))),
    }),
))
if err != nil {
  // handle the eventual error
  panic(err)
}


// print the response
print(response)
// Initialize the client
SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");

// Call the API
UpdatedAtResponse response = client.batchDictionaryEntries(
  DictionaryType.PLURALS,
  new BatchDictionaryEntriesParams()
    .setClearExistingDictionaryEntries(true)
    .setRequests(
      Arrays.asList(
        new BatchDictionaryEntriesRequest()
          .setAction(DictionaryAction.ADD_ENTRY)
          .setBody(
            new DictionaryEntry()
              .setObjectID("1")
              .setLanguage(SupportedLanguage.EN)
              .setWord("fancy")
              .setWords(Arrays.asList("believe", "algolia"))
              .setDecomposition(Arrays.asList("trust", "algolia"))
              .setState(DictionaryEntryState.ENABLED)
          )
      )
    )
);

// print the response
System.out.println(response);
// Initialize the client
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY');

// Call the API
const response = await client.batchDictionaryEntries({
  dictionaryName: 'plurals',
  batchDictionaryEntriesParams: {
    clearExistingDictionaryEntries: true,
    requests: [
      {
        action: 'addEntry',
        body: {
          objectID: '1',
          language: 'en',
          word: 'fancy',
          words: ['believe', 'algolia'],
          decomposition: ['trust', 'algolia'],
          state: 'enabled',
        },
      },
    ],
  },
});


// print the response
console.log(response);
// Initialize the client
val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY")

// Call the API
var response =
  client.batchDictionaryEntries(
    dictionaryName = DictionaryType.entries.first { it.value == "plurals" },
    batchDictionaryEntriesParams =
      BatchDictionaryEntriesParams(
        clearExistingDictionaryEntries = true,
        requests =
          listOf(
            BatchDictionaryEntriesRequest(
              action = DictionaryAction.entries.first { it.value == "addEntry" },
              body =
                DictionaryEntry(
                  objectID = "1",
                  language = SupportedLanguage.entries.first { it.value == "en" },
                  word = "fancy",
                  words = listOf("believe", "algolia"),
                  decomposition = listOf("trust", "algolia"),
                  state = DictionaryEntryState.entries.first { it.value == "enabled" },
                ),
            )
          ),
      ),
  )


// print the response
println(response)
// Initialize the client
$client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY');

// Call the API
$response = $client->batchDictionaryEntries(
    'plurals',
    ['clearExistingDictionaryEntries' => true,
        'requests' => [
            ['action' => 'addEntry',
                'body' => ['objectID' => '1',
                    'language' => 'en',
                    'word' => 'fancy',
                    'words' => [
                        'believe',

                        'algolia',
                    ],
                    'decomposition' => [
                        'trust',

                        'algolia',
                    ],
                    'state' => 'enabled',
                ],
            ],
        ],
    ],
);


// print the response
var_dump($response);
# Initialize the client
# In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods.
client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")

# Call the API
response = client.batch_dictionary_entries(
    dictionary_name="plurals",
    batch_dictionary_entries_params={
        "clearExistingDictionaryEntries": True,
        "requests": [
            {
                "action": "addEntry",
                "body": {
                    "objectID": "1",
                    "language": "en",
                    "word": "fancy",
                    "words": [
                        "believe",
                        "algolia",
                    ],
                    "decomposition": [
                        "trust",
                        "algolia",
                    ],
                    "state": "enabled",
                },
            },
        ],
    },
)


# print the response
print(response)
# Initialize the client
client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")

# Call the API
response = client.batch_dictionary_entries(
  "plurals",
  Algolia::Search::BatchDictionaryEntriesParams.new(
    clear_existing_dictionary_entries: true,
    requests: [
      Algolia::Search::BatchDictionaryEntriesRequest.new(
        action: "addEntry",
        body: Algolia::Search::DictionaryEntry.new(
          algolia_object_id: "1",
          language: "en",
          word: "fancy",
          words: ["believe", "algolia"],
          decomposition: ["trust", "algolia"],
          state: "enabled"
        )
      )
    ]
  )
)


# print the response
puts(response)
// Initialize the client
val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY")

// Call the API
val response = Await.result(
  client.batchDictionaryEntries(
    dictionaryName = DictionaryType.withName("plurals"),
    batchDictionaryEntriesParams = BatchDictionaryEntriesParams(
      clearExistingDictionaryEntries = Some(true),
      requests = Seq(
        BatchDictionaryEntriesRequest(
          action = DictionaryAction.withName("addEntry"),
          body = DictionaryEntry(
            objectID = "1",
            language = Some(SupportedLanguage.withName("en")),
            word = Some("fancy"),
            words = Some(Seq("believe", "algolia")),
            decomposition = Some(Seq("trust", "algolia")),
            state = Some(DictionaryEntryState.withName("enabled"))
          )
        )
      )
    )
  ),
  Duration(100, "sec")
)

// print the response
println(response)
// Initialize the client
let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY")

// Call the API
let response = try await client.batchDictionaryEntries(
    dictionaryName: DictionaryType.plurals,
    batchDictionaryEntriesParams: BatchDictionaryEntriesParams(
        clearExistingDictionaryEntries: true,
        requests: [BatchDictionaryEntriesRequest(
            action: DictionaryAction.addEntry,
            body: DictionaryEntry(
                objectID: "1",
                language: SearchSupportedLanguage.en,
                word: "fancy",
                words: ["believe", "algolia"],
                decomposition: ["trust", "algolia"],
                state: DictionaryEntryState.enabled
            )
        )]
    )
)

// print the response
print(response)

See the full API reference

For more details about input parameters and response fields.
Last modified on March 25, 2026