> This page is for version V1 (default).
> For other versions, use one of these documentation indexes:
> - V1 (default): https://docs.ottimate.com/v-1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ottimate.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ottimate.com/_mcp/server.

# Catalog Variances

This section explains how to work with catalog variances using the Ottimate SDK.

### Fetching Catalog Variances

You can retrieve a list of catalog variances for a given company.

```python
# main.py

variances_response = client.catalog.get_catalog_variances(
    ottimate_company_id=ottimate_company_id
)

for variance in variances_response.results:
    print(f" - Catalog Entry ID: {variance.id}, Invoice Item ID: {variance.last_invoice_item.id}")
```

### Fetching Catalog Variances with Filters

You can filter variances by date range, location, or to show only items with variances.

```python
# main.py

from datetime import datetime, timedelta

# Filter by date range
end_date = datetime.now().strftime("%Y-%m-%d")
start_date = (datetime.now() - timedelta(days=30)).strftime("%Y-%m-%d")

variances_response = client.catalog.get_catalog_variances(
    ottimate_company_id=ottimate_company_id,
    invoice_start_date=start_date,
    invoice_end_date=end_date
)

# Filter to show only items with variances
variances_response = client.catalog.get_catalog_variances(
    ottimate_company_id=ottimate_company_id,
    variance_only=True
)

# Filter by location
variances_response = client.catalog.get_catalog_variances(
    ottimate_company_id=ottimate_company_id,
    ottimate_location_ids=str(location_id)
)
```

### Fetching Invoice Items for a Variance

You can fetch the invoice items associated with a specific catalog variance by its catalog entry ID.

```python
# main.py

invoice_items = client.catalog.get_catalog_variances_id_invoice_items(
    id=catalog_entry_id
)
print(f"Fetched variance details for catalog entry ID {catalog_entry_id}: {invoice_items.results}")
```