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

This section covers managing catalog allowances using the Ottimate SDK.

### Fetching Catalog Allowances

You can retrieve all allowances for a company, with optional filters.

```python
# main.py

catalog_allowances = client.catalog.get_catalog_allowances(
    ottimate_company_id=ottimate_company_id
)
print(f"Fetched {len(catalog_allowances.results)} catalog allowances.")
for allowance in catalog_allowances.results:
    print(f" - Allowance ID: {allowance.id}, Amount: {allowance.amount}, Catalog Entry: {allowance.catalog_entry_id}")
```

### Fetching Catalog Allowances with Filters

You can filter allowances by location or effective date.

```python
# main.py

# Filter by location
catalog_allowances = client.catalog.get_catalog_allowances(
    ottimate_company_id=ottimate_company_id,
    ottimate_location_id=location_id
)

# Filter by effective date
from datetime import datetime
today = datetime.now().strftime("%Y-%m-%d")
catalog_allowances = client.catalog.get_catalog_allowances(
    ottimate_company_id=ottimate_company_id,
    effective_date=today
)
```

### Creating a Catalog Allowance

This example shows how to create a new allowance for a catalog entry.

```python
# main.py

from datetime import datetime

start_date = datetime.now()
new_allowance = client.catalog.post_catalog_allowances(
    ottimate_company_id=ottimate_company_id,
    catalog_entry_id=catalog_entry_id,
    amount=5.00,
    start_date=start_date
)
print(f"Created catalog allowance with ID {new_allowance.id}")
```

### Updating a Catalog Allowance

You can update an existing allowance by its ID.

```python
# main.py

updated_allowance = client.catalog.patch_catalog_allowances_id(
    id=allowance_id,
    amount=7.50
)
print(f"Updated catalog allowance ID {allowance_id} to new amount: {updated_allowance.amount}")
```

### Bulk Creating Catalog Allowances

This example demonstrates how to create multiple allowances in a single API call.

```python
# main.py

from datetime import datetime, timedelta
from ottimate.catalog.types.catalog_allowance_bulk_create_request_allowances_item import CatalogAllowanceBulkCreateRequestAllowancesItem

start_date = datetime.now()

allowances = [
    CatalogAllowanceBulkCreateRequestAllowancesItem(
        catalog_entry_id=catalog_entry_id,
        amount=5.00,
        start_date=start_date,
        reference_id=f"bulk-allow-1-{time_now}"
    ),
    CatalogAllowanceBulkCreateRequestAllowancesItem(
        catalog_entry_id=catalog_entry_id,
        amount=3.00,
        start_date=start_date + timedelta(days=30),
        reference_id=f"bulk-allow-2-{time_now}"
    ),
]

bulk_response = client.catalog.post_catalog_allowances_bulk(
    ottimate_company_id=ottimate_company_id,
    allowances=allowances
)

print(f"Bulk created {bulk_response.success_count} catalog allowances.")

if hasattr(bulk_response, "created") and bulk_response.created:
    print("Created allowances:")
    for allowance in bulk_response.created:
        print(f"  - ID: {allowance.get('id')}, Catalog Entry: {allowance.get('catalog_entry_id')}, Amount: {allowance.get('amount')}")

if hasattr(bulk_response, "updated") and bulk_response.updated:
    print("Updated allowances:")
    for allowance in bulk_response.updated:
        print(f"  - ID: {allowance.get('id')}, Catalog Entry: {allowance.get('catalog_entry_id')}, Amount: {allowance.get('amount')}")

if hasattr(bulk_response, "errors") and bulk_response.errors:
    print("Failed allowances:")
    for error in bulk_response.errors:
        print(f"  - Error: {error}")
```