# LeetCode problem list API

Search LeetCode Problem via REST or OpenAny MCP—with pay-per-use pricing and no subscription. Powered by Apish, pass parameters such as difficulty, limit, output, and retrieve structured data including displayed problem identifier, problem slug, problem title, difficulty label, and reported acceptance rate to build topic practice lists, and resolve metadata, ready for production pipelines and AI agent automation.

Documentation: https://openany.si/leetcode/leetcode-problem-list-api/0b52ec7c-0327-4c3f-851b-5a8af43b5898/
API ID: 0b52ec7c-0327-4c3f-851b-5a8af43b5898
Provider: apish
Contract revision: 3
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/apish/leetcode/v1/problems
Page update time: 2026-12-03T02:44:09.691Z
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.
Contract update time: 2026-12-03T02:44:06.296Z. 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": []
  }
}
```

## Usage and limits
## LeetCode Problem Search API

tags uses comma-separated topic slugs that must all match. page defaults to 1; limit defaults to 50 and is capped at 100.

## What You Can Build

- **Build topic practice lists**: Combine tags and difficulty.
- **Resolve metadata**: Pass a returned slug to Problem Metadata.

## Returned Data

| Field | Meaning |
| --- | --- |
| `items[].id` | Displayed problem identifier |
| `items[].slug` | Problem slug |
| `items[].title` | Problem title |
| `items[].difficulty` | Difficulty label |
| `items[].acceptance_rate` | Reported acceptance rate |
| `items[].premium` | Premium classification |
| `next_page` | Continuation page |

## Request parameters
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "LeetCode problem list 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": {
        "q": {
          "type": "string",
          "description": "Search words in the title or the problem number."
        },
        "difficulty": {
          "type": "string",
          "description": "Difficulty.",
          "enum": [
            "easy",
            "medium",
            "hard"
          ]
        },
        "tags": {
          "type": "string",
          "description": "Topic tag slugs, comma-separated (all must match), e.g. `dynamic-programming,tree`."
        },
        "category": {
          "type": "string",
          "description": "Problem category.",
          "enum": [
            "algorithms",
            "database",
            "shell",
            "concurrency",
            "javascript",
            "pandas"
          ]
        },
        "premium": {
          "type": "string",
          "description": "`true`: premium problems only; `false`: free only.",
          "enum": [
            "true",
            "false"
          ]
        },
        "order_by": {
          "type": "string",
          "description": "Sort field (default: problem number).",
          "enum": [
            "id",
            "ac_rate",
            "difficulty",
            "frequency"
          ]
        },
        "sort": {
          "type": "string",
          "description": "`asc` (default) or `desc` (with order_by).",
          "enum": [
            "asc",
            "desc"
          ]
        },
        "page": {
          "type": "integer",
          "description": "Page number (default 1)."
        },
        "limit": {
          "type": "integer",
          "description": "Results per page (default 50, max 100)."
        },
        "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."
        }
      }
    },
    "headers": {
      "type": "object",
      "properties": {}
    }
  },
  "required": [
    "path",
    "query",
    "headers"
  ]
}
```

## Response fields
Source: Inferred from examples; not an exhaustive provider schema.
```json
{
  "type": "object",
  "properties": {
    "cached": {
      "type": "boolean"
    },
    "count": {
      "type": "integer"
    },
    "credits_used": {
      "type": "integer"
    },
    "difficulty": {
      "type": "string"
    },
    "fetched_at": {
      "type": "string"
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "acceptance_rate": {
            "type": "number"
          },
          "difficulty": {
            "type": "string"
          },
          "has_solution": {
            "type": "boolean"
          },
          "has_video_solution": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "premium": {
            "type": "boolean"
          },
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "topics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "url": {
            "type": "string"
          }
        }
      }
    },
    "next_page": {
      "type": "integer"
    },
    "page": {
      "type": "integer"
    },
    "query": {
      "type": "null"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "total": {
      "type": "integer"
    }
  }
}
```

## Request example
Scenario: Official example · Live API.SH response · Minimal request
```bash
curl \
  'https://api.openany.si/v1/agent-apis/apish/leetcode/v1/problems?difficulty=hard&limit=1&output=json&raw=0&tags=dynamic-programming' \
  -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
{
  "cached": false,
  "count": 1,
  "credits_used": 1,
  "difficulty": "hard",
  "fetched_at": "2026-11-19T12:29:42.065Z",
  "items": [
    {
      "acceptance_rate": 32.13,
      "difficulty": "Hard",
      "has_solution": true,
      "has_video_solution": false,
      "id": "10",
      "premium": false,
      "slug": "regular-expression-matching",
      "title": "Regular Expression Matching",
      "topics": [
        "string",
        "dynamic-programming",
        "recursion"
      ],
      "url": "https://leetcode.com/problems/regular-expression-matching/"
    }
  ],
  "next_page": 2,
  "page": 1,
  "query": null,
  "tags": [
    "dynamic-programming"
  ],
  "total": 340
}
```

## 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.

## Common questions
### Do several topic tags use OR matching?
No. The contract specifies that all comma-separated tags must match.

### How do premium filters work?
premium=true selects premium problems; false selects free problems. This does not grant access to restricted content.

### What pagination defaults apply?
page defaults to 1 and limit to 50, capped at 100.

### Can I search a problem number?
Yes. q supports title words or a problem number.

### Does this return full statements or executable solutions?
No. It lists metadata and availability flags.

### Can I request CSV or NDJSON?
This OpenAny implementation serves JSON only. Omit output or use output=json.

## Available implementations
- apish: https://openany.si/leetcode/leetcode-problem-list-api/0b52ec7c-0327-4c3f-851b-5a8af43b5898/

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