Building a sports search interface means turning a user’s text into identifiable results without hard-coding team names. By the end of this guide, you’ll know how to search SofaScore entities, interpret the fields in a result, and use a separate sports catalog to populate your interface.
What the API returns
SofaScore - Live API includes a search endpoint that accepts a query string and returns matching SofaScore entities. The supplied search example for real madrid includes team results, with fields such as an entity’s name, slug, country, sport, and type.
The same API also provides a list of available sports and a country flag endpoint. Together, these operations can support a search box, a sport selector, and country context in an application. Search results should be interpreted by their returned type rather than assumed to be teams in every case.
Getting started on Zyla API Hub
Open the SofaScore - Live API listing on Zyla API Hub, create an account if needed, and select Subscribe or Start Free Trial when available. You’ll get an API key to send in the Authorization header.
Zyla uses subscriptions and quotas rather than pay-per-call billing. The first API offers a 7-day trial or 50 requests; check the API page for current access options and pricing. Keep the key on your server or in another secure environment rather than shipping it in browser code.
Search and supporting endpoints
Search all entities
Send a GET request to the following Hub URL to search all SofaScore entities:
https://zylalabs.com/api/12787/sofascore-live-api/25082/search-all-entities
The required q parameter is a string. For the documented search, use q=real+madrid; the plus sign represents the space in the query. Send the same Bearer authorization header shown in the example below.
Each item in the supplied search response has an entity, a score, and a type. The Real Madrid item has type team; its entity includes name, slug, nameCode, country, and sport. The example also contains nullable fields and empty arrays, so rendering code should tolerate missing display values rather than assuming every field contains text.
Use the returned name as the result label and the type, sport, or country as context for the user. A search score is present in the example, but its scale and meaning are not specified here; don’t turn it into a percentage or impose a threshold based on the example alone.
Get all sports
Send a GET request to:
https://zylalabs.com/api/12787/sofascore-live-api/25080/get-all-sports
This endpoint returns the available sports. No request parameters are required in the documented example. Use it to populate a sport selector or to display the sport associated with a search result.
Get country flag
Send a GET request to:
https://zylalabs.com/api/12787/sofascore-live-api/31197/get-country-flag
The required country_code parameter is a string; the documented value is EN. The endpoint returns country flag image bytes, so handle the result as image data rather than attempting to parse it as the sports JSON array. The documented search result also includes country information, including an alpha2 field, but validate your own flag-handling flow before relying on it for every result.
Run the official sports request
This request checks your key and returns the sports catalog. Replace YOUR_API_KEY with your Zyla key before running it:
curl -s -X GET "https://zylalabs.com/api/12787/sofascore-live-api/25080/get-all-sports" \
-H "Authorization: Bearer YOUR_API_KEY"
The documented response is:
[
{
"id": 1,
"name": "Football",
"slug": "football"
},
{
"id": 5,
"name": "Tennis",
"slug": "tennis"
},
{
"id": 2,
"name": "Basketball",
"slug": "basketball"
},
{
"id": 64,
"name": "Baseball",
"slug": "baseball"
},
{
"id": 23,
"name": "Volleyball",
"slug": "volleyball"
},
{
"id": 63,
"name": "American football",
"slug": "american-football"
},
{
"id": 6,
"name": "Handball",
"slug": "handball"
},
{
"id": 20,
"name": "Table tennis",
"slug": "table-tennis"
},
{
"id": 4,
"name": "Ice hockey",
"slug": "ice-hockey"
},
{
"id": 22,
"name": "Darts",
"slug": "darts"
},
{
"id": 72,
"name": "E-sports",
"slug": "esports"
},
{
"id": 11,
"name": "Motorsport",
"slug": "motorsport"
},
{
"id": 65,
"name": "Cycling",
"slug": "cycling"
},
{
"id": 62,
"name": "Cricket",
"slug": "cricket"
},
{
"id": 76,
"name": "Mixed Martial Arts",
"slug": "mma"
},
{
"id": 12,
"name": "Rugby",
"slug": "rugby"
},
{
"id": 29,
"name": "Futsal",
"slug": "futsal"
},
{
"id": 31,
"name": "Badminton",
"slug": "badminton"
},
{
"id": 26,
"name": "Waterpolo",
"slug": "waterpolo"
},
{
"id": 19,
"name": "Snooker",
"slug": "snooker"
},
{
"id": 13,
"name": "Aussie rules",
"slug": "aussie-rules"
},
{
"id": 34,
"name": "Beach volley",
"slug": "beach-volley"
},
{
"id": 109,
"name": "Minifootball",
"slug": "minifootball"
},
{
"id": 7,
"name": "Floorball",
"slug": "floorball"
},
{
"id": 15,
"name": "Bandy",
"slug": "bandy"
},
{
"id": 110,
"name": "Padel",
"slug": "padel"
}
]
The response is an array. For each sport, use name as a display label, slug as the returned text identifier, and id when you need to retain the API’s identifier. Read these values from the response rather than maintaining a separate hard-coded catalog.
Use the catalog from Python
The following standard-library example calls the same endpoint and prints the fields needed for a selector. Replace the key before running it.
import json
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
url = "https://zylalabs.com/api/12787/sofascore-live-api/25080/get-all-sports"
request = Request(
url,
headers={"Authorization": "Bearer YOUR_API_KEY"},
method="GET",
)
try:
with urlopen(request, timeout=10) as response:
sports = json.load(response)
for sport in sports:
print(sport["id"], sport["name"], sport["slug"])
except HTTPError as error:
print("API request failed:", error.code)
except URLError as error:
print("Network request failed:", error.reason)
The timeout is a client-side choice, not an API limit. In an application, send failures to your normal error handling and show a retry option instead of treating an unavailable catalog as an empty one.
For the entity search, URL-encode the user’s text into the documented q parameter. Keep the API key in your backend, then pass only the fields your interface needs to the browser. Avoid assuming that optional entity fields will always have values.
Practical integration choices
For an autocomplete interface, let the user choose from returned results instead of automatically selecting the first match. The supplied real madrid search includes more than one team, so show enough context—such as sport and country—to distinguish results.
For a sport picker, fetch the sports catalog independently of the search request. You can cache the returned list in your application and refresh it according to your own freshness needs; the response example does not establish a required cache lifetime.
For country visuals, keep the flag request separate from JSON parsing. If an image cannot be loaded, render the country name from the search result when available, rather than blocking the result list on the flag.
To manage subscription quota, avoid sending a search request for every intermediate keystroke. Debouncing input and reusing recent results are application-side choices; check the listing for the current quota and access terms.
Call the API from an AI agent
Zyla’s MCP endpoint can connect the marketplace to Claude Code, Cursor, Windsurf, or another MCP-compatible client. Configure the client with https://mcp.zylalabs.com/mcp?apikey=YOUR_API_KEY, replacing the placeholder with your key.
An agent can use the available API tools to search for an entity and inspect the returned type, name, sport, and country. Ask it to report the returned fields rather than infer an entity’s identity solely from a partial name. Treat the MCP URL as a credential-bearing value and keep it out of shared transcripts and public configuration files.
FAQ
What parameter does Search all entities require?
It requires the string parameter q. The documented example is real madrid, encoded in a URL as real+madrid.
Does the search endpoint return only teams?
The supplied example includes team results, but the endpoint searches all SofaScore entities. Check each result’s type before choosing how to display it.
Can I use the same key for the sports and search requests?
Yes. Both documented Hub requests use Authorization: Bearer YOUR_API_KEY, subject to your subscription and quota.
Is the country flag response JSON?
The endpoint is described as returning image bytes. Handle it separately from the JSON response used by the sports catalog.
Create a free Zyla account, get your API key, and Start 7-day trial on SofaScore - Live API. Check the listing for current access options, pricing, and quota before integrating it into your application.