Skip to main content
GET
Python (SDK)

Overview

Search runs over a single index of event contracts. The type parameter picks the level hits come back at, and the response echoes it in data.type so a client can branch on the shape it actually received.

Filters apply to contracts

This matters when type is events or base-events: an event or base event is only found through its matching contracts. One whose contracts are all filtered out — for example an event holding only DELETED contracts under the default state — is not returned at all, even if its own text matches the query. found, page, and perPage count whatever type returns, not the underlying contracts. contractsFound on each events or base-events hit is the count of every matching contract under it, and contracts holds the first contractsPerHit of them (2 by default, at most 10). To list the rest, search again with type=contracts and the hit’s eventId or baseEventId.

Ordering by open interest

Results are ordered by open interest, from the venue’s last daily prices file. Each type ranks by its own level: The contracts on a hit come in order of their own open interest, highest first. Ties are broken by symbol, so pages are stable. With q, relevance comes first and open interest breaks ties. The file is published once a day, after the close, so open interest is end of day, not live. A contract the file did not name has no openInterest field and comes last; 0 is a real value. A hit’s openInterest is absent when the file named none of its contracts.
Search carries no prices. To show a price for the contracts on screen, open one live price stream for their symbols: its first snapshot per contract has each outcome’s last, and contract.settlement when nothing has traded yet.

Query syntax

q searches symbols, contract questions, event names, and base-event specifications. Symbols are split on _, -, and ., so a partial query finds the full symbol:
Omit q entirely to browse the catalogue, ordered by open interest.

Parameters

Filter by category

category takes a category’s whole path, such as Elections > United States House, from List Categories. It matches that category and everything under it, so Elections also finds every House and Senate race. A bare level name such as United States matches nothing, because level names repeat under different parents. URL-encode the path, since it contains spaces and >.

Search results trail the catalogue

The index is updated from the catalogue and lags it by seconds. Treat a hit’s symbol as the key into Get Event Contracts and read anything that must be current — state, tradable — from there. Do not act on a hit’s own tradable field.

Response

Examples

Find contracts by text

Group hits by event

Return the top 3 contracts of each event

List the matching contracts under one event hit

Browse a single base event, tradable only

Search one category

Include deleted contracts

Errors

  • 400 — an unknown type, a parameter that failed validation (such as INVALID_CONTRACTS_PER_HIT for a negative or non-integer contractsPerHit), or a category containing a backtick
  • 502 — the search index was unavailable

Query Parameters

type
enum<string>
default:contracts

Level hits come back at. contracts (default) returns matching contracts; events returns one hit per event and base-events one per base event, each with its own fields, a count of matching contracts and the contractsPerHit of them with the most open interest. Echoed in the response.

Available options:
contracts,
events,
base-events
q
string

Full-text query over symbols, questions, event names and base-event specifications. Symbols split on _, - and . so BPM 0822 finds BPM_0822_1750. Omit to browse, soonest last-trade date first.

Example:

"unemployment june"

state
string

Contract state. Omitted means ACTIVE; * matches every state, including DELETED.

Example:

"ACTIVE"

baseEventId
string

Only contracts under this base event.

Example:

"UNR"

eventId
string

Only contracts under this event.

Example:

"UNR_0822"

category
string

Only contracts in this category or any category under it. Takes a path from List Categories, URL-encoded. A bare level name such as United States matches nothing, because level names repeat under different parents.

Example:

"Elections > United States House"

tradable
boolean

Only tradable (true) or non-tradable (false) contracts.

page
integer

1-based page number; 0 or omitted means 1.

Required range: x >= 0
Example:

1

perPage
integer

Hits per page, counting whatever type returns; 0 or omitted means 20, values above 100 are clamped to 100.

Required range: 0 <= x <= 100
Example:

20

contractsPerHit
integer
default:2

With type=events or type=base-events, how many of each hit's matching contracts to return in contracts, those with the most open interest first. 0 or omitted means 2; values above 10 are clamped to 10. A negative or non-integer value returns 400 INVALID_CONTRACTS_PER_HIT. Ignored by type=contracts.

Required range: 0 <= x <= 10
Example:

2

Response

One page of hits; data.type says which shape they are

Standard success envelope used by all success responses. data is endpoint-specific.

success
boolean
required
Example:

true

data
object

One page of contracts.