Skip to main content
GET
/
search
Search
curl --request GET \
  --url https://v1.basketball.sportsapipro.com/search \
  --header 'x-api-key: <api-key>'

Endpoint

GET https://v1.football.sportsapipro.com/search

Description

Search across competitions, competitors (teams), and athletes (players) by name. This is the primary endpoint for implementing search functionality in your application, supporting typeahead/autocomplete experiences.
Built-in TTL: 60 seconds. Results are cached for efficient repeated queries.

Parameters

ParameterTypeRequiredDefaultDescription
querystringYes-Search query (minimum 2 characters recommended)
filterstringNoallFilter type: all, competitions, competitors, athletes
sportsnumberNo-Sport ID to filter results (1 = Football)
Parameters like appTypeId, langId, timezoneName, and userCountryId are auto-resolved by the upstream service based on request context.

Request Examples

curl -X GET "https://v1.football.sportsapipro.com/search?query=barcelona&filter=all" \
  -H "x-api-key: YOUR_API_KEY"
Typeahead Implementation: For autocomplete/typeahead search, debounce user input by 300ms and only trigger searches when the query is 2+ characters. This reduces API calls and provides a smoother user experience.

Response

{
  "lastUpdateId": 5494796687,
  "requestedUpdateId": -1,
  "ttl": 60,
  "sports": [
    {
      "id": 1,
      "name": "Football",
      "nameForURL": "football",
      "drawSupport": true,
      "imageVersion": 1
    }
  ],
  "countries": [
    {
      "id": 2,
      "name": "Spain",
      "nameForURL": "spain",
      "imageVersion": 1
    },
    {
      "id": 19,
      "name": "Europe",
      "nameForURL": "europe",
      "imageVersion": 1,
      "isInternational": true
    }
  ],
  "competitions": [
    {
      "id": 7,
      "countryId": 2,
      "sportId": 1,
      "name": "La Liga",
      "shortName": "La Liga",
      "hasStandings": true,
      "hasLiveStandings": true,
      "hasBrackets": false,
      "nameForURL": "la-liga",
      "popularityRank": 12500000,
      "imageVersion": 4,
      "color": "#EE8707",
      "isTop": true
    }
  ],
  "competitors": [
    {
      "id": 131,
      "countryId": 2,
      "sportId": 1,
      "name": "Barcelona",
      "shortName": "Barcelona",
      "symbolicName": "BAR",
      "nameForURL": "barcelona",
      "type": 1,
      "popularityRank": 98500000,
      "imageVersion": 2,
      "color": "#A50044",
      "awayColor": "#EDBB00",
      "mainCompetitionId": 7,
      "hasSquad": true,
      "hasTransfers": true
    },
    {
      "id": 5432,
      "countryId": 35,
      "sportId": 1,
      "name": "Barcelona SC",
      "shortName": "Barcelona SC",
      "symbolicName": "BSC",
      "nameForURL": "barcelona-sc",
      "type": 1,
      "popularityRank": 125000,
      "imageVersion": 1,
      "color": "#FFD700",
      "mainCompetitionId": 1245,
      "hasSquad": true,
      "hasTransfers": false
    }
  ],
  "athletes": [
    {
      "id": 45231,
      "name": "Marc Bartra",
      "shortName": "Bartra",
      "nameForURL": "marc-bartra",
      "countryId": 2,
      "sportId": 1,
      "position": "Defender",
      "imageVersion": 2
    }
  ]
}

Response Fields

Root Object

FieldTypeDescription
lastUpdateIdnumberInternal versioning ID for incremental updates
requestedUpdateIdnumberRequested update ID (-1 = latest)
ttlnumberCache TTL in seconds (60 for this endpoint)
sportsarraySports definitions for matched entities
countriesarrayCountries referenced by matched entities
competitionsarrayMatching competitions (when filter includes)
competitorsarrayMatching competitors/teams (when filter includes)
athletesarrayMatching athletes/players (when filter includes)

Competitor Object

FieldTypeDescription
idnumberUnique competitor ID
countryIdnumberCountry ID
sportIdnumberSport ID (1 = Football)
namestringFull team name
shortNamestringShort display name
symbolicNamestring3-letter code (e.g., β€œBAR”)
nameForURLstringURL-friendly slug
typenumberType (1=club, 2=national team)
popularityRanknumberPopularity ranking (higher = more popular)
imageVersionnumberLogo image version for cache busting
colorstringPrimary brand color (hex)
awayColorstringAway kit color (hex)
mainCompetitionIdnumberPrimary competition ID
hasSquadbooleanWhether squad data is available
hasTransfersbooleanWhether transfer data is available

Competition Object

FieldTypeDescription
idnumberUnique competition ID
countryIdnumberCountry ID
sportIdnumberSport ID
namestringFull competition name
shortNamestringShort display name
hasStandingsbooleanWhether standings are available
hasLiveStandingsbooleanWhether live standings are supported
hasBracketsbooleanWhether bracket view is available
nameForURLstringURL-friendly slug
popularityRanknumberPopularity ranking
imageVersionnumberLogo image version
colorstringBrand color (hex)
isTopbooleanWhether this is a top/featured competition

Athlete Object

FieldTypeDescription
idnumberUnique athlete ID
namestringFull player name
shortNamestringShort display name
nameForURLstringURL-friendly slug
countryIdnumberNationality country ID
sportIdnumberSport ID
positionstringPlaying position
imageVersionnumberPhoto image version

Country Object

FieldTypeDescription
idnumberCountry ID
namestringCountry name
nameForURLstringURL-friendly name
imageVersionnumberFlag image version
isInternationalbooleanWhether international (e.g., Europe, World)

Filter Options

Filter ValueDescription
allReturns matches from all entity types
competitionsOnly returns matching competitions
competitorsOnly returns matching teams/clubs
athletesOnly returns matching players

Use Cases

// Debounced search implementation
const [query, setQuery] = useState('');
const [debouncedQuery, setDebouncedQuery] = useState('');

useEffect(() => {
  const timer = setTimeout(() => setDebouncedQuery(query), 300);
  return () => clearTimeout(timer);
}, [query]);

// Only search with 2+ characters
const { data } = useSearch(debouncedQuery, 'all');

Team Lookup

// Search only for teams
const response = await fetch(
  `https://v1.football.sportsapipro.com/search?query=manchester&filter=competitors`,
  { headers: { "x-api-key": "YOUR_API_KEY" } }
);

// Returns Manchester United, Manchester City, etc.
// Search only for players
const response = await fetch(
  `https://v1.football.sportsapipro.com/search?query=messi&filter=athletes`,
  { headers: { "x-api-key": "YOUR_API_KEY" } }
);

Error Responses

StatusDescription
400Missing required query parameter
401Invalid or missing API key
429Rate limit exceeded
500Internal server error
{
  "error": "Missing required parameter: query"
}

Authorizations

x-api-key
string
header
required

Your SportsAPI Pro API key

Query Parameters

query
string
required

Search query

Example:

"Lakers"

filter
enum<string>
default:all

Filter type: all, competitions, competitors, athletes

Available options:
all,
competitions,
competitors,
athletes

Response

200

Search results retrieved successfully