Your stakeholders want live sports context in your product this week: a list of supported sports to drive navigation, a universal search box that finds teams and competitions, and country flags for UI polish. By the end of this guide you’ll call the SofaScore - Live API from Zyla API Hub to fetch the sports catalog, search entities by query, and retrieve flag image bytes, with production-ready curl and Python examples you can paste into your codebase.
What you can build with SofaScore - Live API
The API provides three core capabilities for sports apps:
- Get all sports: a complete, structured list of sports you can present in menus, filters, or onboarding flows.
- Search all entities: a single query endpoint that searches across SofaScore entities (e.g., teams), ideal for global search bars.
- Get country flag: fetch raw image bytes for a country flag to display next to teams, players, or competitions.
This API is available on Zyla API Hub, which offers one account, one API key and a subscription + quota model across more than 10,000 public APIs. You authenticate every request with Authorization: Bearer YOUR_API_KEY.
Getting started on Zyla API Hub
Open the listing for SofaScore - Live API on Zyla and subscribe. The first API on your account includes a 7-day trial or 50 requests, then ongoing usage follows a subscription + quota model (not pay-per-call). There is no Free Plan. You’ll receive a single API key that works across all endpoints in this listing.
Start here: Start 7-day trial on SofaScore - Live API
General marketplace info and account creation: Zyla API Hub.
Endpoints overview and examples
Get all sports
Returns a list of all available sports. Use this to power your sport selector, top-level navigation, or to validate incoming sport slugs.
- Method: GET
- URL: https://zylalabs.com/api/12787/sofascore-live-api/25080/get-all-sports
- Parameters: none
- Auth: Authorization: Bearer YOUR_API_KEY
curl
curl -s -X GET "https://zylalabs.com/api/12787/sofascore-live-api/25080/get-all-sports" \
-H "Authorization: Bearer YOUR_API_KEY"
Official sample JSON 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 use:
- id: numeric identifier you can store for internal mapping.
- name: human-readable sport name for UI labels.
- slug: stable URL/component key for routing, CSS, or query composition.
Python example
import os
import requests
API_KEY = os.environ.get("ZYLALABS_API_KEY", "YOUR_API_KEY")
url = "https://zylalabs.com/api/12787/sofascore-live-api/25080/get-all-sports"
headers = {"Authorization": f"Bearer {API_KEY}"}
resp = requests.get(url, headers=headers, timeout=10)
resp.raise_for_status()
sports = resp.json()
# Build a quick lookup: slug -> id
slug_to_id = {s["slug"]: s["id"] for s in sports}
# Example usage
print(f"Total sports: {len(sports)}")
print(f"Football id: {slug_to_id.get('football')}")
print("First three sports:")
for s in sports[:3]:
print(f"- {s['name']} (id={s['id']}, slug={s['slug']})")
Search all entities
Search across SofaScore entities by query string. Use this for a single search box that can find teams and related entities by name.
- Method: GET
- URL: https://zylalabs.com/api/12787/sofascore-live-api/25082/search-all-entities
- Parameters:
- q (string, required)
- Auth: Authorization: Bearer YOUR_API_KEY
curl
Response returns matched entities for the provided query. Use fields like id, name, slug, and nested objects such as country where present to render search results. If you store search results, consider caching to reduce repeated calls for the same queries.
Get country flag
Fetch the image bytes for a country flag by code, then render as a base64 image in your UI or store to your CDN. This is useful for national teams and competitions.
- Method: GET
- URL: https://zylalabs.com/api/12787/sofascore-live-api/31197/get-country-flag
- Parameters:
- country_code (string, required)
- Auth: Authorization: Bearer YOUR_API_KEY
curl
Example response (image bytes, base64-encoded):
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…
Decode the base64 to render. For web, prepend data:image/png;base64, to the string for an inline image; for mobile, decode to a byte array and store in cache.
Production details that save time
- Authentication: send Authorization: Bearer YOUR_API_KEY on every request. Missing or invalid keys return 401/403 responses.
- Idempotency and safety: all listed endpoints are GET. They are safe to call from edge functions or client backends with proper auth handling.
- Caching:
- Get all sports: the catalog is relatively stable; cache for 24 hours in your API layer or CDN.
- Search all entities: results change with time and context; cache for minutes per unique query to reduce cost and latency.
- Get country flag: base64 output is deterministic per country code; cache aggressively or store the decoded image.
- Pagination: not applicable to the documented endpoints. If you need more granular browsing beyond what’s here, keep the search endpoint as your primary discovery tool.
- Timestamps and timezones: the endpoints documented here do not emit timestamps. If you join results with other systems, treat these responses as metadata-only and add your own timing context.
- Error handling: implement retries with backoff for 5xx; do not retry 4xx except 429 with backoff. Log request URLs and query params for debuggability.
- Security: do not embed your API key in client-side apps. Proxy through your serverless or backend service and enforce per-user quotas.
End-to-end example: build a search-first sports picker
- Call Get all sports at boot to render the sports filter. Persist id, name, slug.
- Wire your global search box to Search all entities with q set to the user’s input. Debounce keystrokes to avoid excess calls.
- When rendering results, if a country is associated, use Get country flag with the corresponding code and cache the base64 string.
- Record selections by id and slug for stable routing and later enrichment.
Call the API from AI agents with MCP
If you integrate with MCP-compatible tools (e.g., code assistants in your dev environment), you can route the same HTTP calls through Zyla’s MCP endpoint using your existing key: https://mcp.zylalabs.com/mcp?apikey=YOUR_API_KEY. This lets an agent invoke the SofaScore - Live API without embedding secrets in prompts. For capabilities and client setup, see the MCP page.
Tip: expose just the endpoints you need (Get all sports, Search all entities, Get country flag) in your agent’s tool configuration and log invocations server-side for auditability.
Real-world usage patterns
- Onboarding: ask users to pick their favorite sports by listing the Get all sports response; store selected sport ids for tailored feeds.
- Search bar: use Search all entities to autocomplete teams like “Real Madrid” and navigate users directly to their detail screen.
- International UI: show flags next to team names and standings with Get country flag; cache base64 per alpha2/alpha3-style code expected by the endpoint.
- Routing and SEO: use sport slug (e.g., football, basketball) as part of your URL paths for stable routing and cleaner links.
Testing and troubleshooting
- Smoke tests: add a CI check that calls Get all sports and verifies expected keys (id, name, slug) exist and that the array is non-empty.
- Observability: log status code, latency, and body size; flag any sudden increases in payload size for the flag endpoint to catch malformed responses.
- Backfill: if you need to cache flags for common countries, batch-call Get country flag offline and store images in your asset bucket.
Frequently asked questions
How do I authenticate to SofaScore - Live API?
Send an Authorization header with your key: Authorization: Bearer YOUR_API_KEY on every request.
Is there a free plan?
No Free Plan. The first API on your Zyla account includes a 7-day trial or 50 requests. Check the listing for current access options.
Can I get team logos or league images via this API?
The endpoints documented here cover sports listing, entity search, and country flags. For other assets, review the listing page for additional endpoints; only the URLs in this article are documented here.
What country codes are supported for Get country flag?
Pass the country_code parameter expected by the endpoint. Validate codes in your domain model and cache successful results to avoid repeated lookups.
Can I call these endpoints from the frontend?
Use a backend or edge proxy so you don’t expose your API key. These are GET endpoints, so proxying is straightforward.
Ship your integration now: subscribe and get your key on the listing page, then paste the curl above and iterate. Start here: Start 7-day trial on SofaScore - Live API. If you need other building blocks, browse more on Zyla API Hub.