Appearance
Cross-product search
Show Sportsbook results inside your own site-wide search, next to casino and your other products, so a player types once and finds everything. You own the input field and the markup; the SDK gives you the query results and, optionally, keeps the odds on them moving.
The data matches what the built-in Sportsbook search returns for the same query - the same disciplines, the same split into matches, outrights and tournaments, and the same deep links back into the Sportsbook. Nothing extra is exposed.
INFO
NOTE: This method returns data only. It does not render any UI and does not require the Sportsbook to be embedded on the same page, so you can place your search box on any page of your site.
Connecting the SDK
Include the SDK modules script on the page that hosts your search:
html
<script
type="text/javascript"
src="https://{APP_URL}/assets/sdk/modules/init.js"
></script>The method is then available globally as window.Sportsbook.onSearchData.
Quick start
onSearchData returns a controller synchronously, while the connection is established in the background, so you can wire it straight to an input. Every state change - searching, results, error, expiry - arrives through the onChange callback.
javascript
const sportsbookSearch = window.Sportsbook.onSearchData({
host: 'https://APP_URL',
cid: 'PARTNER_ID',
token: '<string>', // optional: user session token
lang: 'en', // optional
sportsbookPath: '/betting', // the page where the Sportsbook is rendered
mode: 'static', // 'static' (default) or 'live'
onChange: (searchData) => {
renderYourSearchResults(searchData);
},
});
// Call it on every keystroke - the method debounces internally
searchInput.addEventListener('input', (event) => {
sportsbookSearch.search(event.target.value);
});
// When your search panel closes
closeButton.addEventListener('click', () => {
sportsbookSearch.reset();
});
// When your search component is removed from the page
sportsbookSearch.destroy();Parameters:
host(string, required): Sportsbook application host URL.cid(string, required): Your partner ID, provided by the account manager.token(string, optional): User session token. If omitted, the method operates in guest mode.lang(string, optional): Language code in ISO 639-1 format (e.g.,'en','uk'). If not specified, the data is returned in the language selected by the user in the Sportsbook. If the user has not selected a language, the default language (en) is used.sportsbookPath(string, optional): The path of the page where the Sportsbook is rendered (e.g.,/betting). Although this parameter is optional, you should specify it so that the deep links in the results point to the right page of your site.lineFilter(string | array, optional): Narrows the disciplines that are searched. Pass'sport'for sports only,'esport'for eSports only, or an array of discipline IDs (e.g.,['football', 'dota2']). If omitted, all disciplines configured for yourcidare searched.debounceMs(number, optional): The as-you-type debounce, in milliseconds. Default is400.mode(string, optional):'static'(default) returns a single snapshot of the results;'live'keeps the odds updating. See Snapshot and live modes.onChange(function, required): Callback that receives the whole search payload on every change. See The onChange payload.
Returns: an object with the search, reset and destroy methods, or null if host, cid or onChange is missing or invalid (the reason is logged to the console).
| Method | Description |
|---|---|
search(query) | Runs a search for query. Call it on every keystroke - the request is sent after the debounce. A query shorter than 2 characters clears the results instead of searching. |
reset() | Clears the query, the results and the error, and releases the subscriptions. Use it when your search panel is closed. |
destroy() | Ends the controller for good: no further onChange calls, all subscriptions released. Use it when your search component is unmounted. |
INFO
NOTE: Only one search controller is active per page. Calling onSearchData again takes over the previous one, so the earlier controller stops emitting - you never accumulate subscriptions.
The onChange payload
onChange always receives the full state, so you can render your results list directly from it.
| Field | Type | Description |
|---|---|---|
query | string | The query the current payload belongs to. |
events | array | Matches found for the query. See Matches. |
outrights | array | Outrights found for the query. See Outrights. |
tournaments | array | Tournaments found for the query. See Tournaments. |
isSearching | boolean | true while a request is in flight. Use it to show a loader. |
isEmpty | boolean | true when events, outrights and tournaments are all empty. |
hasAttemptedSearch | boolean | true once a request for the current query has been sent. Show a "nothing found" message only when hasAttemptedSearch && isEmpty. |
isSubscriptionExpired | boolean | true after an idle timeout. The results and their links stay valid, the odds simply stop updating. See Lifetime of the results. |
error | string | null | null when the last request succeeded, otherwise one of the error values. |
mode | string | The mode the controller runs in - 'static' or 'live'. Echoed back so a consumer that only receives the payload can tell a snapshot from a live stream. |
TIP
While the user is typing, the previous results stay in the payload and only hasAttemptedSearch is reset to false. Rendering straight from the payload therefore keeps the list on screen instead of flashing empty between keystrokes.
Matches
Each item in events describes a match.
| Field | Type | Description |
|---|---|---|
id | string | Event ID. |
name | string | Event name (e.g., Espanyol vs Sevilla). |
did | string | Discipline ID of the event (e.g., football). |
slug | string | The event route inside the Sportsbook. |
url | object | Deep link to the event. See Result links. |
isLive | boolean | true if the event is currently live. |
startTime | number | Event start time as a Unix timestamp, in seconds. |
competitors | array | The sides of the event, each { id, name, identity, logoExists }. For team sports the lineup players are excluded, so only the participating sides are returned; for racing disciplines every runner is returned. |
markets | array | The event's main markets, ready to render as odds chips. See Markets. |
marketsCount | number | Total number of markets available for the event - use it for a "+N markets" label. |
hasVideo | boolean | true if a live stream is available for the event. |
betBuilder | string | null | The Bet Builder provider for the event, or null when Bet Builder is not available. |
settlementRules | object | Settlement rules of the event's feed provider. |
Outrights
Each item in outrights describes an outright. An outright has no markets in the payload - only a name, a link and a markets count.
| Field | Type | Description |
|---|---|---|
id | string | Outright ID. |
name | string | Outright name. |
did | string | Discipline ID. |
slug | string | The outright route inside the Sportsbook. |
url | object | Deep link to the outright. See Result links. |
isLive | boolean | true if the outright is currently live. |
marketsCount | number | Total number of markets available for the outright. |
Tournaments
| Field | Type | Description |
|---|---|---|
id | string | Tournament ID. |
name | string | Tournament name (e.g., Spain. La Liga). |
disciplineId | string | Discipline the tournament belongs to. |
eventsCount | number | Number of events in the tournament. |
logoSrc | string | null | URL of the tournament logo, or null when the tournament has no logo. |
url | object | Deep link to the tournament. See Result links. |
Markets
Each item in a match's markets array is reduced to what an odds chip needs.
| Field | Type | Description |
|---|---|---|
id | string | Market ID. |
name | string | Market name (e.g., Match Winner). |
outcomes | array | The market outcomes. |
outcomes[].name | string | Outcome label (short name when available). |
outcomes[].price | number | Current odds. |
outcomes[].locked | boolean | true when the outcome is temporarily frozen and cannot be bet on. |
outcomes[].competitorId | string | null | For racing disciplines, the competitor this price belongs to - use it to map prices onto the runners in competitors. |
WARNING
Odds change. Do not cache prices from this payload beyond the current search session - a player who clicks through to the Sportsbook always sees the current price there.
Result links
Every match, outright and tournament carries a url object built from the sportsbookPath you passed in:
| Field | Type | Description |
|---|---|---|
href | string | Absolute URL of your page with the Sportsbook route applied - use it as the href of the result. |
route | string | The same link as a path with the query string, without the origin. |
slug | string | The raw Sportsbook route of the result (e.g., /football/tournaments/<id>). |
For Shadow mode integrations, href and route are ready to use as they are: they carry the sportsBookPath query parameter that the Sportsbook picks up on load. If a player is already on the page with the Sportsbook, you can navigate without a reload by passing slug to Sportsbook.setRoute(route).
For iFrame integrations, use slug as the route in your existing navigation synchronization (the setIframePath query parameter and the routeChange post message) - see Navigation synchronization.
Snapshot and live modes
The mode parameter decides how long the odds in the payload keep moving.
The default. The method fetches one snapshot: the results, and the odds as they are at that moment. Once all the odds have arrived, the subscriptions are released and the payload stops changing until the next search() call.
Use it for a classic search dropdown or results page, where the player scans the list and clicks through.
Lifetime of the results
Search subscriptions are released automatically after 30 seconds without a search() call. This applies to both modes and is a safeguard for the shared connection, so it cannot be configured.
When it happens, onChange fires with isSubscriptionExpired: true and the results left in place: the list and its links stay valid, only the odds stop updating. The next search() call restores a live cycle again.
TIP
isSubscriptionExpired is a good moment to dim the odds or add a "prices may have changed" hint - the links themselves remain safe to click.
Note the difference between the two ways of ending a session: reset() and an expiry both close the current cycle and leave the controller usable, while destroy() ends it permanently.
Errors
When a request fails, error is set in the payload and isSearching returns to false.
| Value | Description |
|---|---|
notReady | The Sportsbook configuration has not loaded yet. Retryable - the next keystroke succeeds once the configuration is in place. |
timeout | The search request did not complete in time. |
requestFailed | The search request failed. Details are logged to the browser console. |
Turning off the built-in Sportsbook search
The built-in Sportsbook search and your own search can run side by side, or you can rely on yours alone. Whether the built-in search is shown is controlled by the Internal search partner setting - contact your account manager to have it enabled or disabled for your cid.