Overview
The/api/get-context endpoint accepts any Kaggle competition URL and returns the token-optimized context. This is a convenience wrapper around GET /api/competitions/{slug} that automatically extracts the competition slug from the URL.
Endpoint: POST /api/get-context
Authentication: Not required (uses public Kaggle API)
For private competitions or to use your own Kaggle credentials, use POST /api/get-context-upload instead.
Request
Full Kaggle competition URL (e.g.,
https://www.kaggle.com/competitions/titanic)Number of top notebooks to include (1-10). Default: 3
Enable streaming response (experimental). Default: false
List of patterns to ignore in notebook content (optional)
Response
Returns aCompetitionResponse object with the same structure as GET /api/competitions/.
Competition slug extracted from the URL
Competition title
Competition description
Competition metadata including prize, team count, evaluation metric
Processing status:
completed, processing, or failedStatus message (for processing/failed states)
Timestamp when data was cached (ISO 8601 format)
TOON-formatted competition context (only present when status is
completed)Examples
cURL
Python
JavaScript
Implementation details
This endpoint:- Extracts the competition slug from the provided URL using
KaggleService._extract_slug() - Delegates to
get_competition_metadata()from the competitions router - Returns the same response format as
GET /api/competitions/{slug}
https://www.kaggle.com/competitions/titanichttps://kaggle.com/c/titanicwww.kaggle.com/competitions/titanic
Status flow
Cache miss
If the competition is not cached, you’ll receive a
processing status. The server starts fetching data in the background.Error responses
Invalid URL format or missing required fields
Server error during processing
Related endpoints
Get competition by slug
Direct access using competition slug
Upload Kaggle credentials
Fetch private competitions with your own credentials