> ## 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 cover every endpoint you can use today, with typed requests and responses; endpoints marked unavailable are added when they return. They are open source (MIT) and send your key in the `X-API-KEY` header.

> [tab] JS & TS
>
> **1. Create an API key**
>
> Under [Settings → Developer](https://www.osintcat.net/account/developer), create a key. Choose its scopes and how long it works. The key is shown once: copy it.
>
> **2. Install the SDK**
>
> Node.js 18 or later, Bun, Deno or Cloudflare Workers. No dependencies.
>
> ```sh theme={null}
> npm install osintcat
> ```
>
> **3. Set your key**
>
> The SDK reads the key from the `OSINTCAT_API_KEY` environment variable. Keep it out of your code, and never ship it in a browser or mobile app.
>
> ```sh macOS / Linux theme={null}
> export OSINTCAT_API_KEY="cat_..."
> ```
>
> ```powershell Windows theme={null}
> $env:OSINTCAT_API_KEY = "cat_..."
> ```
>
> **4. Make your first request**
>
> Save this as `first.mjs` and run `node first.mjs`. It shows your plan and how many lookups are left today.
>
> ```typescript first.mjs theme={null}
> import { OsintCatClient } from "osintcat";
>
> const client = new OsintCatClient(); // reads OSINTCAT_API_KEY
>
> const result = await client.account.get();
> console.log(result);
> ```
>
> **5. Handle errors**
>
> Every answer other than 2xx raises an error with the status code and the answer, which names a `request_id` (a server error also an `error_id`): quote it to support. A lookup that fails is not charged.
>
> ```typescript theme={null}
> import { OsintCat, OsintCatClient, OsintCatError } from "osintcat";
>
> const client = new OsintCatClient();
>
> try {
>     const result = await client.breach.search({ query: "user@example.com" });
>     console.log(result.results_count);
> } catch (err) {
>     if (err instanceof OsintCat.TooManyRequestsError) {
>         console.log("Daily allowance used up, or too many requests: try again later.");
>     } else if (err instanceof OsintCatError) {
>         // err.body carries error, message and request_id (plus error_id on a server error)
>         console.log(err.statusCode, err.body);
>     } else {
>         throw err;
>     }
> }
> ```
>
> Every endpoint page shows its call in each language. Source and issues: [github.com/OsintCatHQ/osintcat-typescript](https://github.com/OsintCatHQ/osintcat-typescript).

> [tab] Python
>
> **1. Create an API key**
>
> Under [Settings → Developer](https://www.osintcat.net/account/developer), create a key. Choose its scopes and how long it works. The key is shown once: copy it.
>
> **2. Install the SDK**
>
> 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"
> ```
>
> > [!WARNING]
> >
> > Do not `pip install osintcat` for now: that name on PyPI still holds an old client that does not work with the API.
>
> **3. Set your key**
>
> The SDK reads the key from the `OSINTCAT_API_KEY` environment variable. Keep it out of your code, and never ship it in a browser or mobile app.
>
> ```sh macOS / Linux theme={null}
> export OSINTCAT_API_KEY="cat_..."
> ```
>
> ```powershell Windows theme={null}
> $env:OSINTCAT_API_KEY = "cat_..."
> ```
>
> **4. Make your first request**
>
> Save this as `first.py` and run `python first.py`. It shows your plan and how many lookups are left today.
>
> ```python first.py theme={null}
> from osintcat import OsintCat
>
> client = OsintCat()  # reads OSINTCAT_API_KEY
>
> result = client.account.get()
> print(result)
> ```
>
> **5. Handle errors**
>
> Every answer other than 2xx raises an error with the status code and the answer, which names a `request_id` (a server error also an `error_id`): quote it to support. A lookup that fails is not charged.
>
> ```python theme={null}
> from osintcat import OsintCat
> from osintcat.core.api_error import ApiError
> from osintcat.errors import TooManyRequestsError
>
> client = OsintCat()
>
> try:
>     result = client.breach.search(query="user@example.com")
>     print(result.results_count)
> except TooManyRequestsError:
>     print("Daily allowance used up, or too many requests: try again later.")
> except ApiError as err:
>     # err.body carries error, message and request_id (plus error_id on a server error)
>     print(err.status_code, err.body)
> ```
>
> Every endpoint page shows its call in each language. Source and issues: [github.com/OsintCatHQ/osintcat-python](https://github.com/OsintCatHQ/osintcat-python).

> [tab] Go
>
> **1. Create an API key**
>
> Under [Settings → Developer](https://www.osintcat.net/account/developer), create a key. Choose its scopes and how long it works. The key is shown once: copy it.
>
> **2. Install the SDK**
>
> Go 1.21 or later.
>
> ```sh theme={null}
> go get github.com/OsintCatHQ/osintcat-go
> ```
>
> **3. Set your key**
>
> The SDK reads the key from the `OSINTCAT_API_KEY` environment variable. Keep it out of your code, and never ship it in a browser or mobile app.
>
> ```sh macOS / Linux theme={null}
> export OSINTCAT_API_KEY="cat_..."
> ```
>
> ```powershell Windows theme={null}
> $env:OSINTCAT_API_KEY = "cat_..."
> ```
>
> **4. Make your first request**
>
> Save this as `main.go` and run `go run .`. It shows your plan and how many lookups are left today.
>
> ```go main.go theme={null}
> package main
>
> import (
> 	"context"
> 	"fmt"
>
> 	osintcatclient "github.com/OsintCatHQ/osintcat-go/client"
> )
>
> func main() {
> 	client := osintcatclient.NewClient() // reads OSINTCAT_API_KEY
> 	result, err := client.Account.Get(context.Background())
> 	if err != nil {
> 		panic(err)
> 	}
> 	fmt.Printf("%+v\n", result)
> }
> ```
>
> **5. Handle errors**
>
> Every answer other than 2xx raises an error with the status code and the answer, which names a `request_id` (a server error also an `error_id`): quote it to support. A lookup that fails is not charged.
>
> ```go theme={null}
> package main
>
> import (
> 	"context"
> 	"errors"
> 	"fmt"
>
> 	osintcat "github.com/OsintCatHQ/osintcat-go"
> 	osintcatclient "github.com/OsintCatHQ/osintcat-go/client"
> 	"github.com/OsintCatHQ/osintcat-go/core"
> )
>
> func main() {
> 	client := osintcatclient.NewClient()
> 	result, err := client.Breach.Search(context.Background(), &osintcat.SearchBreachRequest{Query: "user@example.com"})
> 	var limited *osintcat.TooManyRequestsError
> 	var apiErr *core.APIError
> 	switch {
> 	case errors.As(err, &limited):
> 		fmt.Println("Daily allowance used up, or too many requests: try again later.")
> 	case errors.As(err, &apiErr):
> 		// the error text carries the answer: error, message and request_id (plus error_id on a server error)
> 		fmt.Println(apiErr.StatusCode, err)
> 	case err != nil:
> 		panic(err)
> 	default:
> 		fmt.Println(*result.ResultsCount)
> 	}
> }
> ```
>
> Every endpoint page shows its call in each language. Source and issues: [github.com/OsintCatHQ/osintcat-go](https://github.com/OsintCatHQ/osintcat-go).

> [tab] PHP
>
> **1. Create an API key**
>
> Under [Settings → Developer](https://www.osintcat.net/account/developer), create a key. Choose its scopes and how long it works. The key is shown once: copy it.
>
> **2. Install the SDK**
>
> PHP 8.1 or later. The SDK sends requests through any PSR-18 HTTP client, such as Guzzle.
>
> ```sh theme={null}
> composer require osintcat/osintcat-php guzzlehttp/guzzle
> ```
>
> **3. Set your key**
>
> The SDK reads the key from the `OSINTCAT_API_KEY` environment variable. Keep it out of your code, and never ship it in a browser or mobile app.
>
> ```sh macOS / Linux theme={null}
> export OSINTCAT_API_KEY="cat_..."
> ```
>
> ```powershell Windows theme={null}
> $env:OSINTCAT_API_KEY = "cat_..."
> ```
>
> **4. Make your first request**
>
> Save this as `first.php` and run `php first.php`. It shows your plan and how many lookups are left today.
>
> ```php first.php theme={null}
> <?php
> require __DIR__ . '/vendor/autoload.php';
>
> use OsintCat\OsintCatClient;
>
> $client = new OsintCatClient(); // reads OSINTCAT_API_KEY
>
> $result = $client->account->get();
> echo json_encode($result, JSON_PRETTY_PRINT), PHP_EOL;
> ```
>
> **5. Handle errors**
>
> Every answer other than 2xx raises an error with the status code and the answer, which names a `request_id` (a server error also an `error_id`): quote it to support. A lookup that fails is not charged.
>
> ```php theme={null}
> <?php
> require __DIR__ . '/vendor/autoload.php';
>
> use OsintCat\OsintCatClient;
> use OsintCat\Breach\Requests\SearchBreachRequest;
> use OsintCat\Exceptions\OsintcatApiException;
>
> $client = new OsintCatClient();
>
> try {
>     $result = $client->breach->search(new SearchBreachRequest(['query' => 'user@example.com']));
>     echo $result->resultsCount, PHP_EOL;
> } catch (OsintcatApiException $e) {
>     if ($e->getCode() === 429) {
>         echo 'Daily allowance used up, or too many requests: try again later.', PHP_EOL;
>     } else {
>         // the body carries error, message and request_id (plus error_id on a server error)
>         echo $e->getCode(), ' ', json_encode($e->getBody()), PHP_EOL;
>     }
> }
> ```
>
> Every endpoint page shows its call in each language. Source and issues: [github.com/OsintCatHQ/osintcat-php](https://github.com/OsintCatHQ/osintcat-php).

## Retries and timeouts

The SDKs do not retry on their 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, so you decide when to try again. TypeScript and Python requests time out after 60 seconds; in Go pass a context with a deadline, and in PHP set `timeout` in the client options.

## 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: `npm install osintcat@latest`.


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