> ## Documentation Index
> Fetch the complete documentation index at: https://blackswan-23965643.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Install the BlackSwan JavaScript or Python SDK Today

> Install and configure the BlackSwan JavaScript or Python SDK, or call the REST API directly with no setup. Node.js 16+ or Python 3.8+ required.

BlackSwan gives you three ways to integrate credit infrastructure into your application: the REST API (no install required), the JavaScript/TypeScript SDK, or the Python SDK. Choose the approach that matches your stack — all three expose the same underlying data and behave identically across supported testnets.

***

## REST API

The REST API requires no installation, no SDK, and no authentication on testnet. Send standard HTTP requests from any environment — a browser, a server, a script, or a CI pipeline.

```bash theme={null}
curl https://api.blackswanfinance.xyz/v1/credit/0x4EEA76237a91880B1c8B7a1c740610fFC0306EE4
```

The API base URL is `https://api.blackswanfinance.xyz`. All endpoints accept `GET` requests and return JSON. See the [API Reference](/api/credit) for the full endpoint catalog.

***

## JavaScript SDK

The JavaScript SDK supports Node.js 16+ and modern browsers. It ships with full TypeScript type definitions and exposes an async-first interface built on top of `ethers.js`.

**Requirements**

* Node.js 16 or higher
* An RPC provider URL for the target network (Alchemy, Infura, QuickNode, or any compatible endpoint)

**Install**

<CodeGroup>
  ```bash npm theme={null}
  npm install blackswan-sdk
  ```

  ```bash yarn theme={null}
  yarn add blackswan-sdk
  ```

  ```bash pnpm theme={null}
  pnpm add blackswan-sdk
  ```
</CodeGroup>

**Initialize the client**

```typescript theme={null}
import { BlackSwanClient } from "blackswan-sdk";

const client = new BlackSwanClient({
  network: "amoy",                  // "amoy" | "sepolia"
  rpcUrl: "https://polygon-amoy.g.alchemy.com/v2/YOUR_ALCHEMY_KEY",
});
```

**Fetch a credit dashboard**

```typescript theme={null}
const dashboard = await client.getCreditDashboard(
  "0x4EEA76237a91880B1c8B7a1c740610fFC0306EE4"
);

console.log(dashboard.trustRatio);      // 7700
console.log(dashboard.trustTierScore);  // "C"
console.log(dashboard.currentApr);      // 142
```

***

## Python SDK

The Python SDK supports Python 3.8+ and is available on PyPI. It provides synchronous and async interfaces and is compatible with any WSGI or ASGI framework.

**Requirements**

* Python 3.8 or higher
* An RPC provider URL for the target network

**Install**

```bash theme={null}
pip install blackswan-sdk-py
```

**Initialize the client**

```python theme={null}
from blackswan import BlackSwanClient

client = BlackSwanClient(
    network="amoy",           # "amoy" or "sepolia"
    rpc_url="https://polygon-amoy.g.alchemy.com/v2/YOUR_ALCHEMY_KEY",
)
```

**Fetch a credit dashboard**

```python theme={null}
dashboard = client.get_credit_dashboard(
    "0x4EEA76237a91880B1c8B7a1c740610fFC0306EE4"
)

print(dashboard.trust_ratio)       # 7700
print(dashboard.trust_tier_score)  # C
print(dashboard.current_apr)       # 142
```

***

<Note>
  Both SDKs require an RPC provider URL to communicate with the underlying blockchain. You can get a free endpoint from [Alchemy](https://www.alchemy.com), [Infura](https://www.infura.io), or [QuickNode](https://www.quicknode.com). The RPC URL is only used for on-chain reads — no transactions or signing are required.
</Note>
