# LeetCode Contest History API

Get LeetCode Contest History data via REST or OpenAny MCP—with pay-per-use pricing and no subscription. Powered by Apish, pass parameters such as output, raw, username, and retrieve structured data including leetCode username, published summary contest rating, contest reference, participation flag, and contest rank to display rating history, and separate participation.

Documentation: https://openany.si/market/apis/leetcode/leetcode-user-contest-history-api/
API ID: bed0babe-f6fd-42ef-bcb9-26dcfcb7ddb2
Provider: apish
Contract revision: 3
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/apish/leetcode/v1/user/contests
Page update time: 2026-12-03T02:44:06.862Z
Access: OpenAny REST
OpenAny MCP: availability is not supplied by this REST contract. Check get_api on the configured OpenAny MCP server before execution.
Request content type: none
Execution mode: sync
Authentication: Authorization: Bearer $OPENANY_API_KEY

## Billing
Price: $0.002 / billing credit
API-key calls use your shared balance. Review the published billing rules before making a paid request.
Price source: OpenAny public API contract. Price update time: not supplied.
Contract update time: 2026-12-03T02:44:06.862Z. This is not a price-change timestamp.
```json
{
  "currency": "USD",
  "mode": "rules",
  "parameters": [],
  "policy_version": 2,
  "sale": {
    "addons": [],
    "base_price_micro_usd": "0",
    "max_cost_micro_usd": "2000",
    "quantities": [
      {
        "id": "upstream_credits",
        "label": "Actual API.SH credits consumed",
        "max_quantity": "1",
        "measure": "value",
        "pointer": "/credits_used",
        "price_micro_usd": "2000",
        "quantity_scale": 0,
        "source": "response",
        "unit": "credit",
        "unit_quantity": "1"
      }
    ],
    "rounding": "ceil",
    "variants": []
  }
}
```

## Request parameters
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "LeetCode Contest History API request inputs",
  "$comment": "Declared input types grouped by HTTP location. Path, query and header values describe decoded inputs and are serialized as text on the wire; body is the payload. This is not an exhaustive provider contract or a schema for the raw HTTP request.",
  "type": "object",
  "properties": {
    "path": {
      "type": "object",
      "properties": {}
    },
    "query": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string",
          "description": "LeetCode username or leetcode.com/u/ profile link."
        },
        "attended_only": {
          "type": "string",
          "description": "`true` (default): only contests the user took part in.",
          "enum": [
            "true",
            "false"
          ]
        },
        "raw": {
          "type": "string",
          "description": "0 leaves out the bulky `raw` source blocks (often 10-30x smaller).",
          "enum": [
            "0",
            "1"
          ]
        },
        "fields": {
          "type": "string",
          "description": "Comma-separated fields to return, e.g. `posts.id,posts.title`. Call metadata is always included."
        },
        "fresh": {
          "type": "string",
          "description": "1 skips the 24-hour cache and fetches live.",
          "enum": [
            "1"
          ]
        },
        "output": {
          "type": "string",
          "description": "JSON only for this OpenAny product. Omit output or use json; CSV and NDJSON are not supported.",
          "enum": [
            "json"
          ]
        },
        "records": {
          "type": "string",
          "description": "With output=csv|ndjson: the top-level list to turn into rows (e.g. `reviews`), or `.` for the whole object as one row."
        }
      },
      "required": [
        "username"
      ]
    },
    "headers": {
      "type": "object",
      "properties": {}
    }
  },
  "required": [
    "path",
    "query",
    "headers"
  ]
}
```

## Response fields
Source: Inferred from examples; not an exhaustive provider schema.
```json
{
  "type": "object",
  "properties": {
    "attended": {
      "type": "integer"
    },
    "cached": {
      "type": "boolean"
    },
    "count": {
      "type": "integer"
    },
    "credits_used": {
      "type": "integer"
    },
    "fetched_at": {
      "type": "string"
    },
    "global_ranking": {
      "type": "integer"
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "attended": {
            "type": "boolean"
          },
          "contest": {
            "type": "string"
          },
          "finish_time_seconds": {
            "type": "integer"
          },
          "problems_solved": {
            "type": "integer"
          },
          "ranking": {
            "type": "integer"
          },
          "rating": {
            "type": "number"
          },
          "slug": {
            "type": "string"
          },
          "start": {
            "type": "string"
          },
          "total_problems": {
            "type": "integer"
          },
          "trend": {
            "type": "string"
          }
        }
      }
    },
    "rating": {
      "type": "integer"
    },
    "top_percentage": {
      "type": "number"
    },
    "username": {
      "type": "string"
    }
  }
}
```

## Request example
Scenario: Official example · Live API.SH response · Minimal request
```bash
curl \
  'https://api.openany.si/v1/agent-apis/apish/leetcode/v1/user/contests?output=json&raw=0&username=lee215' \
  -X GET \
  -H "Authorization: Bearer $OPENANY_API_KEY" \
  -H 'Content-Type: application/json'
