For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to Search for Drivers and Teams

βœ… Included in All Plans

The search endpoints are included at no additional cost.

Plans differ only in leagues and API call limits.

Compare plans β†’

This guide shows you how to use the driver and team search endpoints to look up entities by name - useful for autocomplete inputs, driver ID resolution, and user-driven search features.

When to use this

Use the search endpoints when you want to:

  • Build an autocomplete input that lets users find a driver or team by typing a name

  • Resolve a driver or team name to an ID before calling standings or results endpoints

  • Power a search feature in a fantasy F1 app or fan-facing dashboard

  • Look up a driver or team without knowing their exact ID in advance

The two search endpoints

GET https://api.sportmonks.com/v3/motorsport/drivers/search/{query}
?api_token={your_token}

GET https://api.sportmonks.com/v3/motorsport/teams/search/{query}
?api_token={your_token}

Both accept a partial name as the path parameter. The match is case-insensitive and matches against the full name. Both paginate - if your query returns many results, iterate through pages.

The response fields match the full Driver entity:

Use display_name for UI display and common_name for compact contexts like timing screens. The id is the value you pass to other endpoints as driver_id or that appears as participant_id in standings and player_id in lineups.

Search with enrichment

The driver search endpoint supports include depth 3 and the same include options as GET Driver by ID. You can enrich results with team, nationality, and position data in the same call:

Autocomplete pattern

Using &select=id,display_name,common_name,image_path keeps the response tight for autocomplete - you only need the fields to display the suggestion and the ID to act on the selection.

Basic search

Response fields:

The id is the value to use in the team standings, team results, and venue search endpoints. short_code is the constructor's 3-letter abbreviation suitable for compact displays.

Search with driver lineup

Partial name matching

Both search endpoints match on partial strings. Searching "Bull" returns both "Red Bull Racing" and "Visa Cash App RB" (which uses "Bull" in its registered name). Always handle multiple results and let the user select, rather than assuming data[0] is always the right match:

Common pitfalls

data[0] is not always the closest match. The API does not rank results by relevance. For common partial strings like "Red" or "Ham", multiple results may return in any order. Display all options and let the user select.

The search query is part of the URL path, not a query parameter. It is not ?search=Norris but /drivers/search/Norris. URL-encode the query string before placing it in the path - encodeURIComponent() in JavaScript handles this.

Driver IDs and team IDs are different namespaces. A driver ID (participant_id / player_id) is never the same value as a team ID. Do not interchange them across endpoints.

Short queries may return many results. Searching "a" returns every driver whose name contains "a". Add a minimum character check (2-3 characters) before firing the API call in autocomplete implementations.

The search endpoint paginate. If a query returns more results than the default page size, iterate through pages. For most real-world queries (a partial surname), this is unlikely to matter, but handle pagination defensively.

Advanced usage

To build a combined search that returns both drivers and teams, fire both search endpoints in parallel and merge the results client-side:

Common errors

Status
Likely cause

401

Missing or invalid api_token

404

No results found for the query

422

Query complexity exceeded from includes - simplify the request

See also

Search endpoints

Related entities

Related guides

FAQ

Is the search case-sensitive? No. "norris", "Norris", and "NORRIS" return the same results.

Can I search by car number? No. The search endpoints match on name only. To look up a driver by car number, fetch all drivers for the season with GET Drivers by Season ID and filter client-side by driver_number from the lineup data.

Does the driver search include retired or historical drivers? Yes, within the seasons covered by the Motorsport API. The oldest available season is 2021 - the search is not scoped to the current season, so it may return drivers who competed in 2021 or later but are no longer on the grid. For example, searching "Schumacher" returns Mick Schumacher, who raced in F1 between 2021 and 2022. Filter by season using GET Drivers by Season ID if you only want current-season participants.

Last updated

Was this helpful?