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

# Installation and Setup

> Install and configure the Oso Cloud SDKs.

## Installation

**Node.js**

Install the Oso Cloud Node.js client:

```bash theme={null}
npm install oso-cloud@2.7.0
```

**Requirements:**

* Node.js 16 or later
* TypeScript support included

Install the Oso Cloud Python client:

```bash theme={null}
pip install oso-cloud==2.6.0
```

**Requirements:**

* Python 3.8 or later

Install the Oso Cloud Go client:

```bash theme={null}
go get github.com/osohq/go-oso-cloud/v2@latest
```

**Requirements:**

* Go 1.19 or later

Add the Oso Cloud Java client to your project:

**Maven:**

```xml theme={null}
<dependency>
    <groupId>com.osohq</groupId>
    <artifactId>oso-cloud</artifactId>
    <version>LATEST</version>
</dependency>
```

**Gradle:**

```groovy theme={null}
implementation 'com.osohq:oso-cloud:LATEST'
```

See [Maven Central page for com.osohq:oso-cloud](https://central.sonatype.com/artifact/com.osohq/oso-cloud) for the latest version.

**Requirements:**

* Java 11 or later

Install the Oso Cloud Ruby gem:

```bash theme={null}
gem install oso-cloud -v 1.11.2
```

Or add to Gemfile:

```ruby theme={null}
gem 'oso-cloud', '~> 1.11.2'
```

**Requirements:**

* Ruby 3.0 or later

Install the Oso Cloud .NET package:

```bash theme={null}
dotnet add package OsoCloud --version 1.10.0
```

**Requirements:**

* .NET 6.0 or later

**CLI**

**macOS/Linux**

Install the Oso Cloud CLI:

```bash theme={null}
curl -L https://cloud.osohq.com/install.sh | bash
```

Verify installation:

```bash theme={null}
which oso-cloud
```

**Requirements:**

* Unix-like system (Linux, macOS)
* curl

**Windows**

Download and install the CLI executable:

```powershell theme={null}
Invoke-WebRequest "https://d3i4cc4dqewpo9.cloudfront.net/latest/oso_cli.exe" -OutFile C:\<your_oso_cli_folder>\oso_cli.exe
```

Replace `<your_oso_cli_folder>` with your preferred installation directory.

Verify installation:

```powershell theme={null}
C:\<your_oso_cli_folder>\oso_cli --help
```

**Requirements:**

* Windows PowerShell
* Internet connection

## Environment Setup

First, [create or find an API key](https://ui.osohq.com/settings/?tab=api-keys) for your environment.

### macOS/Linux

Export the API key as `OSO_AUTH`:

```bash theme={null}
export OSO_AUTH=<your_oso_api_key>
```

### Windows

Store the API key as OSO\_AUTH for the current session:

```powershell theme={null}
Set-Item -Path env:OSO_AUTH -Value "<your_oso_api_key>"
```

## Client Initialization

**Node.js**

```javascript theme={null}
import { Oso } from 'oso-cloud';

const oso = new Oso(
  "https://cloud.osohq.com", 
  YOUR_API_KEY,
  {
    fallbackUrl: "http://localhost:8080",              // Optional: fallback server
    fetchTimeoutMillis: 1000,                          // Optional: timeout per request attempt
    dataBindings: "path/to/local_authorization_config.yaml"  // Optional: local auth config
  }
);
```

**TypeScript Support**

Generate TypeScript types from your policy:

```bash theme={null}
oso-cloud generate-types typescript path/to/policy.polar > path/to/polarTypes.d.ts
```

Then use with your client:

```typescript theme={null}
import type { PolarTypes } from "./polarTypes";

const oso = new Oso<PolarTypes>("https://cloud.osohq.com", YOUR_API_KEY);
```

**Signature:** `new Oso(url, apiKey, options?)`

```python theme={null}
from oso_cloud import Oso

oso = Oso(
    url="https://cloud.osohq.com", 
    api_key=YOUR_API_KEY,
    fallback_url="http://localhost:8080",              # Optional: fallback server
    data_bindings="path/to/local_authorization_config.yaml"  # Optional: local auth config
)
```

**Signature:** `Oso(url, api_key, fallback_url=None, data_bindings=None)`

```go theme={null}
import (
    "net/http"
    "time"

    oso "github.com/osohq/go-oso-cloud/v2"
)

// Basic client
osoClient := oso.NewClient("https://cloud.osohq.com", YOUR_API_KEY)

// With fallback URL
osoClient := oso.NewClientWithFallbackUrl(
    "https://cloud.osohq.com", 
    YOUR_API_KEY, 
    "http://localhost:8080"  // Optional: fallback server
)

// With data bindings
osoClient := oso.NewClientWithDataBindings(
    "https://cloud.osohq.com", 
    YOUR_API_KEY, 
    "path/to/local_authorization_config.yaml"  // Optional: local auth config
)

// With ClientOptions (e.g. a custom *http.Client, combinable with any other option)
osoClient := oso.NewClientWithOptions(
    "https://cloud.osohq.com",
    YOUR_API_KEY,
    oso.ClientOptions{
        FallbackUrl:  "http://localhost:8080",              // Optional: fallback server
        DataBindings: "path/to/local_authorization_config.yaml",  // Optional: local auth config
        HttpClient:   &http.Client{Timeout: 5 * time.Second},     // Optional: custom *http.Client
    },
)
```

**Signature:** `oso.NewClient(url, apiKey)`, or `oso.NewClientWithOptions(url, apiKey, oso.ClientOptions{...})` for `FallbackUrl`, `Logger`, `DataBindings`, and `HttpClient`

```java theme={null}
import com.osohq.oso.Oso;

Oso oso = new Oso(
    YOUR_API_KEY,
    null,                                              // Optional: custom URL (null = default)
    URI.create("http://localhost:8080"),               // Optional: fallback server
    "path/to/local_authorization_config.yaml"         // Optional: local auth config
);
```

**Signature:** `new Oso(apiKey, url?, fallbackUrl?, dataBindings?)`

```ruby theme={null}
require 'oso-cloud'

oso = OsoCloud::Oso.new(
  url: "https://cloud.osohq.com", 
  api_key: YOUR_API_KEY,
  fallback_url: "http://localhost:8080",              # Optional: fallback server
  data_bindings: "path/to/local_authorization_config.yaml"  # Optional: local auth config
)
```

**Signature:** `OsoCloud::Oso.new(url:, api_key:, fallback_url:, data_bindings:)`

```csharp theme={null}
using OsoCloud;

var oso = new Oso(
    "https://api.osohq.com", 
    YOUR_API_KEY,
    "http://localhost:8080",                           // Optional: fallback server
    dataBindings: "path/to/local_authorization_config.yaml"  // Optional: local auth config
);
```

**Signature:** `new Oso(url, apiKey, fallbackUrl?, dataBindings?)`

**CLI**

**Basic Usage**

```bash theme={null}
# macOS/Linux
oso-cloud <command> [options]

# Windows  
oso_cli <command> [options]
```

**Global Options**

The CLI supports the following global options:

* **`-v`/`--verbose`**: Increases verbosity of log output
* **`-q`/`--quiet`**: Suppresses informational log output
* **`--json`**: Outputs log messages as JSON objects
* **`--debug-http`**: Outputs detailed HTTP request information
* **`--disable-self-update-check`**: Skips automatic version check
* **`--dns-servers`**: Sets custom DNS nameservers
* **`--ca-path`**: Adds custom CA bundle to trust store

**Configuration**

The CLI uses the `OSO_AUTH` environment variable for authentication. Make sure you've set it as described in the Environment Setup section above.


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