upstream JSON
GFG’s public pages used to be HTML. This API does not scrape them anymore. It impersonates a browser against the JSON the site already calls. An old geeks-for-geeks-api.vercel.app URL is still copied into several files and never called.
Playground: playground.
Live work is services/profile.py and services/heatmap.py.
GET https://authapi.geeksforgeeks.org/api-get/user-profile-info/?handle={username}&article_count=false&redirect=true
POST https://practiceapi.geeksforgeeks.org/api/v1/user/problems/submissions/
GET https://practiceapi.geeksforgeeks.org/api/v1/problems/{slug}/
The POST body is {"handle","requestType":"","year":"","month":""}. Heatmap counts user_subtime on solved problems. There is no native calendar. Account created_date drives which years get fetched (today down to signup). The route still accepts deprecated range=last365days and unused month. Canonical path fetches full history then window_heatmap.
Topics: build_topic_analysis hits the problem JSON for tags. Tags are static, so _TAG_CACHE lives for the process lifetime. That is the only extra cache. HTTP cache is Redis like the siblings.
Mapper: info.fullName → displayName, userName → username, profilePicture → avatar, institute → institution. Stats use totalProblemsSolved plus solvedStats keys school|basic|easy|medium|hard. Those school/basic keys are why the shared byDifficulty object is a dict, not three LeetCode fields.
favicon.ico as a username is treated as invalid. Easy to hit if a browser requests the icon against the API host.
End-to-end walk#
Headers on every call: Chrome UA, Accept: application/json, plus Origin/Referer of www.geeksforgeeks.org on the topic GETs.
sequenceDiagram participant B as Browser participant API as gfg-stats participant A as authapi.geeksforgeeks.org participant P as practiceapi.geeksforgeeks.org B->>API: GET /alice/heatmap?view=all API->>A: GET user-profile-info handle=alice API->>P: POST submissions empty year month Note over API: user_subtime per solved problem, created_date for years API->>P: GET /api/v1/problems/slug for topic_tags API-->>B: envelope platform gfg
- Profile GET.
payload.datamissing → 404User profile information not found. - Submissions POST.
status == failed→ 404.resultmissing → 422. solvedStatskeysschool|basic|easy|medium|hard. Each problem haspname,slug,user_subtime.- Heatmap: no calendar endpoint. Count submissions by day from
user_subtime. Walk years fromcreated_dateto today. Thenwindow_heatmapforview. - Topics:
GET practiceapi .../problems/{slug}/→results.tags.topic_tags. Process_TAG_CACHEfor the life of the worker. - Timeouts: 504. Connect errors: 503. Non-JSON: 422. 400/404/406 with
user not found/valid user details→ 404.
Contests, rating, badges never hit extra upstream. Empty models after the profile fetch proves the user exists.