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

# Get Encrypted Items

If you have added items to the index with the `contents` field, you can retrieve them via `get()`.

<Tip>The `contents` field is always returned as bytes in Python or `std::vector<uint8_t>` in C++, regardless of whether it was originally stored as a string or bytes. All contents are encoded to bytes and encrypted before storage.</Tip>

<CodeGroup>
  ```python Python icon="python" theme={null}
  # IDs of items to retrieve
  ids = ["item_20", "item_11"]
  include = ["contents", "metadata"]

  # Retrieve items from the encrypted index
  items = index.get(ids, include)

  print(items)
  # Example item (contents returned as bytes)
  # [{"id": "item_20", "contents": b"Hello, World!", "metadata": {"type": "txt"}},
  #  {"id": "item_11", "contents": b"Hello, Cyborg!", "metadata": {"type": "md"}}]
  ```

  ```cpp C++ icon="brackets-curly" theme={null}
  // IDs of items to retrieve
  std::vector<std::string> ids = {"item_20", "item_11"};
  std::vector<cyborg::ItemFields> include = {cyborg::ItemFields::kContents, cyborg::ItemFields::kMetadata};

  // Retrieve items from the encrypted index (index_key implicitly builds the KeyContext)
  std::vector<cyborg::Item> items = index->Get(ids, include, index_key);

  // Print the item fields
  for (const auto& item : items) {
      std::cout << "ID: " << item.id << ", Contents: " << std::string(item.contents.begin(), item.contents.end()) << ", Metadata: " << item.metadata << std::endl;
  }
  ```
</CodeGroup>

## API Reference

For more information on getting items from an encrypted index, refer to the API reference:

<CardGroup cols={2}>
  <Card title="Python API Reference" href="../../python/encrypted-index/get" icon="python">
    API reference for `get()` in Python
  </Card>

  <Card title="C++ API Reference" href="../../cpp/encrypted-index/get" icon="brackets-curly">
    API reference for `Get()` in C++
  </Card>
</CardGroup>
