You need a reliable way to list every sport your app can cover, right now—not a week from now. By the end of this guide you’ll be able to fetch all available sports with a single request, render them into your navigation or settings, and augment your UI with team search and country flags using the same subscription and API key from Zyla API Hub.
What this API does and when to use it
The SofaScore - Live API on Zyla API Hub provides sports metadata and search utilities you can plug directly into a scoreboard, betting companion, news app, or data pipeline. In this article, we’ll focus on three endpoints you can ship with today:
- Get all sports: retrieve a list of every available sport with id, name, and slug.
- Search all entities: find SofaScore entities (e.g., teams) by query string.
- Get country flag: download country flag image bytes for display in your UI.
All examples use the Zyla API Hub routing and a single Authorization header. No custom hosts, no separate accounts per API. If you’re new to the marketplace, you can explore more than 10,000 public APIs at zylalabs.com with one account and one API key.
Getting started on Zyla API Hub
Open the SofaScore - Live API listing, subscribe, and get your key:
- Visit the API page: Start 7-day trial on SofaScore - Live API.
- Click Subscribe (or Start Free Trial when available) to obtain your API key.
- Use Authorization: Bearer YOUR_API_KEY in every request to the endpoints below.
Billing on Zyla is subscription + quota (not pay-per-call). For the first API you add, there’s a 7-day trial or 50 requests. Check the API page for current access options and pricing.
Endpoint: Get all sports
This is the entry point for building your sports selector, feature toggles, or routing tables. It returns an array of sports, each with an id, name, and slug. No request parameters are required.
- Method: GET
- URL: https://zylalabs.com/api/12787/sofascore-live-api/25080/get-all-sports
- Headers: Authorization: Bearer YOUR_API_KEY
- Request params: none
cURL example
curl -s -X GET "https://zylalabs.com/api/12787/sofascore-live-api/25080/get-all-sports" \
-H "Authorization: Bearer YOUR_API_KEY"
Official example response
[
{
"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"
}
]
Fields you’ll actually use:
- id: numeric identifier for the sport. Store this for relational lookups.
- name: display name for menus and labels.
- slug: stable, URL-friendly token to build routes and feature flags.
Python example: fetch, sort, and map by id
import requests
API_URL = "https://zylalabs.com/api/12787/sofascore-live-api/25080/get-all-sports"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
resp = requests.get(API_URL, headers=headers, timeout=10)
resp.raise_for_status()
sports = resp.json() # list of {id, name, slug}
# Sort alphabetically for a menu
sports_sorted = sorted(sports, key=lambda s: s["name"].lower())
# Build helper maps
by_id = {s["id"]: s for s in sports_sorted}
by_slug = {s["slug"]: s for s in sports_sorted}
# Example usage
print("Available sports:", ", ".join(s["name"] for s in sports_sorted))
print("Football id:", by_slug["football"]["id"])
Endpoint: Search all entities
Use this when you need to power a search bar to quickly jump to a team, competition, or related SofaScore entity. It searches across entities by query string and returns matching objects.
- Method: GET
- URL: https://zylalabs.com/api/12787/sofascore-live-api/25082/search-all-entities
- Headers: Authorization: Bearer YOUR_API_KEY
- Request params:
- q (string, required): the search query (e.g., real madrid)
cURL example
This endpoint returns matches that include entity metadata such as id, name, slug, and country information. Use it to populate autocomplete suggestions after the user chooses a sport from your “all sports” list.
Endpoint: Get country flag
When rendering country-level context (e.g., a team’s country), you can request a flag image by country code and use the bytes directly in your UI or cache layer.
- Method: GET
- URL: https://zylalabs.com/api/12787/sofascore-live-api/31197/get-country-flag
- Headers: Authorization: Bearer YOUR_API_KEY
- Request params:
- country_code (string, required): e.g., EN
cURL example
Example response
iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAMAAAAL34HQAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAACxMAAAsTAQCanBgAAAELUExURUdwTN/f37QVJd7e3t3d3d/f39/f39/f397e3t7e3t3d3d3d3d3d3d/f397e3t/f39/f39zc3N7e3rQUJN/f37MUJLUTJd/f39/f3+Hh4d3d3bMUJLUVJbQUJLUVJbUUJLcQKOHh4d3d3bQVJLQUJN/f397e3rQVJbIWI7ITI7QUJLcYKM4RJP///97e3rQUJPv7++Li4v39/ebm5uDg4Orq6vDw8OTk5Pf397sTJPn5+bsUJPPz8/Ly8u7u7rcUJMcSJOzs7PHx8cQSJO/v77gUJLgTJOjo6MoSJMETJL8TJLUUJL4TJOvr680RJMsSJMsRJMQTJL0TJO3t7cwRJLYUJM0SJLwUJL4UJDN2488AAAAsdFJOUwB/38+AMBAg79+fcJBAv3CfYKC/YICfj79vr0AwcGCvIF+Pz8+vsKBQULAgUCRTtgAABilJREFUeNrtnGdX40YUhoWrhA1uGFj6tmQ34VrFKl6vzdqYDrtJNvX//5JMkSU3YWk0kiYn3A/CB3zMc+776s54NHMlKV6cfThp756+zeVUErlcq7XbPj48kjKLYqOel9WAkLf3GsXUkcqVA7mDIwiL/FE+qKSItrWndKZBIR6vrz+TuL6excKhbG6lwyR3/ND/eZiM7r6dz8bdaHL/tzPzJmUz4ZyVKtvePzMtu2fAeUCA0bNvde/N+UaCUBteorp2H0gEYpHo210/ZeVkXL7pMxkwjeexUGgDjywBMA/KufKZwmARMj0ZME++bg/mIwwWip7lgm1wBHtFocyxBsCGhVLmgim8zF+md585r15ULB8szyVhrn6WBhAPywfb4JWqJU8xYSEwan6lzMNV5iUAHywAelfKlTg34B5NlQb8sKZKvikxC5hfkyomLJQwM46QRTJPcDTgjeU6TGEawF+TXP8OwB8L4Ip8OIPBNoiAA0gGCy5NpkpBqPQ+JIXlCrnBQqVBclgsXITKMSBJLDCciFyEqhuGKg5WVC5C9RUgaSyArxG4XhEFIQ0sIDPX16GqaGhfccCiOoaoq2Vc2/WwVHGxwNBDjUMlJWRl4IRF60R+3biN5wxmeKr4WNDH…
Use the response body as image bytes. Store and serve it via your CDN or convert it into the format your frontend expects.
Real-world integration patterns
- Build a sport picker: fetch all sports once at app boot, sort by name, and render as a dropdown or segmented control.
- Feature gates per sport: use the slug to toggle sport-specific modules (e.g., enable “ice-hockey” when data is available).
- SEO-friendly routes: generate URLs like /sports/football/ or /sports/mma/ from the slug field.
- Autocomplete for teams: when the user selects a sport, wire your search box to hit Search all entities for queries like “real madrid”.
- Country badges: use Get country flag to display flags next to teams, leagues, or leaderboard entries.
Operational notes that save time
- Caching: the list of all sports is relatively stable. Cache for hours or a day in your backend. Keep a simple invalidate-on-deploy strategy.
- Localization: the example payload shows English names. If your UI supports multiple languages, plan for mapping display strings separately from the slug.
- Identifiers: persist both id and slug. Use id for backend joins; use slug for URLs and feature routing.
- Error handling: treat non-200s as transient by default and implement a retry with backoff for reads. Surface errors with the request id in your logs.
- Headers only: these endpoints use Authorization: Bearer YOUR_API_KEY. Do not send extra body parameters on GETs.
- Quotas: Zyla uses subscription + quota. Check the listing for your current limits and expected usage. Avoid unnecessary polling by caching.
Minimal end-to-end flow
- On server start, request Get all sports and cache the array.
- Expose the cached list to your frontend to build navigation, using slug for routing and id for internal references.
- On user search, call Search all entities with q set to the user’s input and render suggestions.
- When you need country visuals, call Get country flag with the appropriate country_code and store the bytes.
Calling from AI agents via MCP
If you’re prototyping in an MCP-compatible client (e.g., Claude Code, Cursor, Windsurf), you can call the same APIs via Zyla’s MCP endpoint. Point your tool to:
Provide your Zyla API key where your client expects it. Your agent can then invoke the documented SofaScore - Live API endpoints using the same bearer token and URLs shown above. This is useful for scaffolding scripts that fetch sports, verify slugs, and generate config files.
Testing checklist
- Successful GET to get-all-sports returns an array; confirm each item has id, name, slug.
- Sort order: handle your own sorting; the API does not guarantee order.
- Slug safety: slugs are URL-friendly; validate your router handles hyphens.
- Search bar: debounce keystrokes and call search-all-entities with q after 200–300ms.
- Flag images: treat the response as image bytes; serve via proper Content-Type when returning from your backend.
Why Zyla helps you ship faster
With Zyla API Hub you reuse the same account, key, and billing model across thousands of APIs. That means you can plug additional sports or gaming endpoints later without redoing auth or procurement. Explore the catalog at zylalabs.com and scale beyond a single integration when you’re ready.
FAQ
How do I authenticate?
Add the header Authorization: Bearer YOUR_API_KEY to every request.
Are there request parameters for Get all sports?
No. The endpoint does not document any request parameters; just send the GET with your authorization header.
What response fields should I store?
At minimum: id, name, slug. Use id for internal references and slug for URLs and feature toggles.
Can I cache the sports list?
Yes. It’s a good idea to cache to reduce calls and improve startup time. Choose an expiration that fits your release cadence.
How do I display a country flag?
Call Get country flag with the required country_code parameter and use the returned image bytes in your UI or serve them from your CDN.
Ready to implement your sports list and ship this week? Subscribe and get your key on the SofaScore - Live API page: Start 7-day trial on SofaScore - Live API.