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

# Workspace Security SDK Reference

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

## Workspace Security

### List Domains

Lists domain-verification records for the workspace.

<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.workspace_security.list_domains(workspace_key="<value>")

      # 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.workspaceSecurity.listDomains({
      workspaceKey: "<value>",
    });

    console.log(result);
  }

  run();
  ```
</CodeGroup>

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

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

<Expandable title="Response">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "domains": [{
            "id": str,
            "domain": str,
            "status": Literal["DOMAIN_VERIFICATION_STATUS_UNSPECIFIED", "DOMAIN_VERIFICATION_STATUS_PENDING", "DOMAIN_VERIFICATION_STATUS_VERIFIED"],
            "txt_name": str,
            "txt_value": str,
            "created_at": str,
            "expires_at": str,  # optional
            "verified_at": str,  # optional
            "created_by_id": Optional[str],
        }],
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      domains: {
        id: string;
        domain: string;
        status: "DOMAIN_VERIFICATION_STATUS_UNSPECIFIED" | "DOMAIN_VERIFICATION_STATUS_PENDING" | "DOMAIN_VERIFICATION_STATUS_VERIFIED";
        txtName: string;
        txtValue: string;
        createdAt: Date;
        expiresAt?: Date;
        verifiedAt?: Date;
        createdById?: string;
      }[];
    }
    ```
  </CodeGroup>
</Expandable>

### Create Domain

Creates a domain-verification challenge and returns the TXT record to add to DNS.

<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.workspace_security.create_domain(workspace_key="<value>")

      # 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.workspaceSecurity.createDomain({
      workspaceKey: "<value>",
      createDomainRequest: {},
    });

    console.log(result);
  }

  run();
  ```
</CodeGroup>

<Expandable title="Parameters">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "workspace_key": str,  # required
        "domain": Optional[str],
    }
    ```

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

<Expandable title="Response">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "domain": {
            "id": str,
            "domain": str,
            "status": Literal["DOMAIN_VERIFICATION_STATUS_UNSPECIFIED", "DOMAIN_VERIFICATION_STATUS_PENDING", "DOMAIN_VERIFICATION_STATUS_VERIFIED"],
            "txt_name": str,
            "txt_value": str,
            "created_at": str,
            "expires_at": str,  # optional
            "verified_at": str,  # optional
            "created_by_id": Optional[str],
        },
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      domain: {
        id: string;
        domain: string;
        status: "DOMAIN_VERIFICATION_STATUS_UNSPECIFIED" | "DOMAIN_VERIFICATION_STATUS_PENDING" | "DOMAIN_VERIFICATION_STATUS_VERIFIED";
        txtName: string;
        txtValue: string;
        createdAt: Date;
        expiresAt?: Date;
        verifiedAt?: Date;
        createdById?: string;
      };
    }
    ```
  </CodeGroup>
</Expandable>

### Delete Domain

Permanently removes a domain-verification record.

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

      orq.workspace_security.delete_domain(workspace_key="<value>", domain_id="<id>")

      # Use the SDK ...

  ```

  ```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() {
    await orq.workspaceSecurity.deleteDomain({
      workspaceKey: "<value>",
      domainId: "<id>",
    });

  }

  run();
  ```
</CodeGroup>

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

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

### Verify Domain

Checks DNS for the expected TXT record and marks the domain as verified when it matches.

