# Protocols

Access the scored protocol registry. Composite score (0–10, lower = safer) plus six risk dimensions, audits, incidents, per-chain TVL, and score history.

```
GET  /v1/protocols

List all scored protocols
```

Returns a paginated, filterable list of scored protocols.

### 7.1 List Protocols

#### Authentication

Optional. Anonymous requests are rate-limited by IP. Pass `X-API-Key` for higher limits and (later) tiered quotas.

#### Query Parameters

| **Parameter**      | **Type** | **Required** | **Description**                                                                  |
| ------------------ | -------- | ------------ | -------------------------------------------------------------------------------- |
| page               | integer  | No           | Page number. Default: `1`                                                        |
| per\_page          | integer  | No           | Results per page. Default: `20`. Max: `100`                                      |
| chain              | string   | No           | Chain filter. Supports comma-separated lists (e.g. `"Ethereum,Solana,Base"`)     |
| category           | string   | No           | Category filter. Supports comma-separated lists (e.g. `"Lending,Risk Curators"`) |
| min\_credit\_score | number   | No           | Minimum composite score (0–10)                                                   |
| sort\_by           | string   | No           | `"compositeScore"` \| `"tvl"` \| `"name"`. Default: `"compositeScore"`           |
| sort\_dir          | string   | No           | `"asc"` \| `"desc"`. Default: `"desc"`                                           |

#### Response Codes

| **Code** | **Meaning**                                  |
| -------- | -------------------------------------------- |
| 200      | Success. PaginatedResponse\<ProtocolSummary> |
| 400      | Invalid query parameters                     |
| 429      | Rate limit exceeded                          |

#### Example: Safest Solana lending protocols

```typescript
const res = await fetch(
  "https://api.diapleo.xyz/v1/protocols?chain=Solana&category=Lending&sort_by=compositeScore&sort_dir=asc&per_page=5",
  { headers: { "X-API-Key": process.env.DIAPLEO_API_KEY! } },
);
const { data, meta } = await res.json();
```

#### Example Response

```json
{
  "success": true,
  "data": [
    {
      "id": "kamino-lend",
      "slug": "kamino-lend",
      "name": "Kamino Lend",
      "category": "Lending",
      "chains": ["Solana"],
      "logoUrl": "https://icons.llama.fi/kamino-lend.jpg",
      "url": "https://kamino.com/",
      "twitter": "Kamino",
      "coverageScore": 2,
      "compositeScore": 1.65,
      "riskLevel": "low",
      "tvlUsd": 1503864026.97,
      "scoreHistory": [1.68, 1.67, 1.66, 1.65, 1.65, 1.65, 1.66, 1.65, 1.65, 1.65, 1.65, 1.65],
      "scoredAt": "2026-04-21T11:58:35.516Z"
    }
  ],
  "meta": { "total": 127, "page": 1, "limit": 5, "pageCount": 26 }
}
```

***

```
GET  /v1/protocols/{id}

Get full protocol detail
```

Returns the complete protocol record — composite, six-dimension breakdown with 30-day trend, per-chain TVL, score history, audit trail, incident log, and similar protocols.

### 7.2 Get Protocol Detail

#### Authentication

Optional.

#### Path Parameters

| **Parameter** | **Type** | **Required** | **Description**                                                 |
| ------------- | -------- | ------------ | --------------------------------------------------------------- |
| id            | string   | Yes          | Protocol ID (DeFiLlama slug, e.g. `"aave-v3"`, `"kamino-lend"`) |

#### Response Codes

| **Code** | **Meaning**                              |
| -------- | ---------------------------------------- |
| 200      | Success. SingleResponse\<ProtocolDetail> |
| 404      | Protocol not found                       |

#### Example Request

```typescript
const res = await fetch("https://api.diapleo.xyz/v1/protocols/kamino-lend", {
  headers: { "X-API-Key": process.env.DIAPLEO_API_KEY! },
});
const { data: protocol } = await res.json();
```

#### Example Response

