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

## Get

Retrieves, decrypts and returns items from their IDs. If an item does not exist at that ID, it will return an empty object.

```python theme={null}
def get(self,
        ids: List[str],
        include: List[str] = ["vector", "contents", "metadata"],
        *,
        index_key: bytes,
        user_id: bytes = None)
```

### Parameters

| Parameter | Type | Default | Description |
| - | - | - | - |
| `ids` | `List[str]` | - | Item IDs to retrieve & decrypt |
| `include` | `List[str]` | `"vector", "contents", "metadata"` | *(Optional)* List of item fields to return. Can include `vector`, `contents`, and `metadata`. |
| `index_key` | `bytes` | - | *(Required, keyword-only)* 32-byte index KEK. See [Index key](#index-key). |
| `user_id` | `bytes` | `None` | *(Optional, keyword-only)* 16-byte RBAC user identifier. See [Index key](#index-key). |

### Returns

`List[Dict]`: Decrypted item fields for each item, including `id` and specified fields (e.g., `vector`, `contents`, and `metadata`).

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

### Exceptions

<AccordionGroup>
  <Accordion title="ValueError">
    * Throws if the item could not be retrieved or decrypted.
    * Throws if an unexpected error occurs during retrieval.
  </Accordion>
</AccordionGroup>

### Example Usage

```python theme={null}
# Load index
index = client.load_index(
    index_name=index_name, 
    index_key=index_key
)

# Retrieve the items using their IDs
items = index.get(["item_1", "item_2"], index_key=index_key)

print(items)
# Example output (contents returned as bytes):
# [{"id": "item_1", "vector": [0.1, 0.2], "contents": b"Example contents...", "metadata": {"type": "txt"}},
#  {"id": "item_2", "vector": [0.3, 0.4], "contents": b"Example contents...", "metadata": {"type": "md"}},

# Retrieve only the item contents
items = index.get(["item_1", "item_2"], include=["contents"], index_key=index_key)
print(items)
# Example output (contents returned as bytes):
# [{"id": "item_1", "contents": b"Example contents..."},
#  {"id": "item_2", "contents": b"Example contents..."}]
```

### Index key

`index_key` is required on every call. Pass the same 32-byte index KEK you used with [`create_index()`](../client/create-index) / [`load_index()`](../client/load-index). For an [RBAC user](./manage-users), pass the user's KEK as `index_key=` together with their `user_id=`:

```python theme={null}
items = index.get(["item_1", "item_2"], index_key=user_kek, user_id=user_id)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.