> ## 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 = None,
        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`     | `None`                             | *(Optional, keyword-only)* Override the per-operation index key. See [Per-operation key override](#per-operation-key-override). |
| `user_id`   | `bytes`     | `None`                             | *(Optional, keyword-only)* 16-byte RBAC user identifier. See [Per-operation key override](#per-operation-key-override).         |

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

  <Accordion title="RuntimeError">
    * 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"])

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"])
print(items)
# Example output (contents returned as bytes):
# [{"id": "item_1", "contents": b"Example contents..."},
#  {"id": "item_2", "contents": b"Example contents..."}]
```

### Per-operation key override

The calls above reuse the key supplied at [`create_index()`](../client/create-index) / [`load_index()`](../client/load-index). You may instead pass `index_key=` (and `user_id=` for an [RBAC user](./manage-users)) to override the per-operation key. This is required in stateless/service deployments that reload the index per request:

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