# LeetCode API
> Live data from LeetCode, the largest coding-interview and competitive-programming community: a member's coding profile (global ranking, reputation, country, problems solved split by easy/medium/hard, total submissions and badges), their competitive standing (contest rating, global ranking, contests attended, top percentage), their activity (current solving streak, total active days, submissions over the past year) and LeetCode's daily coding challenge (today's problem, difficulty, acceptance rate and topic tags).

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/leetcode-api/..."
```

## Pricing
- **Free** (Free) — 8,000 calls/Mo, 3 req/s
- **Basic** ($5/Mo) — 120,000 calls/Mo, 8 req/s
- **Pro** ($16/Mo) — 750,000 calls/Mo, 15 req/s
- **Scale** ($39/Mo) — 3,900,000 calls/Mo, 30 req/s

## Endpoints

### Challenge

#### `GET /v1/daily` — Today's LeetCode daily coding challenge

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/leetcode-api/v1/daily"
```

**Response:**
```json
{
    "data": {
        "date": "2026-06-10",
        "link": "https://leetcode.com/problems/maximum-total-subarray-value-ii/",
        "slug": "maximum-total-subarray-value-ii",
        "title": "Maximum Total Subarray Value II",
        "source": "LeetCode",
        "paid_only": false,
        "difficulty": "Hard",
        "topic_tags": [
            "Array",
            "Greedy",
            "Segment Tree",
            "Heap (Priority Queue)"
        ],
        "question_id": "3691",
        "acceptance_rate": 34.66
    },
    "meta": {
        "timestamp": "2026-06-10T14:01:39.483Z",
        "request_id": "0aff63e5-7586-436f-9f80-7d411b0b723e"
    },
    "status": "ok",
    "message": "Daily challenge retrieved successfully",
    "success": true
}
```

### Profile

#### `GET /v1/calendar` — A member solving streak and activity

**Parameters:**
- `username` (query, required, string) — LeetCode username Example: `votrubac`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/leetcode-api/v1/calendar?username=votrubac"
```

**Response:**
```json
{
    "data": {
        "source": "LeetCode",
        "username": "votrubac",
        "current_streak": 4,
        "total_active_days": 84,
        "active_days_past_year": 84,
        "submissions_past_year": 1235
    },
    "meta": {
        "timestamp": "2026-06-10T14:01:39.798Z",
        "request_id": "f9e8351a-22d0-4cf0-9f91-dd84aa1a3945"
    },
    "status": "ok",
    "message": "Calendar retrieved successfully",
    "success": true
}
```

#### `GET /v1/user` — A member coding profile and solved counts

**Parameters:**
- `username` (query, required, string) — LeetCode username Example: `votrubac`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/leetcode-api/v1/user?username=votrubac"
```

**Response:**
```json
{
    "data": {
        "about": null,
        "avatar": "https://assets.leetcode.com/users/votrubac/avatar_1610271695.png",
        "badges": [
            "Knight",
            "500 Days Badge",
            "365 Days Badge",
            "1000 Days Badge",
            "100 Days Badge 2025",
            "50 Days Badge 2025",
            "200 Days Badge 2024",
            "100 Days Badge 2024",
            "50 Days Badge 2024",
            "50 Days Badge 2023",
            "100 Days Badge 2023",
            "100 Days Badge 2022",
            "Oct LeetCoding Challenge",
            "Jul LeetCoding Challenge",
            "Aug LeetCoding Challenge",
            "Sep LeetCoding Challenge"
        ],
        "school": "Kharkiv Air Force University",
        "solved": {
            "all": 3822,
            "easy": 931,
            "hard": 888,
            "medium": 2003
        },
        "source": "LeetCode",
        "company": "Google",
        "country": "United States",
        "ranking": 51,
        "username": "votrubac",
        "real_name": "Vlad",
        "github_url": "https://github.com/votrubac",
        "reputation": 99866,
        "badge_count": 16,
        "twitter_url": null,
        "linkedin_url": null,
        "solution_count": 1878,
        "post_view_count": 10786515,
        "total_submissions": {
            "all": 3826,
            "easy": 931,
            "hard": 890,
            "medium": 2005
        }
    },
    "meta": {
        "timestamp": "2026-06-10
…(truncated, see openapi.json for full schema)
```

### Contest

#### `GET /v1/contest` — A member contest rating and ranking

**Parameters:**
- `username` (query, required, string) — LeetCode username Example: `votrubac`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/leetcode-api/v1/contest?username=votrubac"
```

**Response:**
```json
{
    "data": {
        "rating": 2092.47,
        "source": "LeetCode",
        "username": "votrubac",
        "global_ranking": 13247,
        "top_percentage": 1.59,
        "attended_contests": 487,
        "total_participants": 874213
    },
    "meta": {
        "timestamp": "2026-06-10T14:01:41.122Z",
        "request_id": "405e7280-1478-4c4c-923c-35115203e678"
    },
    "status": "ok",
    "message": "Contest ranking retrieved successfully",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Service metadata and endpoint catalog

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/leetcode-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "source": "LeetCode GraphQL API (leetcode.com/graphql, live)",
        "service": "leetcode-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/user": "A member's coding profile and solved counts (username=votrubac).",
            "GET /v1/daily": "Today's LeetCode daily coding challenge.",
            "GET /v1/contest": "A member's contest rating and ranking (username=votrubac).",
            "GET /v1/calendar": "A member's solving streak and activity (username=votrubac)."
        },
        "description": "Live data from LeetCode, the largest coding-interview and competitive-programming community, via its public GraphQL API. The user endpoint returns a member's coding profile (global ranking, reputation, country, problems solved split by difficulty, total submissions and badges); the contest endpoint returns a member's competitive standing (contest rating, global ranking, contests attended, top percentage); the calendar endpoint returns a member's current solving streak, total active days and submissions over the past year; the daily endpoint returns LeetCode's daily coding challenge (today's problem, difficulty, acceptance rate and topic tags). Live, no key, nothing stored. Distinct from the GitHub, Codeforces, Codewars and Stack Exchange developer APIs — this is LeetCode's own member profiles, contest ratings and daily challenge.",
        "upstream_status": "ok",
        "daily_challenge_date": "2026-0
…(truncated, see openapi.json for full schema)
```


---
Marketplace page: https://www.oanor.com/api/leetcode-api
OpenAPI spec: https://www.oanor.com/api/leetcode-api/openapi.json
