Skip to content

Search API

Full-text search across events and markets with comprehensive filtering, sorting, and caching options.

Search Events and Markets

Search across event titles, market questions, and tags with advanced filtering capabilities.

Endpoint: GET /public/api/v1/public-search/

Query Parameters

Search (Required)

  • q (string, required) - Search query text - searches event titles, market questions, and tags

Pagination (Optional)

  • page (integer, default: 1) - Page number using 1-based indexing
  • limit (integer, default: 20, max: 100) - Results per page
  • cache (boolean, default: false) - Use Redis cache for 3 minutes

Event Filtering (Optional)

  • events_status (string, default: all) - Filter by active, closed, or all
  • events_tag (string or array) - Filter by event type/category (e.g., crypto, sports, politics)
  • recurrence (string) - Filter by market structure: single, daily, weekly, monthly
  • exclude_tag_id (integer or array) - Exclude specific category IDs

Market Filtering (Optional)

  • keep_closed_markets (0 or 1, default: 1) - Include (1) or exclude (0) closed markets

Sorting (Optional)

  • sort (string, default: relevance) - Sort by relevance, volume, created_at, or end_date
  • ascending (boolean, default: false) - Sort ascending instead of descending

Advanced (Optional)

  • search_tags (boolean, default: true) - Include event types/categories in search
  • optimized (boolean, default: false) - Return lightweight response without nested markets

Example Requests

Basic Search

curl "https://market-api.probable.markets/public/api/v1/public-search/?q=bitcoin"

Filtered Search

curl "https://market-api.probable.markets/public/api/v1/public-search/?q=ethereum&events_tag=crypto&events_status=active"

Sorted Search

curl "https://market-api.probable.markets/public/api/v1/public-search/?q=ai&sort=created_at&ascending=true"

Cached Search

curl "https://market-api.probable.markets/public/api/v1/public-search/?q=trump&cache=true"

Lightweight Search

curl "https://market-api.probable.markets/public/api/v1/public-search/?q=sports&optimized=true"

Example Response

{
  "events": [
    {
      "id": 123,
      "slug": "btc-usd-2025-11",
      "title": "Bitcoin Price Prediction",
      "markets": [
        {
          "id": 456,
          "question": "Will BTC exceed $100k?",
          "market_slug": "btc-100k"
        }
      ]
    }
  ],
  "tags": [
    {
      "id": 1,
      "label": "Crypto",
      "slug": "crypto"
    }
  ],
  "pagination": {
    "hasMore": true,
    "totalResults": 50,
    "page": 1,
    "limit": 20,
    "totalPages": 3,
    "hasPrevPage": false
  }
}

Optimized Response

When optimized=true, the response excludes nested markets:

{
  "events": [
    {
      "id": 123,
      "slug": "btc-usd-2025-11",
      "title": "Bitcoin Price Prediction"
      // markets array is empty
    }
  ],
  "tags": [...],
  "pagination": {...}
}

Caching

  • Results cached for 3 minutes when cache=true
  • Cache key includes all search parameters
  • Use caching for frequently repeated searches

Use Cases

  • Frontend Search Bars: Real-time search as users type
  • Category Browsing: Filter by tags and status
  • Trending Markets: Sort by volume or creation date
  • Archived Content: Include or exclude closed markets