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

# Global search preview — top results across users, events, and matches

> Returns up to 5 hits per type for the header dropdown. If the query starts with `0x` we look up users by wallet (exact at length 42, prefix otherwise) and `events` / `matches` are empty. Otherwise three independent text searches run in parallel; events also surface tag-driven hits via `matchedVia: 'tag'`. Minimum query length is 1 character.



## OpenAPI

````yaml /api-reference/openapi.json get /api/search
openapi: 3.1.0
info:
  title: PredictStreet core-api
  description: >-
    Client-facing HTTP gateway for the PredictStreet prediction-market platform.
    This spec is hand-written against the NestJS controllers and DTOs in
    core-api/src/modules/. For the source-of-truth live spec, run
    `./scripts/pull-openapi.sh` against a running core-api (NestJS exposes it at
    /api/docs-json). **Partner kinds.** Every authenticated endpoint resolves a
    request's *effective wallet* from the partner row. `single_wallet` partners
    bind to one `associatedWallet` set at creation. `multi_wallet` partners
    declare the actor on every request via an `X-User-Wallet: 0x<40-hex>`
    header. See the [Partner kinds](/auth/api-keys#partner-kinds) doc for the
    full contract.
  version: '2026-06-16'
  contact:
    name: PredictStreet partners
    email: partners@predictstreet.com
servers:
  - url: https://core.api.dev.predictstreet.sde.adifoundation.ai
    description: Testnet (partner integrator API — final domain TBD)
security: []
tags:
  - name: Deposits
    description: >-
      Gasless USDC deposit relay - submit a signed EIP-2612 permit and the
      platform broadcasts the on-chain deposit for you (no gas).
  - name: Events
    description: >-
      Polymarket-style event grouping with football metadata (group, stage,
      teams, tags).
  - name: Tags
    description: Curated tag taxonomy used to filter events.
  - name: Markets
    description: 'Public market data: list, detail, orderbook, trades, OHLC.'
  - name: Orders
    description: >-
      Signed-order place / cancel / read. Requires `X-Api-Key` with
      `orders:read` / `orders:write` scope; every write additionally requires an
      EIP-712 signature over the order.
  - name: Portfolio
    description: >-
      Balances, positions, trades, fees, vault info for the key's
      `associatedWallet`. Requires `X-Api-Key` with `portfolio:read` scope.
  - name: Matches
    description: >-
      admin.matches aggregate — groups several events into one fixture/card (1X2
      + first-scorer + over-under under one matchup).
  - name: Vault
    description: >-
      Backend co-signatures for ERC-1155 split / merge, and recovery for
      off-chain locks when the corresponding chain tx never confirmed. Requires
      `X-Api-Key` with `vault:write` scope plus an EIP-712 signature over the
      operation.
  - name: Leaderboard
    description: Public ranked leaderboard across PnL / volume buckets.
  - name: Search
    description: Global search across users, events, and matches.
  - name: Withdrawal Security
    description: >-
      Self-service withdrawal 2FA (TOTP) and withdrawal-address whitelist. Same
      endpoints serve the frontend (Privy JWT) and API-key integrators.
      Mutations need `vault:write`, reads `portfolio:read`. Both are opt-in per
      wallet and only gate withdrawals once the platform enables
      withdrawal-security enforcement.
paths:
  /api/search:
    get:
      tags:
        - Search
      summary: Global search preview — top results across users, events, and matches
      description: >-
        Returns up to 5 hits per type for the header dropdown. If the query
        starts with `0x` we look up users by wallet (exact at length 42, prefix
        otherwise) and `events` / `matches` are empty. Otherwise three
        independent text searches run in parallel; events also surface
        tag-driven hits via `matchedVia: 'tag'`. Minimum query length is 1
        character.
      operationId: SearchController_preview
      parameters:
        - name: q
          in: query
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 64
          description: Search query, 1–64 characters.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchPreviewRespDto'
        '400':
          description: Missing or out-of-bound `q`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - {}
components:
  schemas:
    SearchPreviewRespDto:
      type: object
      required:
        - query
        - walletMode
        - users
        - events
        - matches
        - usersHasMore
        - eventsHasMore
        - matchesHasMore
      properties:
        query:
          type: string
          description: Trimmed query string actually used.
        walletMode:
          type: boolean
          description: >-
            True when the query parsed as a `0x…` wallet prefix. In that case
            `events` and `matches` are always empty.
        users:
          type: array
          items:
            $ref: '#/components/schemas/SearchUser'
        events:
          type: array
          items:
            $ref: '#/components/schemas/SearchEvent'
        matches:
          type: array
          items:
            $ref: '#/components/schemas/SearchMatch'
        usersHasMore:
          type: boolean
          description: >-
            True when there is at least one more row past the preview slice for
            this type — drives the "View more" footer in the dropdown without a
            follow-up round-trip.
        eventsHasMore:
          type: boolean
        matchesHasMore:
          type: boolean
    ErrorEnvelope:
      type: object
      required:
        - error
      properties:
        status:
          type: integer
          example: 400
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: bad_request
            message:
              type: string
            details:
              type: object
              additionalProperties: true
            trace_id:
              type: string
    SearchUser:
      type: object
      required:
        - vaultAddress
        - username
      properties:
        vaultAddress:
          type: string
          description: >-
            User's on-chain vault address — the public handle. Stored
            lower-case. The signing EOA is treated as a private credential and
            never returned by search.
        username:
          type: string
          nullable: true
    SearchEvent:
      type: object
      required:
        - id
        - slug
        - title
        - teamA
        - teamB
        - matchedVia
      properties:
        id:
          type: string
        slug:
          type: string
        title:
          type: string
        teamA:
          type: string
          nullable: true
          description: Home FIFA code.
        teamB:
          type: string
          nullable: true
          description: Away FIFA code.
        matchedVia:
          type: string
          enum:
            - title
            - team
            - tag
          description: >-
            Which field caused the hit. `tag` means the event was found via one
            of its active tags rather than a direct title/team match.
    SearchMatch:
      type: object
      required:
        - id
        - slug
        - title
        - teamA
        - teamB
        - startTime
        - matchedVia
      properties:
        id:
          type: string
        slug:
          type: string
        title:
          type: string
        teamA:
          type: string
          nullable: true
          description: Home FIFA code.
        teamB:
          type: string
          nullable: true
          description: Away FIFA code.
        startTime:
          type: string
          format: date-time
          nullable: true
          description: >-
            Kickoff timestamp (ISO-8601) when the match has one set on
            `admin.matches.start_time`; `null` when the match is scheduled but
            the kickoff is still TBD. Lets the FE render the kickoff badge
            directly from search results without a follow-up `/api/matches/:id`
            call.
        matchedVia:
          type: string
          enum:
            - title
            - team

````