<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.workspace_security.verify_domain(workspace_key="<value>", domain_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.workspaceSecurity.verifyDomain({
      workspaceKey: "<value>",
      domainId: "<id>",
    });

    console.log(result);
  }

  run();
  ```
</CodeGroup>

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

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

<Expandable title="Response">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "domain": {
            "id": str,
            "domain": str,
            "status": Literal["DOMAIN_VERIFICATION_STATUS_UNSPECIFIED", "DOMAIN_VERIFICATION_STATUS_PENDING", "DOMAIN_VERIFICATION_STATUS_VERIFIED"],
            "txt_name": str,
            "txt_value": str,
            "created_at": str,
            "expires_at": str,  # optional
            "verified_at": str,  # optional
            "created_by_id": Optional[str],
        },
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      domain: {
        id: string;
        domain: string;
        status: "DOMAIN_VERIFICATION_STATUS_UNSPECIFIED" | "DOMAIN_VERIFICATION_STATUS_PENDING" | "DOMAIN_VERIFICATION_STATUS_VERIFIED";
        txtName: string;
        txtValue: string;
        createdAt: Date;
        expiresAt?: Date;
        verifiedAt?: Date;
        createdById?: string;
      };
    }
    ```
  </CodeGroup>
</Expandable>

### Get Ip Allowlist

Returns the workspace IP allowlist and the current caller IP when available.

<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.workspace_security.get_ip_allowlist(workspace_key="<value>")

      # 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.workspaceSecurity.getIPAllowlist({
      workspaceKey: "<value>",
    });

    console.log(result);
  }

  run();
  ```
</CodeGroup>

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

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

<Expandable title="Response">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "ip_allowlist": {
            "enabled": bool,
            "ranges": [{
                "id": str,
                "cidr": str,
                "description": str,
                "created_at": str,
                "created_by_id": Optional[str],
            }],
        },
        "current_ip": str,
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      ipAllowlist: {
        enabled: boolean;
        ranges: {
          id: string;
          cidr: string;
          description: string;
          createdAt: Date;
          createdById?: string;
        }[];
      };
      currentIp: string;
    }
    ```
  </CodeGroup>
</Expandable>

### Update Ip Allowlist

Updates the workspace-level allowlist switch. Every listed range applies while the allowlist is enabled.

<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.workspace_security.update_ip_allowlist(workspace_key="<value>")

      # 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.workspaceSecurity.updateIPAllowlist({
      workspaceKey: "<value>",
      updateIPAllowlistRequest: {},
    });

    console.log(result);
  }

  run();
  ```
</CodeGroup>

<Expandable title="Parameters">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "workspace_key": str,  # required
        "enabled": Optional[bool],
    }
    ```

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

<Expandable title="Response">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "ip_allowlist": {
            "enabled": bool,
            "ranges": [{
                "id": str,
                "cidr": str,
                "description": str,
                "created_at": str,
                "created_by_id": Optional[str],
            }],
        },
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      ipAllowlist: {
        enabled: boolean;
        ranges: {
          id: string;
          cidr: string;
          description: string;
          createdAt: Date;
          createdById?: string;
        }[];
      };
    }
    ```
  </CodeGroup>
</Expandable>

### Add Ip Range

Adds an IPv4 or IPv6 CIDR range to the workspace allowlist.

<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.workspace_security.add_ip_range(workspace_key="<value>")

      # 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.workspaceSecurity.addIPRange({
      workspaceKey: "<value>",
      addIPRangeRequest: {},
    });

    console.log(result);
  }

  run();
  ```
</CodeGroup>

<Expandable title="Parameters">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "workspace_key": str,  # required
        "cidr": Optional[str],
        "description": Optional[str],
    }
    ```

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

<Expandable title="Response">
  <CodeGroup>
    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
        "range": {
            "id": str,
            "cidr": str,
            "description": str,
            "created_at": str,
            "created_by_id": Optional[str],
        },
    }
    ```

    ```typescript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      range: {
        id: string;
        cidr: string;
        description: string;
        createdAt: Date;
        createdById?: string;
      };
    }
    ```
  </CodeGroup>
</Expandable>

### Delete Ip Range

Permanently removes a CIDR range from the workspace allowlist.

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

      orq.workspace_security.delete_ip_range(workspace_key="<value>", range_id="<id>")

      # Use the SDK ...

  ```

  ```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() {
    await orq.workspaceSecurity.deleteIPRange({
      workspaceKey: "<value>",
      rangeId: "<id>",
    });

  }

  run();
  ```
</CodeGroup>

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

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