> ## 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 vector IDs currently stored in the encrypted index.

```typescript theme={null}
async listIds(): Promise<{ ids: string[]; count: number }>
```

### Returns

`Promise<{ ids: string[]; count: number }>`: A Promise that resolves to an object containing:

* `ids`: Array of all item ID strings in the index
* `count`: Total number of items in the index

### Exceptions

<AccordionGroup>
  <Accordion title="Error">
    * Throws if the API request fails due to network connectivity issues.
    * Throws if authentication fails (invalid API key).
    * Throws if the encryption key is invalid for the specified index.
    * Throws if there are internal server errors preventing the operation.
  </Accordion>
</AccordionGroup>

### Example Usage

```typescript theme={null}
import { Client } from 'cyborgdb';

const client = new Client({ baseUrl: 'http://localhost:8000', apiKey: 'your-api-key' });

// Load an existing index
const indexKey = new Uint8Array(Buffer.from('your-stored-hex-key', 'hex'));
const index = await client.loadIndex({ indexName: 'my-vector-index', indexKey });

try {
    // List all vector IDs in the index
    const result = await index.listIds();
    
    console.log('Total items in index:', result.count);
    console.log('Item IDs:', result.ids);
    // Output: { count: 3, ids: ["doc1", "doc2", "doc3"] }

    // Check if a specific ID exists
    if (result.ids.includes('doc1')) {
        console.log('✓ Item doc1 exists in index');
    }
    
    // Use for inventory management
    if (result.count === 0) {
        console.log('Index is empty');
    } else {
        console.log(`Index contains ${result.count} items`);
        
        // Process all IDs
        for (const id of result.ids) {
            console.log(`Processing item: ${id}`);
        }
    }
    
} catch (error) {
    console.error('Failed to list IDs:', error.message);
}
```
