> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Views SDK Reference

> SDK reference for the Views API, available in Node.js and Python.

## Views

### List Views

List visible saved views

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from orq_ai_sdk import Orq
  import os

  with Orq(
      api_key=os.getenv("ORQ_API_KEY", ""),
  ) as orq:

      res = orq.views.list()

      # Handle response
      print(res)

  ```

  ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import { Orq } from "@orq-ai/node";

  const orq = new Orq({
    apiKey: process.env["ORQ_API_KEY"] ?? "",
  });

  async function run() {
    const result = await orq.views.list();

    console.log(result);
  }

  run();
  ```
</CodeGroup>

<Expandable title="Parameters">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "limit": Optional[int],
        "starting_after": Optional[str],
        "ending_before": Optional[str],
        "page": Optional[str],
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      limit?: number;
      startingAfter?: string;
      endingBefore?: string;
      page?: string;
    }
    ```
  </CodeGroup>
</Expandable>

<Expandable title="Response">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "data": [{  # optional
            "id": Optional[str],
            "display_name": Optional[str],
            "description": Optional[str],
            "workspace_id": Optional[str],
            "page": Optional[str],
            "filter_by": Optional[str],
            "columns": List[str],  # optional
            "column_labels": Dict[str, str],  # optional
            "is_default": Optional[bool],
            "private_for_ids": List[str],  # optional
            "version": Optional[int],
            "created_by_id": Optional[str],
            "updated_by_id": Optional[str],
            "created_at": str,  # optional
            "updated_at": str,  # optional
        }],
        "has_more": Optional[bool],
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      data?: {
        id?: string;
        displayName?: string;
        description?: string;
        workspaceId?: string;
        page?: string;
        filterBy?: string;
        columns?: string[];
        columnLabels?: Record<string, string>;
        isDefault?: boolean;
        privateForIds?: string[];
        version?: number;
        createdById?: string;
        updatedById?: string;
        createdAt?: Date;
        updatedAt?: Date;
      }[];
      hasMore?: boolean;
    }
    ```
  </CodeGroup>
</Expandable>

### Create a View

Create a saved view

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from orq_ai_sdk import Orq
  import os

  with Orq(
      api_key=os.getenv("ORQ_API_KEY", ""),
  ) as orq:

      res = orq.views.create(display_name="Saved logs", page="logs")

      # Handle response
      print(res)

  ```

  ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import { Orq } from "@orq-ai/node";

  const orq = new Orq({
    apiKey: process.env["ORQ_API_KEY"] ?? "",
  });

  async function run() {
    const result = await orq.views.create({
      displayName: "Saved logs",
      page: "logs",
    });

    console.log(result);
  }

  run();
  ```
</CodeGroup>

<Expandable title="Parameters">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "display_name": Optional[str],
        "description": Optional[str],
        "page": Optional[str],
        "filter_by": Optional[str],
        "columns": List[str],  # optional
        "column_labels": Dict[str, str],  # optional
        "is_default": Optional[bool],
        "is_private": Optional[bool],
        "version": Optional[int],
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      displayName?: string;
      description?: string;
      page?: string;
      filterBy?: string;
      columns?: string[];
      columnLabels?: Record<string, string>;
      isDefault?: boolean;
      isPrivate?: boolean;
      version?: number;
    }
    ```
  </CodeGroup>
</Expandable>

<Expandable title="Response">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "view": {  # optional
            "id": Optional[str],
            "display_name": Optional[str],
            "description": Optional[str],
            "workspace_id": Optional[str],
            "page": Optional[str],
            "filter_by": Optional[str],
            "columns": List[str],  # optional
            "column_labels": Dict[str, str],  # optional
            "is_default": Optional[bool],
            "private_for_ids": List[str],  # optional
            "version": Optional[int],
            "created_by_id": Optional[str],
            "updated_by_id": Optional[str],
            "created_at": str,  # optional
            "updated_at": str,  # optional
        },
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      view?: {
        id?: string;
        displayName?: string;
        description?: string;
        workspaceId?: string;
        page?: string;
        filterBy?: string;
        columns?: string[];
        columnLabels?: Record<string, string>;
        isDefault?: boolean;
        privateForIds?: string[];
        version?: number;
        createdById?: string;
        updatedById?: string;
        createdAt?: Date;
        updatedAt?: Date;
      };
    }
    ```
  </CodeGroup>
</Expandable>

### Retrieve a View

Retrieve a saved view

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from orq_ai_sdk import Orq
  import os

  with Orq(
      api_key=os.getenv("ORQ_API_KEY", ""),
  ) as orq:

      res = orq.views.get(view_id="<id>")

      # Handle response
      print(res)

  ```

  ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import { Orq } from "@orq-ai/node";

  const orq = new Orq({
    apiKey: process.env["ORQ_API_KEY"] ?? "",
  });

  async function run() {
    const result = await orq.views.get({
      viewId: "<id>",
    });

    console.log(result);
  }

  run();
  ```
