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

# SDK Overview

> Official client libraries for Python, JavaScript, Go, and more

## Official SDKs

OathNet provides official client libraries to simplify API integration:

<CardGroup cols={2}>
  <Card title="Python SDK" icon="python" href="/sdks/python">
    `pip install oathnet`

    Async support, type hints, and comprehensive error handling
  </Card>

  <Card title="JavaScript SDK" icon="js" href="/sdks/javascript">
    `npm install oathnet`

    TypeScript support, browser and Node.js compatible. Source: [oathnet/oathnet-js](https://github.com/oathnet/oathnet-js)
  </Card>

  <Card title="Go SDK" icon="golang" href="/sdks/go">
    `go get github.com/oathnet/oathnet-go`

    Idiomatic Go with context support. Source: [oathnet/oathnet-go](https://github.com/oathnet/oathnet-go)
  </Card>

  <Card title="CLI Tool" icon="terminal" href="/sdks/cli">
    `npx oathnet` or `go install`

    Command-line interface for all API operations
  </Card>

  <Card title="cURL Examples" icon="code" href="/sdks/curl">
    Copy-paste examples for quick testing
  </Card>
</CardGroup>

## Quick Comparison

| Feature            | Python     | JavaScript | Go     | CLI |
| ------------------ | ---------- | ---------- | ------ | --- |
| Async Support      | ✓          | ✓          | ✓      | -   |
| Type Safety        | Type hints | TypeScript | Native | -   |
| Auto-retry         | ✓          | ✓          | ✓      | ✓   |
| Pagination Helpers | ✓          | ✓          | ✓      | ✓   |
| JSON Output        | ✓          | ✓          | ✓      | ✓   |

## Installation

<CodeGroup>
  ```bash Python theme={null}
  pip install oathnet
  ```

  ```bash JavaScript theme={null}
  npm install oathnet

  # Or with yarn/pnpm
  yarn add oathnet
  pnpm add oathnet
  ```

  ```bash Go theme={null}
  go get github.com/oathnet/oathnet-go
  ```

  ```bash CLI theme={null}
  # Using npx (no install)
  npx oathnet --help

  # Global install
  npm install -g oathnet

  # Go CLI
  go install github.com/oathnet/oathnet-go/cmd/oathnet@latest
  ```
</CodeGroup>

## Source Repositories

| SDK                     | Repository                                                  |
| ----------------------- | ----------------------------------------------------------- |
| Python                  | [oathnet/oathnet-py](https://github.com/oathnet/oathnet-py) |
| JavaScript / TypeScript | [oathnet/oathnet-js](https://github.com/oathnet/oathnet-js) |
| Go                      | [oathnet/oathnet-go](https://github.com/oathnet/oathnet-go) |

## Quick Start

<CodeGroup>
  ```python Python theme={null}
  import os
  from oathnet import OathNetClient

  client = OathNetClient(api_key="your-api-key")

  # Search breaches
  result = client.search.breach("user@example.com")
  print(f"Found {result.data.results_found} results")

  for record in result.data.results:
      print(f"  {record.email} - {record.dbname}")
  ```

  ```javascript JavaScript theme={null}
  import { OathNetClient } from 'oathnet';

  const client = new OathNetClient('your-api-key');

  // Search breaches
  const result = await client.search.breach("user@example.com");
  console.log(`Found ${result.data?.results_found} results`);

  for (const record of result.data?.results || []) {
    console.log(`  ${record.email} - ${record.dbname}`);
  }
  ```

  ```go Go theme={null}
  package main

  import (
      "context"
      "fmt"
      "log"
      "github.com/oathnet/oathnet-go/pkg/oathnet"
  )

  func main() {
      client, err := oathnet.NewClient("your-api-key")
      if err != nil {
          log.Fatal(err)
      }

      ctx := context.Background()
      result, err := client.Search.Breach(ctx, "user@example.com", nil)
      if err != nil {
          log.Fatal(err)
      }

      fmt.Printf("Found %d results\n", result.Data.ResultsFound)
      for _, record := range result.Data.Results {
          fmt.Printf("  %s - %s\n", record.Email, record.DBName)
      }
  }
  ```

  ```bash CLI theme={null}
  # Set API key
  export OATHNET_API_KEY="your-api-key"

  # Search breaches
  oathnet search breach -q "user@example.com"

  # V2 Stealer search
  oathnet stealer search -q "user@example.com" --has-log-id

  # OSINT lookup
  oathnet osint ip 8.8.8.8
  ```
</CodeGroup>

## Common Features

### Authentication

```python theme={null}
import os
from oathnet import OathNetClient

# Explicit API key (required)
client = OathNetClient(api_key="your-api-key")

# From environment variable
client = OathNetClient(api_key=os.environ["OATHNET_API_KEY"])
```

### Error Handling

SDKs provide typed exceptions:

```python theme={null}
from oathnet.exceptions import (
    AuthenticationError,
    RateLimitError,
    NotFoundError,
    OathNetError
)

try:
    result = client.search.breach("user@example.com")
except AuthenticationError:
    print("Check your API key")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except NotFoundError:
    print("Resource not found")
except OathNetError as e:
    print(f"API error: {e.message}")
```

### Pagination

SDKs support cursor-based pagination:

```python theme={null}
# First page
result = client.stealer.search("@company.com", page_size=25)
print(f"Page 1: {len(result.data.items)} items")

# Next page using cursor
if result.data.next_cursor:
    result = client.stealer.search("@company.com", cursor=result.data.next_cursor)
    print(f"Page 2: {len(result.data.items)} items")
```

### Rate Limiting

Built-in rate limiting respects API quotas:

```python theme={null}
# Auto-throttle is enabled by default
client = OathNetClient(
    timeout=30.0  # Request timeout in seconds
)
```

## SDK vs Direct API

| Use Case             | Recommendation |
| -------------------- | -------------- |
| Quick integration    | SDK            |
| Custom HTTP client   | Direct API     |
| Unsupported language | Direct API     |
| Maximum control      | Direct API     |
| Type safety          | SDK            |
| Auto-retry           | SDK            |

## Community SDKs

Community-maintained libraries (not officially supported):

| Language | Package           | Maintainer |
| -------- | ----------------- | ---------- |
| Ruby     | `oathnet-ruby`    | @community |
| PHP      | `oathnet/php-sdk` | @community |
| Rust     | `oathnet-rs`      | @community |

<Warning>
  Community SDKs are not officially maintained. Use at your own risk.
</Warning>

## Next Steps

<CardGroup cols={2}>
  <Card title="Python SDK" icon="python" href="/sdks/python">
    Full Python documentation
  </Card>

  <Card title="JavaScript SDK" icon="js" href="/sdks/javascript">
    Full JavaScript documentation
  </Card>

  <Card title="Go SDK" icon="golang" href="/sdks/go">
    Full Go documentation
  </Card>

  <Card title="CLI Tool" icon="terminal" href="/sdks/cli">
    Command-line interface guide
  </Card>
</CardGroup>
