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

# Dimensions

### Creating a Dimension

This shows how to create a new dimension (e.g., a department).

```python
# main.py

dimension_name = f"SDK Department {time_now}"
dimension_unique_key = f"dept-sdk-{time_now}"

new_dimension = client.dimensions.post_dimensions_root(
    ottimate_company_id=ottimate_company_id,
    type="DEPARTMENT",
    code="MKT",
    dimension_type_code="DEPARTMENT",
    name=dimension_name,
    unique_key=dimension_unique_key,
)
ottimate_dimension_id = new_dimension.dimension.get("id")
```

### Fetching Dimensions

You can fetch all dimensions for a company, or filter by type.

Fetching all dimensions:

```python
# Fetch all the dimensions
dimensions = client.dimensions.get_dimensions_root(ottimate_company_id=ottimate_company_id)
print(f"✅ Fetched {len(dimensions.dimensions)} dimensions for the company.")
for dimension in dimensions.dimensions:
    print(f"   - Dimension: {dimension.name} | Ottimate Dimension ID : {dimension.id} | Type: {dimension.dimension_type} | ERP ID: {dimension.erp_dimension_id}")
```

Fetching dimensions of a specific type:

```python
# Fetch dimensions of type DEPARTMENT
dimensions = client.dimensions.get_dimensions_root(ottimate_company_id=ottimate_company_id, type="DEPARTMENT")
for dimension in dimensions.dimensions:
    print(f"   - Dimension: {dimension.name} | Ottimate Dimension ID : {dimension.id} | Type: {dimension.type} | ERP ID: {dimension.erp_dimension_id}")
```

Fetching a single dimension by ID:

```python
# Fetch a single dimension by ID
dimension = client.dimensions.get_dimensions_id(id="<ottimate_dimension_id>").dimension        
print(f"   - Dimension: {dimension.name} | Ottimate Dimension ID : {dimension.id}| Type: {dimension.type} | ERP ID: {dimension.erp_dimension_id}")
```