---
title: "Get Database Stats"
method: GET
path: "/api/database/stats"
tags: ["database"]
---

# Get Database Stats

`GET /api/database/stats`

## Request

- Base URL: `https://api.halalterminal.com`
- URL: `https://api.halalterminal.com/api/database/stats`
- Auth: API key in header `X-API-Key`

Get aggregate statistics about the database contents.

Returns counts of equities, ETFs, funds, indices, and screening results,
along with the number of distinct sectors and countries for equities.

**curl example**:
```bash
curl -X GET "http://localhost:8000/api/database/stats"
```

**Python requests example**:
```python
import requests
resp = requests.get("http://localhost:8000/api/database/stats")
stats = resp.json()
```

## Response `200`

Aggregate statistics across all asset categories

- DatabaseStatsResponse
  - `equities` EquitiesStatsResponse, required
    - `count` integer: Total count of items in this category
    - `sectors` integer: Number of distinct sectors
    - `countries` integer: Number of distinct countries
  - `etfs` CountStatsResponse, required
    - `count` integer: Total count of items in this category
  - `funds` CountStatsResponse, required
    - `count` integer: Total count of items in this category
  - `indices` CountStatsResponse, required
    - `count` integer: Total count of items in this category
  - `screening_results` CountStatsResponse, required
    - `count` integer: Total count of items in this category

## Other responses

- `401`: API key required or invalid
- `429`: Quota exceeded

---

[API](https://skmtc.dev/halalterminal/apis/halal-terminal-api.md) · [All operations](https://skmtc.dev/halalterminal/apis/halal-terminal-api/llms.txt) · [OpenAPI document](https://skmtc.dev/halalterminal/apis/halal-terminal-api/revisions/78768b250943?raw)
