OpenAny
Get API keyAPI Key
APIDeveloperData

leetcode logo
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.

Selected price
$0.002 / billing creditPublished pricing
Sellers / APIs
1 / 1
Requests · 30d
1Selected implementation · last 30 days
Success rate · 30d
100.00%Selected implementation · last 30 days
USE THIS API

LeetCode Contest History API

Prepare your request, then continue with your agent.

Pricing

$0.002 / billing credit

Calculated from input parameters and actual returned quantities. Estimate the maximum cost before calling.

Provider
Pricing
Connect your agent
On this page

Overview

Overview
LeetCode Contest History API

LeetCode Contest History API

username is required. attended_only defaults to true; the response includes event entries and summary rating information.

Quick Facts

Fact Value
Access OpenAny REST
Authentication OpenAny API key in the Authorization header
Core inputs Required inputs: username. Optional: attended_only. JSON only; fresh=1 bypasses cache and raw=0 trims raw source blocks.
Selected implementation apish · LeetCode user contest history API
Billing See the pricing area for the selected implementation and request options

What You Can Build

  • Display rating history: Keep event and rating paired.
  • Separate participation: Preserve attended flags when including other entries.

Returned Data

Field Meaning
username LeetCode username
rating Published summary contest rating
items[].contest Contest reference
items[].attended Participation flag
items[].ranking Contest rank
items[].problems_solved Solved problem count
items[].rating Event-associated rating

Quick Start

  1. Set OPENANY_API_KEY to your OpenAny API key.
  2. Review the selected implementation and pricing, then adapt the request below to your target.
  3. Check the HTTP response and business result before reading optional fields.
bash
curl --request GET --get \
  https://api.openany.si/v1/agent-apis/apish/leetcode/v1/user/contests \
  -H "Authorization: Bearer ${OPENANY_API_KEY}" \
  --data-urlencode output=json \
  --data-urlencode raw=0 \
  --data-urlencode username=lee215

Request and Response Examples

The response example is a documentation reference and may be abbreviated. The documented request is a calling template; use the published contract and returned response for the selected implementation.

Published LeetCode Contest History API implementation contract.

Pricing and Billing

The pricing area reflects the selected API implementation. Review its billing unit and any request-dependent rules before calling; a source service's public availability does not determine OpenAny billing.

Frequently Asked Questions

View FAQ

Related APIs

Playground

Run sends a real API request. Charges follow the published API contract.

Request parameters
LeetCode username or leetcode.com/u/ profile link.
Optional parameters (6)
`true` (default): only contests the user took part in.
0 leaves out the bulky `raw` source blocks (often 10-30x smaller).
Comma-separated fields to return, e.g. `posts.id,posts.title`. Call metadata is always included.
1 skips the 24-hour cache and fetches live.
JSON only for this OpenAny product. Omit output or use json; CSV and NDJSON are not supported.
With output=csv|ndjson: the top-level list to turn into rows (e.g. `reviews`), or `.` for the whole object as one row.

Sample response

Run a request to see the actual response. Published samples are in Examples.

Response result

Sellers

SellerPricingRequests · 30dPerformanceAccess
apishCurrent
LeetCode Contest History API · GET · View API reference
$0.002 / billing credit1
100.00%successP506.24s
Selected implementation traffic · 11/3/2026 – 12/3/2026 (UTC)
Selected pricing · apishUSD / billing credit
Pricing
$0.002

Calculated from input parameters and actual returned quantities. Estimate the maximum cost before calling.

Statistics use persisted gateway logs from the last 30 days up to now, including today.
Success rate = successful requests / all requests;
P50 = median latency of successful requests.
Prices reflect the published API contract. Contract revision: 3. Price update time: not supplied.

API

Method
GET
Endpoint
https://api.openany.si/v1/agent-apis/apish/leetcode/v1/user/contests
Content type
application/json
Authentication
Authorization: Bearer $OPENANY_API_KEY
View request and response examples

Input parameters

Fields in this listing; additional options and input encoding can vary by provider.

ParameterLocationTypeRequiredDescription
usernameURL query parametersquerystringYes

LeetCode username or leetcode.com/u/ profile link.

attended_onlyURL query parametersquerystringNo

`true` (default): only contests the user took part in.

enum: "true", "false"

rawURL query parametersquerystringNo