```

## Response example
Example from the provider's documentation. Field values in your results will differ.
Sample response · Documented HTTP 200
```json
{
  "attended": 27,
  "cached": false,
  "count": 27,
  "credits_used": 1,
  "fetched_at": "2026-11-19T12:29:44.055Z",
  "global_ranking": 7647,
  "items": [
    {
      "attended": true,
      "contest": "Weekly Contest 416",
      "finish_time_seconds": 4883,
      "problems_solved": 4,
      "ranking": 2663,
      "rating": 2204.3,
      "slug": "weekly-contest-416",
      "start": "2024-09-22T02:30:00.000Z",
      "total_problems": 4,
      "trend": "DOWN"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 176",
      "finish_time_seconds": 3192,
      "problems_solved": 4,
      "ranking": 59,
      "rating": 2222.4,
      "slug": "weekly-contest-176",
      "start": "2020-02-16T02:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 156",
      "finish_time_seconds": 1961,
      "problems_solved": 4,
      "ranking": 26,
      "rating": 2163.1,
      "slug": "weekly-contest-156",
      "start": "2019-09-29T02:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 79",
      "finish_time_seconds": 2037,
      "problems_solved": 3,
      "ranking": 217,
      "rating": 2081.3,
      "slug": "weekly-contest-79",
      "start": "2018-04-08T01:30:00.000Z",
      "total_problems": 4,
      "trend": "DOWN"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 78",
      "finish_time_seconds": 5244,
      "problems_solved": 3,
      "ranking": 76,
      "rating": 2095.4,
      "slug": "weekly-contest-78",
      "start": "2018-04-01T01:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 77",
      "finish_time_seconds": 6394,
      "problems_solved": 4,
      "ranking": 208,
      "rating": 2074.7,
      "slug": "weekly-contest-77",
      "start": "2018-03-25T01:30:00.000Z",
      "total_problems": 4,
      "trend": "DOWN"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 76",
      "finish_time_seconds": 4219,
      "problems_solved": 3,
      "ranking": 56,
      "rating": 2082.7,
      "slug": "weekly-contest-76",
      "start": "2018-03-18T01:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 75",
      "finish_time_seconds": 6288,
      "problems_solved": 4,
      "ranking": 99,
      "rating": 2052.5,
      "slug": "weekly-contest-75",
      "start": "2018-03-11T02:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 73",
      "finish_time_seconds": 4095,
      "problems_solved": 4,
      "ranking": 125,
      "rating": 2033.7,
      "slug": "weekly-contest-73",
      "start": "2018-02-25T02:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 72",
      "finish_time_seconds": 376,
      "problems_solved": 1,
      "ranking": 689,
      "rating": 2024.1,
      "slug": "weekly-contest-72",
      "start": "2018-02-18T02:30:00.000Z",
      "total_problems": 4,
      "trend": "DOWN"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 71",
      "finish_time_seconds": 6087,
      "problems_solved": 4,
      "ranking": 24,
      "rating": 2076.2,
      "slug": "weekly-contest-71",
      "start": "2018-02-11T02:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 69",
      "finish_time_seconds": 4528,
      "problems_solved": 4,
      "ranking": 79,
      "rating": 2022.1,
      "slug": "weekly-contest-69",
      "start": "2018-01-28T02:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 68",
      "finish_time_seconds": 2777,
      "problems_solved": 4,
      "ranking": 54,
      "rating": 1992.4,
      "slug": "weekly-contest-68",
      "start": "2018-01-21T02:30:00.000Z",
      "total_problems": 5,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 66",
      "finish_time_seconds": 4954,
      "problems_solved": 3,
      "ranking": 352,
      "rating": 1948.1,
      "slug": "weekly-contest-66",
      "start": "2018-01-07T02:30:00.000Z",
      "total_problems": 4,
      "trend": "DOWN"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 63",
      "finish_time_seconds": 6244,
      "problems_solved": 4,
      "ranking": 53,
      "rating": 1963,
      "slug": "weekly-contest-63",
      "start": "2017-12-17T02:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 54",
      "finish_time_seconds": 5334,
      "problems_solved": 4,
      "ranking": 74,
      "rating": 1920.2,
      "slug": "leetcode-weekly-contest-54",
      "start": "2017-10-15T01:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 50",
      "finish_time_seconds": 3386,
      "problems_solved": 4,
      "ranking": 29,
      "rating": 1872.5,
      "slug": "leetcode-weekly-contest-50",
      "start": "2017-09-17T01:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 48",
      "finish_time_seconds": 3811,
      "problems_solved": 4,
      "ranking": 84,
      "rating": 1793.1,
      "slug": "leetcode-weekly-contest-48",
      "start": "2017-09-03T01:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 47",
      "finish_time_seconds": 6209,
      "problems_solved": 3,
      "ranking": 277,
      "rating": 1736,
      "slug": "leetcode-weekly-contest-47",
      "start": "2017-08-27T01:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 46",
      "finish_time_seconds": 5822,
      "problems_solved": 2,
      "ranking": 690,
      "rating": 1711.7,
      "slug": "leetcode-weekly-contest-46",
      "start": "2017-08-20T01:30:00.000Z",
      "total_problems": 4,
      "trend": "DOWN"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 45",
      "finish_time_seconds": 5987,
      "problems_solved": 4,
      "ranking": 86,
      "rating": 1723.3,
      "slug": "leetcode-weekly-contest-45",
      "start": "2017-08-13T01:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 44",
      "finish_time_seconds": 3309,
      "problems_solved": 4,
      "ranking": 17,
      "rating": 1656.5,
      "slug": "leetcode-weekly-contest-44",
      "start": "2017-08-06T01:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 23",
      "finish_time_seconds": 1762,
      "problems_solved": 1,
      "ranking": 907,
      "rating": 1516.8,
      "slug": "leetcode-weekly-contest-23",
      "start": "2017-03-12T02:30:00.000Z",
      "total_problems": 4,
      "trend": "DOWN"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 19",
      "finish_time_seconds": 6534,
      "problems_solved": 3,
      "ranking": 646,
      "rating": 1534.1,
      "slug": "leetcode-weekly-contest-19",
      "start": "2017-02-12T02:30:00.000Z",
      "total_problems": 4,
      "trend": "DOWN"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 18B",
      "finish_time_seconds": 9468,
      "problems_solved": 4,
      "ranking": 312,
      "rating": 1542.2,
      "slug": "leetcode-weekly-contest-18b",
      "start": "2017-02-05T02:30:00.000Z",
      "total_problems": 4,
      "trend": "UP"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 18A",
      "finish_time_seconds": 6380,
      "problems_solved": 2,
      "ranking": 375,
      "rating": 1524.8,
      "slug": "leetcode-weekly-contest-18a",
      "start": "2017-02-04T15:30:00.000Z",
      "total_problems": 3,
      "trend": "DOWN"
    },
    {
      "attended": true,
      "contest": "Weekly Contest 16A",
      "finish_time_seconds": 10184,
      "problems_solved": 2,
      "ranking": 145,
      "rating": 1556.2,
      "slug": "leetcode-weekly-contest-16a",
      "start": "2017-01-21T15:30:00.000Z",
      "total_problems": 3,
      "trend": "UP"
    }
  ],
  "rating": 2204,
  "top_percentage": 0.9,
  "username": "lee215"
}
```

## Error handling
400: Check the request fields.
401 / 403: Verify credentials and access permissions.
402: Inspect payment requirements and balance.
429: Respect returned retry guidance.
5xx: Inspect the error and usage record before retrying a paid operation.

Integration guide: https://openany.si/docs/
Agent setup: https://openany.si/SKILL.md