```json
{
  "success": true,
  "data": {
    "id": "kamino-lend",
    "slug": "kamino-lend",
    "name": "Kamino Lend",
    "category": "Lending",
    "chains": ["Solana"],
    "coverageScore": 2,
    "tokenSymbol": "KMNO",
    "auditCount": 2,
    "oracleConfig": [
      { "name": "Pyth",        "type": "Aggregator", "proof": ["https://docs.kamino.finance/risk/oracles"] },
      { "name": "Switchboard", "type": "Aggregator", "proof": ["https://github.com/DefiLlama/defillama-server/pull/9552"] },
      { "name": "Chainlink",   "type": "Aggregator", "proof": ["https://gov.kamino.finance/t/kamino-integrates-chainlink-data-streams/550"], "startDate": "2025-04-29" }
    ],
    "description": "Kamino Lend (K-Lend) is a novel peer-to-pool borrowing primitive…",
    "url": "https://kamino.com/",
    "logoUrl": "https://icons.llama.fi/kamino-lend.jpg",
    "twitter": "Kamino",
    "parentSlug": "kamino",
    "listedAt": "2023-11-10T11:25:28.000Z",
    "tvlUsd": 1503864026.97,
    "tvl30d": 0.082,
    "chainTvls": [
      { "chain": "Solana", "tvlUsd": 1503864026.97, "borrowedUsd": 1005107428.62 }
    ],
    "composite": 1.65,
    "riskLevel": "low",
    "scoredAt": "2026-04-21T11:58:35.516Z",
    "dimensions": {
      "credit":        { "score": 4.0, "trend":  0.1, "label": "Credit",         "desc": "Collateralization, liquidations, utilisation caps." },
      "counterparty":  { "score": 1.2, "trend":  0.0, "label": "Counterparty",   "desc": "Governance, multisigs, upgrade rights, guardians." },
      "liquidity":     { "score": 2.0, "trend": -0.1, "label": "Liquidity",      "desc": "Depth, slippage, withdrawal routes under stress." },
      "oracle":        { "score": 1.0, "trend":  0.0, "label": "Oracle",         "desc": "Price feed robustness, TWAP, manipulation surface." },
      "smartContract": { "score": 4.5, "trend":  0.0, "label": "Smart Contract", "desc": "Audits, bounties, immutable vs upgradeable, incidents." },
      "liquidityTrap": { "score": 1.5, "trend":  0.0, "label": "Liquidity Trap", "desc": "Exit restrictions, admin freezes, unsellable tails." }
    },
    "scoreMetadata": {
      "composite": {
        "score": 1.6526,
        "applicable_dimensions": ["credit", "counterparty", "liquidity", "oracle", "smartContract", "liquidityTrap"],
        "weights_used": { "credit": 0.15, "counterparty": 0.20, "liquidity": 0.15, "oracle": 0.15, "smartContract": 0.25, "liquidityTrap": 0.10 }
      },
      "dimensions": {
        "credit":        { "score": 4.0, "signalsUsed": ["utilization_rate", "borrowed_usd"], "missing": [] },
        "oracle":        { "score": 1.0, "signalsUsed": ["oracle_count", "aggregator_count"], "missing": [] }
      }
    },
    "scoreHistory": [1.68, 1.67, 1.66, 1.65, 1.65, 1.65, 1.66, 1.65, 1.65, 1.65, 1.65, 1.65],
    "audits": [
      { "auditor": "Offside Labs",    "auditDate": "2024-02-01T00:00:00.000Z", "findingsSummary": "No critical issues", "reportUrl": "https://github.com/Kamino-Finance/..." }
    ],
    "incidents": [],
    "similar": [
      { "id": "marginfi-lending", "slug": "marginfi", "name": "MarginFi", "category": "Lending", "logoUrl": "https://icons.llama.fi/marginfi.jpg", "compositeScore": 1.71, "tvlUsd": 612430000 }
    ]
  }
}
```

> `dimensions[i].trend` is the 30-day delta vs the prior score. Positive = getting riskier; negative = getting safer.

> `chainTvls` is computed from the latest DeFiLlama snapshot. A multi-chain protocol (e.g. Aave V3) returns one row per chain, sorted by `tvlUsd` descending.

> `scoreMetadata.dimensions[*].signalsUsed` shows which underlying signals fed each dimension score. Useful for explainability and building "why is this scored this way?" UI.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.diapleo.com/api-reference/endpoints/endpoints-protocols.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
