# uDegen Score API

The **uDegen API** allows developers, third-party dashboards, and bots to integrate our proprietary scoring data and latest verifications into their own platforms. Our public endpoints provide a streamlined way to access real-time intelligence across all supported networks.

***

### GET /api/coins/score

This is a public, read-only endpoint that returns the total score for every coin currently indexed in the uDegen database.

#### Request Details

* **Method:** `GET`
* **Authentication:** None required.
* **Query Parameters:** None.
* **Caching:** Results are cached in **Redis** for **1 hour** (`TTL: 3600s`).

#### Example Request

```
Bash
```

```
curl https://udegen.io/api/coins/score
```

***

#### Response Schema

**200 OK**

Returns a list of all coin scores. A `totalScore` of `null` indicates the coin has been indexed but has not yet completed the scoring process.

```
JSON
```

```
{
  "success": true,
  "data": [
    {
      "network": "ethereum",
      "address": "0xAbC123...def",
      "totalScore": 87.5
    },
    {
      "network": "solana",
      "address": "So1Ana...",
      "totalScore": null
    }
  ]
}
```

**500 Internal Server Error**

Returned if a server-side error occurs during data retrieval.

```
JSON
```

```
{
  "success": false,
  "error": "Internal Server Error"
}
```

***

#### Use Cases

1. **Leaderboards:** Fetch the dataset and sort client-side by `totalScore` to render a ranked list of top-performing projects.
2. **Portfolio Overlays:** Cross-reference a user's holdings (via `network` + `address`) to display uDegen Scores directly inside a wallet UI.
3. **External Bots:** Telegram or Discord bots can poll this endpoint hourly to alert communities of score changes or new high-score listings.

***

#### Example Integration (TypeScript)

```
TypeScript
```

```
type CoinScore = {
  network: string;
  address: string;
  totalScore: number | null;
};

type ScoreResponse =
  | { success: true; data: CoinScore[] }
  | { success: false; error: string };

async function fetchCoinScores(): Promise<CoinScore[]> {
  const res = await fetch("https://udegen.io/api/coins/score");
  const json: ScoreResponse = await res.json();

  if (!json.success) throw new Error(json.error);

  return json.data;
}
```

***

#### Technical Implementation Notes

* **Data Integrity:** All responses are validated against a Zod discriminatedUnion schema server-side, ensuring consumers receive strictly typed data.
* **Performance:** To ensure maximum speed, the first request after cache expiry repopulates Redis. We recommend that high-frequency integrators respect the 1-hour TTL to avoid unnecessary load.
* **Response Size:** This endpoint currently returns *all* scored coins in a single payload. As our database expands, pagination or filtering parameters may be introduced to maintain performance.

***
