# LeetCode Problem Metadata API

Get LeetCode Problem Metadata via REST or OpenAny MCP—with pay-per-use pricing and no subscription. Powered by Apish, pass parameters such as output, raw, slug, and retrieve structured data including displayed problem identifier, internal source identifier, difficulty label, function name, and function parameter definitions to build metadata catalogs, and inspect function interfaces.

Documentation: https://openany.si/market/apis/leetcode/leetcode-problem-metadata-api/?offering=efbae306-4bd3-4595-9597-591f5a706fa7
API ID: efbae306-4bd3-4595-9597-591f5a706fa7
Provider: apish
Contract revision: 3
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/apish/leetcode/v1/problem
Page update time: 2026-12-03T02:44:09.703Z
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.370Z. 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 Problem Metadata 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": {
        "slug": {
          "type": "string",
          "description": "Problem slug or leetcode.com/problems/ link."
        },
        "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": [
        "slug"
      ]
    },
    "headers": {
      "type": "object",
      "properties": {}
    }
  },
  "required": [
    "path",
    "query",
    "headers"
  ]
}
```

## Response fields
Source: Inferred from examples; not an exhaustive provider schema.
```json
{
  "type": "object",
  "properties": {
    "acceptance_rate": {
      "type": "number"
    },
    "accepted": {
      "type": "integer"
    },
    "cached": {
      "type": "boolean"
    },
    "category": {
      "type": "string"
    },
    "credits_used": {
      "type": "integer"
    },
    "difficulty": {
      "type": "string"
    },
    "dislikes": {
      "type": "integer"
    },
    "fetched_at": {
      "type": "string"
    },
    "function_name": {
      "type": "string"
    },
    "has_solution": {
      "type": "boolean"
    },
    "has_video_solution": {
      "type": "boolean"
    },
    "hints_count": {
      "type": "integer"
    },
    "id": {
      "type": "string"
    },
    "internal_id": {
      "type": "string"
    },
    "languages": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "likes": {
      "type": "integer"
    },
    "params": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        }
      }
    },
    "premium": {
      "type": "boolean"
    },
    "return_type": {
      "type": "string"
    },
    "similar": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "difficulty": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        }
      }
    },
    "slug": {
      "type": "string"
    },
    "submissions": {
      "type": "integer"
    },
    "title": {
      "type": "string"
    },
    "topics": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          }
        }
      }
    },
    "url": {
      "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/problem?output=json&raw=0&slug=two-sum' \
  -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
{
  "acceptance_rate": 58.1,
  "accepted": 24158403,
  "cached": false,
  "category": "Algorithms",
  "credits_used": 1,
  "difficulty": "Easy",
  "dislikes": 2666,
  "fetched_at": "2026-11-19T12:29:41.120Z",
  "function_name": "twoSum",
  "has_solution": true,
  "has_video_solution": true,
  "hints_count": 3,
  "id": "1",
  "internal_id": "1",
  "languages": [
    "cpp",
    "java",
    "python3",
    "python",
    "javascript",
    "typescript",
    "csharp",
    "c",
    "golang",
    "kotlin",
    "swift",
    "rust",
    "ruby",
    "php",
    "dart",
    "scala",
    "elixir",
    "erlang",
    "racket"
  ],
  "likes": 71232,
  "params": [
    {
      "name": "nums",
      "type": "integer[]"
    },
    {
      "name": "target",
      "type": "integer"
    }
  ],
  "premium": false,
  "return_type": "integer[]",
  "similar": [
    {
      "difficulty": "Medium",
      "slug": "3sum",
      "title": "3Sum"
    },
    {
      "difficulty": "Medium",
      "slug": "4sum",
      "title": "4Sum"
    },
    {
      "difficulty": "Medium",
      "slug": "two-sum-ii-input-array-is-sorted",
      "title": "Two Sum II - Input Array Is Sorted"
    },
    {
      "difficulty": "Easy",
      "slug": "two-sum-iii-data-structure-design",
      "title": "Two Sum III - Data structure design"
    },
    {
      "difficulty": "Medium",
      "slug": "subarray-sum-equals-k",
      "title": "Subarray Sum Equals K"
    },
    {
      "difficulty": "Easy",
      "slug": "two-sum-iv-input-is-a-bst",
      "title": "Two Sum IV - Input is a BST"
    },
    {
      "difficulty": "Easy",
      "slug": "two-sum-less-than-k",
      "title": "Two Sum Less Than K"
    },
    {
      "difficulty": "Medium",
      "slug": "max-number-of-k-sum-pairs",
      "title": "Max Number of K-Sum Pairs"
    },
    {
      "difficulty": "Medium",
      "slug": "count-good-meals",
      "title": "Count Good Meals"
    },
    {
      "difficulty": "Easy",
      "slug": "count-number-of-pairs-with-absolute-difference-k",
      "title": "Count Number of Pairs With Absolute Difference K"
    },
    {
      "difficulty": "Medium",
      "slug": "number-of-pairs-of-strings-with-concatenation-equal-to-target",
      "title": "Number of Pairs of Strings With Concatenation Equal to Target"
    },
    {
      "difficulty": "Easy",
      "slug": "find-all-k-distant-indices-in-an-array",
      "title": "Find All K-Distant Indices in an Array"
    },
    {
      "difficulty": "Easy",
      "slug": "first-letter-to-appear-twice",
      "title": "First Letter to Appear Twice"
    },
    {
      "difficulty": "Hard",
      "slug": "number-of-excellent-pairs",
      "title": "Number of Excellent Pairs"
    },
    {
      "difficulty": "Easy",
      "slug": "number-of-arithmetic-triplets",
      "title": "Number of Arithmetic Triplets"
    },
    {
      "difficulty": "Medium",
      "slug": "node-with-highest-edge-score",
      "title": "Node With Highest Edge Score"
    },
    {
      "difficulty": "Easy",
      "slug": "check-distances-between-same-letters",
      "title": "Check Distances Between Same Letters"
    },
    {
      "difficulty": "Easy",
      "slug": "find-subarrays-with-equal-sum",
      "title": "Find Subarrays With Equal Sum"
    },
    {
      "difficulty": "Easy",
      "slug": "largest-positive-integer-that-exists-with-its-negative",
      "title": "Largest Positive Integer That Exists With Its Negative"
    },
    {
      "difficulty": "Easy",
      "slug": "number-of-distinct-averages",
      "title": "Number of Distinct Averages"
    },
    {
      "difficulty": "Easy",
      "slug": "count-pairs-whose-sum-is-less-than-target",
      "title": "Count Pairs Whose Sum is Less than Target"
    }
  ],
  "slug": "two-sum",
  "submissions": 41555139,
  "title": "Two Sum",
  "topics": [
    {
      "name": "Array",
      "slug": "array"
    },
    {
      "name": "Hash Table",
      "slug": "hash-table"
    }
  ],
  "url": "https://leetcode.com/problems/two-sum/"
}
```

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

## Available implementations
- apish: https://openany.si/market/apis/leetcode/leetcode-problem-metadata-api/?offering=efbae306-4bd3-4595-9597-591f5a706fa7

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