0 leaves out the bulky `raw` source blocks (often 10-30x smaller).

enum: "0", "1"

fieldsURL query parametersquerystringNo

Comma-separated fields to return, e.g. `posts.id,posts.title`. Call metadata is always included.

freshURL query parametersquerystringNo

1 skips the 24-hour cache and fetches live.

enum: "1"

outputURL query parametersquerystringNo

JSON only for this OpenAny product. Omit output or use json; CSV and NDJSON are not supported.

enum: "json"

recordsURL query parametersquerystringNo

With output=csv|ndjson: the top-level list to turn into rows (e.g. `reviews`), or `.` for the whole object as one row.

Required markers inside a nested object or variant apply when that object or variant is used.

Response structure

Inferred from examples
  • attendedinteger
  • cachedboolean
  • countinteger
  • credits_usedinteger
  • fetched_atstring
  • global_rankinginteger
  • itemsobject[]
    • attendedboolean
    • conteststring
    • finish_time_secondsinteger
    • problems_solvedinteger
    • rankinginteger
    • ratingnumber
    • slugstring
    • startstring
    • total_problemsinteger
    • trendstring
  • ratinginteger
  • top_percentagenumber
  • usernamestring

Composite rule pricing

Calculated from input parameters and actual returned quantities. Estimate the maximum cost before calling.

Base fee: $0.000000. One matching variant replaces the base fee. Matching add-ons and quantity charges are added.

Fee itemPriceMetering sourceWhenQuantity limit
Actual API.SH credits consumed$0.002000 / billing creditResponse · /credits_used · Numeric valueAlways1 billing credit · Decimal places: 0

Each quantity charge is rounded before summing: ceil. Requests exceeding this cost limit are rejected; it is not a price cap: $0.002000.

Response quantities settle after the response. Before execution, the maximum quantity determines the reservation; unused reservation is released. Missing or invalid quantities are not treated as zero.

Pricing parameters and defaults
[]

Agent integration

Copy the resource contract without sharing an API key.

Download MDView API Markdown

Error handling

StatusNext step
400Check the offering and request fields.
401 / 403Verify your credentials and access permissions.
402Inspect the selected access mode and returned payment requirements.
429Respect the returned rate limit and retry guidance.
5xxInspect the error and usage record before retrying a paid operation.

Examples

Official example · Live API.SH response · Minimal request

Example from the provider's documentation. Field values in your results will differ.

  1. Prepare your environment

    Use a terminal with cURL installed.

    Use an OpenAny API key with shared-balance access. Confirm availability and price before running; a call may charge your balance.

    Set the key in your terminal using the hidden prompt below. Keep its value out of source files and logs.

    Terminal · macOS / Linux
    printf 'OpenAny API key: '
    read -r -s OPENANY_API_KEY
    export OPENANY_API_KEY
    printf '\n'
  2. Run the request

    Paste the complete command below into your terminal.

    Values to replace before running 7

    Review these request fields before running. Keep the published provider and request method unchanged.

    username
    LeetCode username or leetcode.com/u/ profile link.
    attended_only
    `true` (default): only contests the user took part in.
    raw
    0 leaves out the bulky `raw` source blocks (often 10-30x smaller).
    fields
    Comma-separated fields to return, e.g. `posts.id,posts.title`. Call metadata is always included.
    fresh
    1 skips the 24-hour cache and fetches live.
    output
    JSON only for this OpenAny product. Omit output or use json; CSV and NDJSON are not supported.
    records
    With output=csv|ndjson: the top-level list to turn into rows (e.g. `reviews`), or `.` for the whole object as one row.
    Terminal · cURL
    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'
  3. Check the response

    Sample response · Documented HTTP 200

    Sample response
    {
      "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"
    }

Common questions

What does attended_only default to?

true.

Can I include other contest entries?

Set attended_only=false and inspect each attended flag.

What username formats are supported?

A username or supported leetcode.com/u profile link.

Is global_ranking the rank in every contest?

No. Per-event ranking and summary global ranking have different scopes.

Can I paginate history?

No page or cursor parameter is exposed.

Can I request CSV or NDJSON?

This OpenAny implementation serves JSON only. Omit output or use output=json.

Use LeetCode Contest History API with your agent

Inspect endpoint contracts and confirm availability and pricing before a paid call.