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

# SDKs

> Official client libraries for the OsintCat API

The official SDKs wrap every endpoint in this documentation with typed requests and responses. They send
your key in the `X-API-KEY` header and read it from the `OSINTCAT_API_KEY` environment variable when you do
not pass one.

## JavaScript and TypeScript

Runs on Node.js 18+, Bun, Deno and Cloudflare Workers, with no dependencies.

```sh theme={null}
npm install osintcat
```

```typescript theme={null}
import { OsintCat, OsintCatClient } from "osintcat";

const client = new OsintCatClient({ apiKey: process.env.OSINTCAT_API_KEY });

const account = await client.account.get();
console.log(account.account_info?.plan, account.usage?.requests_remaining_today);

const breach = await client.breach.search({ query: "user@example.com" });
console.log(breach.results_count);

try {
    await client.github.profile({ username: "octocat" });
} catch (err) {
    if (err instanceof OsintCat.TooManyRequestsError) {
        // allowance used up, or slow down
    }
}
```

Every method is named after its endpoint group: `client.breach.search()`, `client.github.profile()`,
`client.dns.resolve()`. Any answer other than 2xx throws an error with the status code and the body
described in [Errors](/api-reference/introduction#errors).

<Note>
  The SDK does not retry on its own. A lookup retried after a timeout may already have been counted or
  charged, and `429 LIMIT_REACHED` cannot succeed before the allowance resets at 00:00 UTC.
</Note>

<Warning>
  Keep your API key on the server. Never ship it in a browser or mobile app.
</Warning>

## Go

Go 1.21 or later.

```sh theme={null}
go get github.com/OsintCatHQ/osintcat-go
```

```go theme={null}
import (
	"context"
	"errors"
	"fmt"

	osintcat "github.com/OsintCatHQ/osintcat-go"
	osintcatclient "github.com/OsintCatHQ/osintcat-go/client"
)

client := osintcatclient.NewClient() // reads OSINTCAT_API_KEY
breach, err := client.Breach.Search(context.Background(), &osintcat.SearchBreachRequest{Query: "user@example.com"})
var limited *osintcat.TooManyRequestsError
if errors.As(err, &limited) {
	// allowance used up, or slow down
} else if err == nil {
	fmt.Println(*breach.ResultsCount)
}
```

## Python

Python 3.10 or later. Until the SDK is on PyPI, install it from GitHub:

```sh theme={null}
pip install "git+https://github.com/OsintCatHQ/osintcat-python@main"
```

```python theme={null}
from osintcat import OsintCat
from osintcat.errors import TooManyRequestsError

client = OsintCat()  # reads OSINTCAT_API_KEY
try:
    breach = client.breach.search(query="user@example.com")
    print(breach.results_count)
except TooManyRequestsError:
    pass  # allowance used up, or slow down
```

<Warning>
  Do not `pip install osintcat` for now: that name on PyPI still holds an old client that does not work
  with the API.
</Warning>

## Source code

The SDKs are open source (MIT):
[TypeScript](https://github.com/OsintCatHQ/osintcat-typescript),
[Python](https://github.com/OsintCatHQ/osintcat-python),
[Go](https://github.com/OsintCatHQ/osintcat-go).

## Upgrading from osintcat 1.x

Versions 1.x of the npm package were an older client that no longer works with the API. Version 2 is
the SDK described here; install it with `npm install osintcat@latest`.


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