> ## 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.

# List IDs

Lists all item IDs currently stored in the index.

```cpp theme={null}
std::vector<std::string> ListIDs(const KeyContext& key);
```

The trailing `key` is the index's 32-byte KEK. A bare `std::array<uint8_t, 32>` implicitly converts to a `KeyContext`, so you can pass `index_key` directly; for an RBAC user pass `cyborg::KeyContext{user_kek, user_id}`.

### Returns

`std::vector<std::string>`: A vector containing all item IDs currently stored in the encrypted index.

### Exceptions

<AccordionGroup>
  <Accordion title="std::runtime_error">
    * Throws if an error occurs during retrieval of IDs from the index.
  </Accordion>
</AccordionGroup>

### Example Usage

```cpp theme={null}
#include "encrypted_index.hpp"

// ... Create or load an encrypted index ...

// Get all IDs in the index
auto all_ids = index->ListIDs(index_key);

// Print all IDs
std::cout << "Index contains " << all_ids.size() << " items:" << std::endl;
for (const auto& id : all_ids) {
    std::cout << "- " << id << std::endl;
}

// Check if a specific ID exists
std::string target_id = "item_123";
bool exists = std::find(all_ids.begin(), all_ids.end(), target_id) != all_ids.end();
if (exists) {
    std::cout << "Item " << target_id << " exists in the index" << std::endl;
}
```

<Tip>
  Use `ListIDs()` to:

  * Verify what items are stored in your index
  * Check if specific items exist before querying
  * Get a complete inventory of your encrypted index contents
  * Implement custom batch processing logic
</Tip>
