---
title: "Search Database"
method: GET
path: "/api/database/search"
tags: ["database"]
---

# Search Database

`GET /api/database/search`

## Request

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

Search the local database of assets with filtering and pagination.

Returns a paginated list of assets matching the query string and optional
filters for asset type, sector, country, and exchange.

**curl example**:
```bash
curl -X GET "http://localhost:8000/api/database/search?q=Apple&asset_type=equities&limit=10"
```

**Python requests example**:
```python
import requests
resp = requests.get(
    "http://localhost:8000/api/database/search",
    params={"q": "Apple", "asset_type": "equities", "limit": 10},
)
results = resp.json()
```

## Query parameters

- `q` string: Free-text search query.
- `asset_type` string: Asset category to search, e.g. equities, etfs, funds.
- `sector` string, nullable: Filter by sector name.
- `country` string, nullable: Filter by country of listing.
- `exchange` string, nullable: Filter by exchange code.
- `limit` integer: Max results to return.
- `offset` integer: Number of results to skip, for pagination.

## Response `200`

Paginated search results with total count

- DatabaseSearchResponse
  - `total` integer, required: Total number of results matching the query
  - `limit` integer, required: Maximum number of results returned per page
  - `offset` integer, required: Offset into the full result set
  - `results` DatabaseSearchItemResponse[], required: Page of matching search results
    - `symbol` string, required: Ticker symbol
    - `name` string, nullable: Company or asset name
    - `type` string, nullable: Asset type, e.g. equities, etfs, funds
    - `sector` string, nullable: Sector classification
    - `industry` string, nullable: Industry classification
    - `exchange` string, nullable: Exchange where the asset is listed
    - `country` string, nullable: Country of incorporation or domicile
    - `market_cap` string, nullable: Market capitalization bucket (e.g. Large, Mid, Small)

## Other responses

- `401`: API key required or invalid
- `422`: Validation Error
- `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)