</CodeGroup>

<Expandable title="Parameters">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "view_id": str,  # required
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      viewId: string;  // required
    }
    ```
  </CodeGroup>
</Expandable>

<Expandable title="Response">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "view": {  # optional
            "id": Optional[str],
            "display_name": Optional[str],
            "description": Optional[str],
            "workspace_id": Optional[str],
            "page": Optional[str],
            "filter_by": Optional[str],
            "columns": List[str],  # optional
            "column_labels": Dict[str, str],  # optional
            "is_default": Optional[bool],
            "private_for_ids": List[str],  # optional
            "version": Optional[int],
            "created_by_id": Optional[str],
            "updated_by_id": Optional[str],
            "created_at": str,  # optional
            "updated_at": str,  # optional
        },
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      view?: {
        id?: string;
        displayName?: string;
        description?: string;
        workspaceId?: string;
        page?: string;
        filterBy?: string;
        columns?: string[];
        columnLabels?: Record<string, string>;
        isDefault?: boolean;
        privateForIds?: string[];
        version?: number;
        createdById?: string;
        updatedById?: string;
        createdAt?: Date;
        updatedAt?: Date;
      };
    }
    ```
  </CodeGroup>
</Expandable>

### Delete a View

Delete a saved view

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from orq_ai_sdk import Orq
  import os

  with Orq(
      api_key=os.getenv("ORQ_API_KEY", ""),
  ) as orq:

      res = orq.views.delete(view_id="<id>")

      # Handle response
      print(res)

  ```

  ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import { Orq } from "@orq-ai/node";

  const orq = new Orq({
    apiKey: process.env["ORQ_API_KEY"] ?? "",
  });

  async function run() {
    const result = await orq.views.delete({
      viewId: "<id>",
    });

    console.log(result);
  }

  run();
  ```
</CodeGroup>

<Expandable title="Parameters">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "view_id": str,  # required
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      viewId: string;  // required
    }
    ```
  </CodeGroup>
</Expandable>

### Update a View

Update a saved view

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from orq_ai_sdk import Orq
  import os

  with Orq(
      api_key=os.getenv("ORQ_API_KEY", ""),
  ) as orq:

      res = orq.views.update(view_id="<id>", display_name="Saved logs")

      # Handle response
      print(res)

  ```

  ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import { Orq } from "@orq-ai/node";

  const orq = new Orq({
    apiKey: process.env["ORQ_API_KEY"] ?? "",
  });

  async function run() {
    const result = await orq.views.update({
      viewId: "<id>",
      updateViewRequest: {
        displayName: "Saved logs",
      },
    });

    console.log(result);
  }

  run();
  ```
</CodeGroup>

<Expandable title="Parameters">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "view_id": str,  # required
        "display_name": Optional[str],
        "description": Optional[str],
        "filter_by": Optional[str],
        "columns": List[str],  # optional
        "column_labels": Dict[str, str],  # optional
        "is_default": Optional[bool],
        "is_private": Optional[bool],
        "version": Optional[int],
        "update_mask": Optional[str],
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      viewId: string;  // required
      updateViewRequest: {  // required
        displayName?: string;
        description?: string;
        filterBy?: string;
        columns?: string[];
        columnLabels?: Record<string, string>;
        isDefault?: boolean;
        isPrivate?: boolean;
        version?: number;
        updateMask?: string;
      };
    }
    ```
  </CodeGroup>
</Expandable>

<Expandable title="Response">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "view": {  # optional
            "id": Optional[str],
            "display_name": Optional[str],
            "description": Optional[str],
            "workspace_id": Optional[str],
            "page": Optional[str],
            "filter_by": Optional[str],
            "columns": List[str],  # optional
            "column_labels": Dict[str, str],  # optional
            "is_default": Optional[bool],
            "private_for_ids": List[str],  # optional
            "version": Optional[int],
            "created_by_id": Optional[str],
            "updated_by_id": Optional[str],
            "created_at": str,  # optional
            "updated_at": str,  # optional
        },
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      view?: {
        id?: string;
        displayName?: string;
        description?: string;
        workspaceId?: string;
        page?: string;
        filterBy?: string;
        columns?: string[];
        columnLabels?: Record<string, string>;
        isDefault?: boolean;
        privateForIds?: string[];
        version?: number;
        createdById?: string;
        updatedById?: string;
        createdAt?: Date;
        updatedAt?: Date;
      };
    }
    ```
  </CodeGroup>
</Expandable>


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