You need an API to list the files you’re allowed to read, verify that a target file exists, and then pull it without guessing names or paths. By the end of this article you’ll call a real “list files” endpoint, parse its response, and fetch one of the files it returns—cleanly, with caching semantics you can wire into production this week.
What this API does
The Fonbet Odds API on Zyla API Hub exposes file-oriented access to bookmaker odds snapshots. It offers:
- A file listing endpoint that returns the exact set of odds files your subscription can read, sorted by name. You call this first and work only with names it provides.
- An endpoint to fetch one of those files, returned in an envelope with metadata and the bookmaker’s original JSON unchanged.
This is squarely a file management workflow: discover available files, select one by name, and download it. It’s suitable for streamlining ingestion jobs, verifying access before scheduling pulls, and keeping your odds pipeline resilient.
Getting started on Zyla API Hub
Open the API page for Fonbet Odds API, click Subscribe or Start Free Trial if available, and grab your API key. Authentication is a single header you add to requests. Zyla API Hub uses a subscription + quota model (not pay-per-call). The first API on your account may offer a 7-day trial or 50 requests; always check the API page for current access options and pricing.
You can browse thousands of production-ready APIs on Zyla API Hub, all under one account and one API key. When you’re ready to test this specific API, use the listing link below.
The endpoints you’ll use
Base: All calls go to Zyla’s Hub URLs shown below. Do not add query parameters unless they are documented. Authentication is required via Authorization: Bearer YOUR_API_KEY.
1) List Files
- Method: GET
- URL: https://zylalabs.com/api/13783/fonbet-odds-api/31607/list-files
- Description: Lists the odds files your subscription can read, sorted by name. Returns company, count, and files (an array of filenames). Call it first and only request names it returns.
- Parameters: None documented.
cURL (copy/pasteable):
curl -s -X GET "https://zylalabs.com/api/13783/fonbet-odds-api/31607/list-files" \
-H "Authorization: Bearer YOUR_API_KEY"
Official example response:
{
"company": "fonbet",
"count": 1,
"files": [
"site_livepre_fonbet.json"
]
}
What you’ll actually use:
- company: String identifying the data provider (here, "fonbet").
- count: Number of files your current subscription can access.
- files: Array of file names. These are the only valid inputs you should attempt to fetch.
2) Get Data
- Method: GET
- URL: https://zylalabs.com/api/13783/fonbet-odds-api/31608/get-data
- Description: Returns one odds file inside an envelope: {"company", "file", "updated_at", "data"}. The data field contains the bookmaker’s own JSON, unchanged. updated_at is the last refresh time (UTC). The same time is provided via the Last-Modified header; send it back via If-Modified-Since to receive a 304 when nothing changed.
- Parameters: None documented.
cURL:
Example response (envelope with raw odds JSON in data):
Key points for production use:
- updated_at is UTC. Treat it as your canonical clock for staleness checks.
- Use HTTP caching headers: on every successful GET, read Last-Modified; send it back as If-Modified-Since on subsequent requests to avoid unnecessary downloads when data hasn’t changed.
- The bookmaker JSON under data is unmodified; shape may be large and nested, so parse only what you need.
End-to-end example: discover and fetch one file
Workflow outline:
- Call List Files to discover allowed filenames.
- Pick the file you need from files[].
- Call Get Data to retrieve the envelope with the raw odds JSON.
- Store updated_at and the Last-Modified header for future conditional requests.
Python example
This script lists files, selects the first filename, fetches it, and prints basic metadata. It also demonstrates reading Last-Modified to wire up conditional requests later.
import os
import sys
import requests
API_KEY = os.environ.get("ZYLALABS_API_KEY", "YOUR_API_KEY")
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
LIST_URL = "https://zylalabs.com/api/13783/fonbet-odds-api/31607/list-files"
GET_URL = "https://zylalabs.com/api/13783/fonbet-odds-api/31608/get-data"
def list_files():
r = requests.get(LIST_URL, headers=HEADERS, timeout=30)
r.raise_for_status()
return r.json()
def get_data(if_modified_since=None):
headers = HEADERS.copy()
if if_modified_since:
headers["If-Modified-Since"] = if_modified_since
r = requests.get(GET_URL, headers=headers, timeout=60)
if r.status_code == 304:
return {"status": 304, "last_modified": if_modified_since, "body": None}
r.raise_for_status()
return {
"status": r.status_code,
"last_modified": r.headers.get("Last-Modified"),
"body": r.json()
}
def main():
listing = list_files()
print(f"Company: {listing.get('company')}")
print(f"File count: {listing.get('count')}")
files = listing.get("files", [])
if not files:
print("No files available for this subscription.")
sys.exit(0)
target = files[0]
print(f"Fetching: {target} via Get Data endpoint")
# First fetch
result = get_data()
print(f"HTTP: {result['status']}, Last-Modified: {result['last_modified']}")
if result["body"]:
env = result["body"]
print(f"Envelope: company={env.get('company')}, file={env.get('file')}, updated_at={env.get('updated_at')}")
# The raw bookmaker JSON is at env['data']; avoid printing huge payloads in production.
# Example conditional request using Last-Modified
if result["last_modified"]:
result2 = get_data(if_modified_since=result["last_modified"])
print(f"Conditional fetch -> HTTP: {result2['status']} (304 means unchanged)")
if __name__ == "__main__":
main()
Notes:
- The List Files endpoint documents no request parameters—don’t add any.
- The Get Data endpoint also documents no parameters; it will return the allowed file inside its standard envelope.
- Use timeouts that make sense for your environment and log Last-Modified for incremental runs.
Practical integration details that save time
- Authentication: Always send Authorization: Bearer YOUR_API_KEY.
- Filenames: Treat files[] from List Files as the source of truth. Don’t hardcode names outside what the API returns.
- Ordering: The list is sorted by name. If you expect only one, assert count == 1 to fail fast when your subscription changes.
- Timestamps: updated_at is an ISO 8601 UTC string (e.g., 2026-09-27T18:24:34Z). Store it alongside your ingestion batch for audit.
- Caching: Respect Last-Modified/If-Modified-Since to minimize bandwidth and processing. A 304 means you can reuse your last snapshot.
- Pagination: Not documented on List Files; code as if the list fits in one page. If your subscription grows, re-check docs on the API page.
- Data volume: data is the bookmaker’s original JSON. It can be sizable; stream to disk or parse selectively.
- Error handling: Handle 401/403 for auth/subscription issues and 304 for cache hits. Non-200 responses should be retried consciously.
- Environment: Keep the API key out of source control. Parameterize timeouts and backoff.
- Deployment: Run List Files at startup or on schedule to detect changes in accessible files before fetching.
Real-world use cases
- ETL bootstrap: Use List Files to validate access at the start of a job, fetch the one live file, append updated_at and Last-Modified to your job metadata, and push parsed odds into your store.
- Incremental syncs: On a timer, call Get Data with If-Modified-Since. If 304, skip; if 200, process minimal diffs based on updated_at.
- Access monitoring: Alert when count or filenames from List Files change (e.g., a file was added/removed for your plan).
- Cache warming: Pre-fetch during deploy using List Files to choose targets, then Get Data to heat caches before user traffic.
Calling from AI agents via MCP
Every API on Zyla can be called by AI agents through the MCP endpoint. Point your MCP-compatible client (e.g., Claude Code, Cursor, Windsurf) at the MCP gateway and pass your Zyla API key. Your agent can then invoke the same Hub URLs shown above using the same Authorization header.
Docs and endpoint: MCP
Typical flow inside an agent:
- Tool step 1: GET the List Files URL with your Authorization header; parse files[].
- Tool step 2: GET the Get Data URL; if Last-Modified is present, cache and reuse via If-Modified-Since.
If your team manages multiple APIs through Zyla, MCP centralizes access under one key and one integration layer. You can explore more options on Zyla API Hub.
Copy-ready references
List Files
GET https://zylalabs.com/api/13783/fonbet-odds-api/31607/list-files
Headers:
- Authorization: Bearer YOUR_API_KEY
Returns company, count, files[].
Get Data
GET https://zylalabs.com/api/13783/fonbet-odds-api/31608/get-data
Headers:
- Authorization: Bearer YOUR_API_KEY
- If-Modified-Since: {Last-Modified from a previous 200} (optional, for caching)
Returns company, file, updated_at (UTC), and data (raw bookmaker JSON). Sends Last-Modified header; 304 when unchanged if you provide If-Modified-Since.
FAQ
Q: How do I know which file names I’m allowed to fetch?
A: Call the List Files endpoint. Only request names found in the files array.
Q: What timezone is updated_at?
A: UTC (e.g., 2026-09-27T18:24:34Z). Use it for audit and staleness checks.
Q: Can I avoid re-downloading the file if nothing changed?
A: Yes. Read the Last-Modified header from a 200 response and send it back via If-Modified-Since. You’ll receive HTTP 304 when the file is unchanged.
Q: Are there query parameters to filter the file list or the data?
A: No parameters are documented for these endpoints. Treat the list as complete and the data as the full, unmodified JSON.
Q: How is billing handled?
A: Zyla uses subscription + quota (not pay-per-call). The first API may offer a 7-day trial or 50 requests. Check the API page for current access options and pricing.
Ready to implement your “list then fetch” file workflow? Start with the official listing and get your key: Start 7-day trial on Fonbet Odds API. One account and one API key unlock access to more than 10,000 public APIs on Zyla.