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

# Save dictionary entries

> Send a batch of entries to a dictionary.

> [!NOTE]
>
> This page documents an earlier version of the API client.
> For the latest version, see [Add or delete dictionary entries](https://www.algolia.com/doc/libraries/sdk/methods/search/batch-dictionary-entries.md).

**Required ACL:** `editSettings`

## Examples

### Save stopword entries

```cs C# theme={"system"}
Stopword stopword = new Stopword()
{
  ObjectID = objectId,
  Language = "en",
  Word = "upper",
  State = "enabled"
};

// Synchronous
var saveDictionaryResponse = DictionaryClient.SaveDictionaryEntries(algoliaDictionary, new List<DictionaryEntry>() { stopword });

// Asynchronous
var saveDictionaryResponse = DictionaryClient.SaveDictionaryEntriesAsync(algoliaDictionary, new List<DictionaryEntry>() { stopword });
saveDictionaryResponse.Wait();
```

```go Go theme={"system"}
stopwordEntry := search.NewStopword(entryID, "en", "down", "enabled")

res, err := client.SaveDictionaryEntries(search.Stopwords, []search.DictionaryEntry{stopwordEntry})
```

```java Java theme={"system"}
Stopword stopword = DictionaryEntry.stopword("MyObjectID", "en", "upper", "enabled");
// Synchronous
client.saveDictionaryEntries(Dictionary.STOPWORDS, Collections.singletonList(stopword));
// Asynchronous
client.saveDictionaryEntriesAsync(Dictionary.STOPWORDS, Collections.singletonList(stopword));
```

```js JavaScript theme={"system"}
client.saveDictionaryEntries("stopwords", [
  {
    objectID: "down",
    language: "en",
    word: "down",
  },
]);
```

```kotlin Kotlin theme={"system"}
val entry = DictionaryEntry.Stopword(
    objectID = ObjectID("MyObjectID"),
    language = Language.English,
    word = "upper"
)
client.saveDictionaryEntries(Dictionary.Stopwords, listOf(entry))
// or using extension function:
client.saveStopwordEntries(listOf(entry))
```

```php PHP theme={"system"}
$client->saveDictionaryEntries(
  'stopwords',
  array(array(
    'objectID' => 'down',
    'language' => 'en',
    'word' => 'down'
  ))
);
```

```python Python theme={"system"}
client.save_dictionary_entries(
    "stopwords", [{"objectID": "down", "language": "en", "word": "down"}]
)
```

```ruby Ruby theme={"system"}
client.save_dictionary_entries(
  "stopwords",
  [
    {
      objectID: "down",
      language: "en",
      word: "down"
    }
  ]
)
```

```scala Scala theme={"system"}
val entry = StopwordEntry(
  objectID = "MyObjectID",
  language = "en",
  word = "upper",
  state = "enabled"
)
client.execute {
  save dictionary Stopwords entries Seq(entry)
}
```

```swift Swift theme={"system"}
let entry = StopwordsDictionary.Entry(objectID: "down",
                                      language: .english,
                                      word: "down",
                                      state: .enabled)

client.saveDictionaryEntries(to: StopwordsDictionary.self, dictionaryEntries: [entry]) { result in
  if case .success(let response) = result {
    print("Response: \(response)")
  }
}
```

### Save plural entries

```cs C# theme={"system"}
Plural plural = new Plural()
{
  ObjectID = objectId,
  Language = "fr",
  Words = new List<String>() { "cheval", "chevaux" }
};

// Synchronous
DictionaryClient.SaveDictionaryEntries(algoliaDictionary, new List<DictionaryEntry>() { plural });

// Asynchronous
var saveDictionaryResponse = await DictionaryClient.SaveDictionaryEntries(algoliaDictionary, new List<DictionaryEntry>() { plural });
saveDictionaryResponse.Wait();
```

```go Go theme={"system"}
pluralEntry := search.NewPlural(entryID, "fr", []string{"cheval", "chevaux"})

res, err := client.SaveDictionaryEntries(search.Plurals, []search.DictionaryEntry{pluralEntry})
```

```java Java theme={"system"}
Plural plural = DictionaryEntry.plural("MyObjectID", "fr", Arrays.asList("cheval", "chevaux"));
// Synchronous
client.saveDictionaryEntries(Dictionary.PLURALS, Collections.singletonList(plural));
// Asynchronous
client.saveDictionaryEntriesAsync(Dictionary.PLURALS, Collections.singletonList(plural));
```

```js JavaScript theme={"system"}
client.saveDictionaryEntries("plurals", [
  {
    objectID: "chevaux",
    language: "fr",
    words: ["cheval", "chevaux"],
  },
]);
```

```kotlin Kotlin theme={"system"}
val entry = DictionaryEntry.Plural(
    objectID = ObjectID("MyObjectID"),
    language = Language.French,
    words = listOf("cheval", "chevaux")
)
client.saveDictionaryEntries(Dictionary.Plurals, listOf(entry))
// or using extension function:
client.savePluralEntries(listOf(entry))
```

```php PHP theme={"system"}
$client->saveDictionaryEntries(
  'plurals',
  array(array(
    'objectID' => 'chevaux',
    'language' => 'fr',
    'words' => array('cheval', 'chevaux')
  ))
);
```

```python Python theme={"system"}
client.save_dictionary_entries(
    "plurals",
    [{"objectID": "chevaux", "language": "fr", "words": ["cheval", "chevaux"]}],
)
```

```ruby Ruby theme={"system"}
client.save_dictionary_entries(
  "plurals",
  [
    {
      objectID: "chevaux",
      language: "fr",
      words: %w[cheval chevaux]
    }
  ]
)
```

```scala Scala theme={"system"}
val entry = PluralEntry(
  objectID = "MyObjectID",
  language = "fr",
  words = Seq("cheval", "chevaux")
)
client.execute {
  save dictionary Plurals entries Seq(entry)
}
```

```swift Swift theme={"system"}
let entry = PluralsDictionary.Entry(objectID: "chevaux",
                                    language: .french,
                                    words: ["cheval", "chevaux"])

client.saveDictionaryEntries(to: PluralsDictionary.self, dictionaryEntries: [entry]) { result in
  if case .success(let response) = result {
    print("Response: \(response)")
  }
}
```

### Save compound entries

```cs C# theme={"system"}
Compound compound = new Compound()
{
  ObjectID = objectId,
  Language = "nl",
  Word = "kopfschmerztablette",
  Decomposition = new List<String>() { "kopf", "schmerz", "tablette" }
};

// Synchronous
DictionaryClient.SaveDictionaryEntries(algoliaDictionary, new List<DictionaryEntry>() { compound });

// Asynchronous
var saveDictionaryResponse = await DictionaryClient.SaveDictionaryEntriesAsync(algoliaDictionary, new List<DictionaryEntry>() { compound });
saveDictionaryResponse.Wait();
```

```go Go theme={"system"}
compoundEntry := search.NewCompound(entryID, "de", "kopfschmerztablette", []string{"kopf", "schmerz", "tablette"})

res, err := client.SaveDictionaryEntries(search.Compounds, []search.DictionaryEntry{compoundEntry})
```

```java Java theme={"system"}
Compound compound = DictionaryEntry.compound("MyObjectID", "de", "kopfschmerztablette", Arrays.asList("kopf", "schmerz", "tablette"));
// Synchronous
client.saveDictionaryEntries(Dictionary.COMPOUNDS, Collections.singletonList(compound));
// Asynchronous
client.saveDictionaryEntriesAsync(Dictionary.COMPOUNDS, Collections.singletonList(compound));
```

```js JavaScript theme={"system"}
client.saveDictionaryEntries("compounds", [
  {
    objectID: "kopfschmerztablette",
    language: "de",
    word: "kopfschmerztablette",
    decomposition: ["kopf", "schmerz", "tablette"],
  },
]);
```

```kotlin Kotlin theme={"system"}
val entry = DictionaryEntry.Compound(
    objectID = ObjectID("MyObjectID"),
    language = Language.Dutch,
    word = "kopfschmerztablette",
    decomposition = listOf("kopf", "schmerz", "tablette")
)
client.saveDictionaryEntries(Dictionary.Compounds, listOf(entry))
// or using extension function:
client.saveCompoundEntries(listOf(entry))
```

```php PHP theme={"system"}
$client->saveDictionaryEntries(
  'compounds',
  array(array(
    'objectID' => 'kopfschmerztablette',
    'language' => 'de',
    'word' => 'kopfschmerztablette',
    'decomposition' => array('kopf', 'schmerz', 'tablette')
  ))
);
```

```python Python theme={"system"}
client.save_dictionary_entries(
    "compounds",
    [
        {
            "objectID": "kopfschmerztablette",
            "language": "de",
            "word": "kopfschmerztablette",
            "decomposition": ["kopf", "schmerz", "tablette"],
        }
    ],
)
```

```ruby Ruby theme={"system"}
client.save_dictionary_entries(
  "compounds",
  [
    {
      objectID: "kopfschmerztablette",
      language: "de",
      word: "kopfschmerztablette",
      decomposition: %w[kopf schmerz tablette]
    }
  ]
)
```

```scala Scala theme={"system"}
val entry = CompoundEntry(
  objectID = "MyObjectID",
  language = "de",
  word = "kopfschmerztablette",
  decomposition = Seq("kopf", "schmerz", "tablette")
)
client.execute {
  save dictionary Compounds entries Seq(entry)
}
```

```swift Swift theme={"system"}
let entry = CompoundsDictionary.Entry(objectID: "kopfschmerztablette",
                                      language: .german,
                                      word: "kopfschmerztablette",
                                      decomposition: ["kopf", "schmerz", "tablette"])

client.saveDictionaryEntries(to: CompoundsDictionary.self, dictionaryEntries: [entry]) { result in
  if case .success(let response) = result {
    print("Response: \(response)")
  }
}
```

## Parameters

**dictionary** `enum\<string\>` *required*

Dictionary type.
One of: `stopword`, `plural`, `compound`.

**dictionaryEntries** `object[]` *required*

The dictionary entries to add.

**objectID** `string` *required*

Unique ID of the dictionary entry.

**language** `string` *required*

Language ISO code supported by this dictionary,
for example `en` for English.

**decomposition** `string[]`

List of decompositions of a word for the `compounds` dictionary.
If empty, `word` is considered a compound atom.
Otherwise, the compounds that `word` is decomposed into.

**state** `enum\<string\>` (default: enabled)

Whether this dictionary entry is active:

* `enabled`: this dictionary entry is active
* `disabled`: this dictionary entry is inactive

**word** `string`

For the stop-word dictionary: the stop word you want to add.
For the compounds dictionary:

* Adds the word as compound atom (with empty `decomposition`)
* Adds the word with a custom decomposition

If the word is already included in Algolia's standard dictionary,
you can override it by setting its state to `disabled`.

**words** `string[]`

List of declensions for the `plurals` dictionary.

**requestOptions** `object`

Additional parameters to add to this request.

## Response

**taskID** `integer`

The task ID used with the [`waitTask`](https://www.algolia.com/doc/libraries/sdk/v1/methods/wait-task) method.

**updatedAt** `string`

Date at which the indexing job has been created.

### Response as JSON

This section shows the JSON response returned by the API.
Each API client wraps this response in language-specific objects, so the structure may vary.
To view the response, use the `getLogs` method.
Don't rely on the order of properties—JSON objects don't preserve key order.

```jsonc JSON icon=braces theme={"system"}
{
  "updatedAt":"2013-01-18T15:33:13.556Z",
  "taskID": 678
}
```
