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

# SDK Overview

> Drop-in trust evaluation for any framework — TypeScript, Python, and middleware for Hono, Express, Next.js, and FastAPI

## Why Use an SDK?

The Cred Evaluation API returns a trust score, trust tier, per-gate breakdown, and optional dynamic pricing for any wallet address. You can call it directly with `fetch` or `httpx`, but the SDK packages give you:

* **Typed responses** — full TypeScript types and Python dataclasses, no parsing raw JSON
* **Framework middleware** — one line to gate every route with trust checks
* **Automatic 402/403 handling** — challenges and denials built in
* **Trust headers** — `X-Cred-Trust-Score` and `X-Cred-Trust-Tier` set on every response
* **Dynamic pricing** — trust-score-based price multipliers computed server-side

## Available Packages

<CardGroup cols={2}>
  <Card title="TypeScript SDK" icon="js" href="/sdks/typescript">
    Core client for Node.js, Deno, Bun, and edge runtimes. Zero dependencies beyond `fetch`.
  </Card>

  <Card title="Hono Middleware" icon="bolt" href="/sdks/hono">
    Drop-in middleware for Hono. One line to trust-gate your API.
  </Card>

  <Card title="Express Middleware" icon="server" href="/sdks/express">
    Express middleware with `req.credTrust` for downstream handlers.
  </Card>

  <Card title="Next.js Middleware" icon="react" href="/sdks/nextjs">
    Next.js edge middleware with route matching.
  </Card>

  <Card title="Python SDK" icon="python" href="/sdks/python">
    Async client and FastAPI `Depends()` integration.
  </Card>
</CardGroup>

## How It Works

Every SDK package calls the same backend endpoint:

```
POST https://validator.credprotocol.com/v1/evaluate
Authorization: Bearer cred_sk_...
```

The response includes:

| Field              | Description                                                 |
| ------------------ | ----------------------------------------------------------- |
| `trust_score`      | 0–100 normalized composite score                            |
| `trust_tier`       | `trusted`, `verified`, `limited`, `untrusted`, or `blocked` |
| `gate_results`     | Per-gate pass/fail with scores                              |
| `confidence`       | 0.0–1.0 based on data availability                          |
| `price_multiplier` | Dynamic pricing multiplier (if enabled)                     |
| `reputation`       | Behavioral history from ERC-8004 feedback                   |
| `challenge`        | Pre-built 402 challenge body (if gates failed)              |

The middleware packages wrap this into framework-native patterns — Hono `c.set()`, Express `req.credTrust`, Next.js response headers, FastAPI `Depends()`.

## Trust Tiers

| Tier          | Score  | Meaning                                           |
| ------------- | ------ | ------------------------------------------------- |
| **Trusted**   | 80–100 | Full access, lowest pricing. Proven track record. |
| **Verified**  | 60–79  | Standard access, standard pricing.                |
| **Limited**   | 30–59  | Restricted access, elevated pricing.              |
| **Untrusted** | 1–29   | Minimal access, maximum pricing.                  |
| **Blocked**   | 0      | Access denied. Critical gate failure.             |

## Policy Templates

Instead of configuring individual gates, use a named policy template:

| Template     | Gates                                 | Best For                                     |
| ------------ | ------------------------------------- | -------------------------------------------- |
| `basic`      | Human check only                      | Bot filtering, basic API protection          |
| `standard`   | Human + identity verification         | General API protection (recommended default) |
| `strict`     | Human + identity + established wallet | Financial services, sensitive data           |
| `financial`  | All gates, tight thresholds           | Lending, payments, credit                    |
| `reputation` | Weighted composite, dynamic pricing   | Tiered access, trust-to-earn                 |
| `quick`      | Human check, relaxed threshold        | Low-stakes endpoints                         |

## Getting Your API Key

The same API key works for both the Credit Scoring API (`api.credprotocol.com`) and the Trust Evaluation API (`validator.credprotocol.com`). One key, every Cred service.

<Steps>
  <Step title="Sign up at app.credprotocol.com">
    Go to [app.credprotocol.com](https://app.credprotocol.com) and create an account.
  </Step>

  <Step title="Create an API key">
    Navigate to **API Keys** in the dashboard and click **Create API Key**. Copy the key — it is shown exactly once.
  </Step>

  <Step title="Set it as an environment variable">
    ```bash theme={null}
    export CRED_API_KEY=your_api_key_here
    ```
  </Step>
</Steps>

<Info>
  Your API key works across all Cred endpoints — credit scores, reports, identity attestations, and trust evaluation. No separate keys needed.
</Info>

## Next Steps

Pick the package that matches your stack and follow the integration guide:

* [TypeScript SDK](/sdks/typescript) — if you want full control
* [Hono Middleware](/sdks/hono) — fastest path for Hono/Cloudflare Workers
* [Express Middleware](/sdks/express) — for Express/Node.js APIs
* [Next.js Middleware](/sdks/nextjs) — for Next.js edge middleware
* [Python SDK](/sdks/python) — for Python/FastAPI services
