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

# Search

> Find swaps by transaction hash, wallet address, or partial match

## Endpoint

```
GET /leokit/explorer/search
```

No authentication required.

## Request

| Parameter | Type   | Required | Description                                                      |
| --------- | ------ | -------- | ---------------------------------------------------------------- |
| `q`       | string | Yes      | Search term (tx hash, wallet address, or partial). Max 200 chars |

The endpoint auto-detects the input type:

| Detected type    | Match rule                                                         |
| ---------------- | ------------------------------------------------------------------ |
| `address_evm`    | `0x[40 hex]` — exact match against `from_address` or `to_address`  |
| `address_thor`   | `thor1[bech32]` — same                                             |
| `address_maya`   | `maya1[bech32]` — same                                             |
| `address_btc`    | `bc1...`, `1...`, `3...` — same                                    |
| `address_ltc`    | `ltc1...`, `L...`, `M...` — same                                   |
| `address_doge`   | Dogecoin format — same                                             |
| `address_near`   | `*.near` or 64-hex implicit account — same                         |
| `address_cosmos` | `kujira1...`, `osmo1...`, `cosmos1...` — same                      |
| `tx_hash`        | Falls through if not an address — exact then partial `ilike` match |
| `text`           | Last-resort partial match against either address column            |

## Response

### Success (200) — wallet hit

When the input is a recognized wallet address, the response includes a `wallet_summary`:

```json theme={null}
{
  "data": [ /* up to 50 ExplorerTransaction objects */ ],
  "count": 50,
  "search_type": "address_evm",
  "wallet_summary": {
    "total_volume_usd": 482015.67,
    "transaction_count": 122,
    "first_seen": "2025-08-15T09:14:22.000Z"
  }
}
```

### Success (200) — tx-hash hit

```json theme={null}
{
  "data": [ /* up to 20 ExplorerTransaction objects */ ],
  "count": 1,
  "search_type": "tx_hash"
}
```

### Success (200) — no results

```json theme={null}
{ "data": [], "count": 0, "search_type": "tx_hash" }
```

## Errors

| Status | Description                                        |
| ------ | -------------------------------------------------- |
| `400`  | Missing `q` parameter or `q` longer than 200 chars |

## Examples

```bash theme={null}
# Wallet address
curl "https://api.leokit.dev/leokit/explorer/search?q=0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"

# Transaction hash
curl "https://api.leokit.dev/leokit/explorer/search?q=0xabc123..."

# Partial address (text search)
curl "https://api.leokit.dev/leokit/explorer/search?q=742d35"
```


## OpenAPI

````yaml /api-reference/openapi.json GET /explorer/search
openapi: 3.0.3
info:
  title: Leokit API
  version: 1.0.0
  description: API reference for Leokit
servers:
  - url: https://api.leokit.dev
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /explorer/search:
    get:
      summary: Explorer search (tx hash or wallet)
      parameters:
        - name: q
          in: query
          required: true
          schema:
            type: string
            maxLength: 200
      responses:
        '200':
          description: Matching swap rows.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExplorerSearchResponse'
      security:
        - {}
components:
  schemas:
    ExplorerSearchResponse:
      type: object
      required:
        - data
        - count
        - search_type
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ExplorerTransaction'
        count:
          type: integer
        search_type:
          type: string
        wallet_summary:
          type: object
          properties:
            total_volume_usd:
              type: number
            transaction_count:
              type: integer
            first_seen:
              type: string
              format: date-time
    ExplorerTransaction:
      type: object
      required:
        - id
        - tx_hash
        - from_asset
        - to_asset
        - from_address
        - to_address
        - volume_usd
        - protocol
        - swap_date
      properties:
        id:
          type: string
        tx_hash:
          type: string
        from_asset:
          type: string
        to_asset:
          type: string
        from_address:
          type: string
        to_address:
          type: string
        volume_usd:
          type: number
        protocol:
          type: string
        swap_date:
          type: string
          format: date-time
        from_symbol:
          type: string
        to_symbol:
          type: string
        from_chain:
          type: string
        to_chain:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Api-Key
      description: 'Demo API-Key (Sandbox): 7037d2b3-9c76-4f62-b730-c544f7570fa4'

````