GET /api/competitions/
Retrieve metadata for a specific Kaggle competition. This endpoint implements a dual-track system:- Instant response for cached competitions (served from PostgreSQL)
- Processing status for new competitions (triggers background fetch from Kaggle API)
Endpoint
Path Parameters
The competition slug (identifier) from the Kaggle competition URL.Example: For
https://www.kaggle.com/c/titanic, the slug is titanicQuery Parameters
Number of top notebooks to include in the response (1-10).Default: 3
Range: 1-10 notebooks
Range: 1-10 notebooks
Response
The response format varies based on the competition’s cache status:Status: completed
Returned when competition data is cached and ready.
Competition identifier
Full competition title
Competition description text
Cache status. Value:
completedTimestamp when data was originally fetched from Kaggle
Competition metadata object
TOON-formatted competition context including:
- Competition metadata
- Dataset schema information
- Top N notebooks (code and markdown cells)
Additional status information (only present for non-completed statuses)
Status: processing
Returned when competition data is being fetched in the background.
Competition identifier
Status message (e.g., “Processing…”, “Fetching…”)
Cache status. Value:
processingDetailed message with expected wait time:
- “Fetching competition data. Refresh in 30-60 seconds.” (new competition)
- “Competition data is being fetched. Check back in 30 seconds.” (in progress)
- “Cached data is older than 30 days. Refreshing from Kaggle…” (expired cache)
Status: failed
Returned when a previous fetch attempt failed. Making a request automatically triggers a retry.
Competition identifier
Value: “Retrying…”
Cache status. Value:
processing (status updated to processing on retry)Value: “Retrying competition data fetch. Check back in 30-60 seconds.”
Cache Behavior
Cache Expiration
Competition data is cached for 30 days (configurable viaTTL_COMPETITION). When you request an expired competition:
- You receive a
processingstatus response - Background refresh is triggered automatically
- Fresh data will be available in 30-60 seconds
Cache Flow
- Cache Hit (Fresh): Instant response with
completedstatus and full TOON content - Cache Hit (Expired): Returns
processingstatus, triggers background refresh - Cache Miss: Returns
processingstatus, initiates first-time fetch - Processing: Returns
processingstatus while background task runs - Failed: Automatically retries fetch, returns
processingstatus
Examples
Request: Cached Competition
Response: Completed
Request: New Competition
Response: Processing
Request: With Custom Notebook Count
Error Responses
400 Bad Request
Returned when the slug parameter is empty or invalid.429 Too Many Requests
Returned when rate limit is exceeded (20 requests per minute).Notes
- Competition data includes metadata, dataset schema, and top-ranked notebooks
- Background fetching typically completes in 30-60 seconds
- Notebooks are ranked by upvotes and recency
- TOON format optimizes token usage for LLM consumption
- Cache is automatically refreshed every 30 days
- Maximum 10 notebooks can be stored; requests for more than 10 will be capped