# Codechef — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Access competitive programming data from CodeChef by retrieving problem lists, contest information with details, user profiles, and recent submission history. Explore coding challenges across multiple contests and browse problems by difficulty rating.

**Category:** Developer Tools | **Website:** [codechef.com/](https://codechef.com/) | **Docs:** [parse.bot/marketplace/57b88850-0922-4fec-9b43-39f9fa21bd9b/codechef-com-api](https://parse.bot/marketplace/57b88850-0922-4fec-9b43-39f9fa21bd9b/codechef-com-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-codechef-com-api-57b88850/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_contest_details

Fetches detailed information about a specific CodeChef contest including its name, rules, problems list, timing, divisions, and rankings metadata. For parent contests with divisions, child_contests maps division codes to their contest details.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `contest_code` | string | Yes | Contest code (e.g. START242, DEVWEEKEND54). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-codechef-com-api-57b88850/get_contest_details \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"contest_code":"<string>"}'
```

### get_contest_list

Fetches all present, future, and past contests from CodeChef. Returns categorized lists of contests with dates, durations, and participant counts. No parameters required.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-codechef-com-api-57b88850/get_contest_list \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_problem_details

Fetches the full details of a specific problem including the problem statement HTML, constraints, tags, author info, time limits, and editorial links. Use contest_code PRACTICE for practice problems or the specific contest code for contest problems.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `contest_code` | string | No | Contest code the problem belongs to, or PRACTICE for practice problems. |
| `problem_code` | string | Yes | Problem code (e.g. PALIN, BTWSXOR). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-codechef-com-api-57b88850/get_problem_details \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"contest_code":"<string>","problem_code":"<string>"}'
```

### get_problems_list

Fetches a paginated list of problems from CodeChef with filtering by category, difficulty rating range, and search keyword. Returns problem metadata including submission counts and difficulty ratings. Pagination is zero-indexed. Results are sorted by the specified field and order.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `category` | string | No | Problem category filter. |
| `end_rating` | integer | No | Maximum difficulty rating (inclusive). |
| `limit` | integer | No | Number of problems to return per page. |
| `page` | integer | No | Page number (0-indexed). |
| `search` | string | No | Search keyword to filter problems by name or code. |
| `sort_by` | string | No | Field to sort by. |
| `sort_order` | string | No | Sort order. |
| `start_rating` | integer | No | Minimum difficulty rating (inclusive). Use -1 for no lower bound. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-codechef-com-api-57b88850/get_problems_list \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"category":"<string>","end_rating":"<integer>","limit":"<integer>","page":"<integer>","search":"<string>","sort_by":"<string>","sort_order":"<string>","start_rating":"<integer>"}'
```

### get_user_info

Fetches public profile and rating history for a CodeChef user. Returns rating data across contest types (all, all_old, dsa_monday), initial ratings, and user metadata extracted from the profile page.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `username` | string | Yes | CodeChef username. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-codechef-com-api-57b88850/get_user_info \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"username":"<string>"}'
```

### get_user_recent_submissions

Fetches the recent submissions of a CodeChef user. Returns a paginated list of submissions with problem name, result, language, and timestamp. The response is parsed from server-rendered HTML content.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `page` | integer | No | Page number (0-indexed). |
| `username` | string | Yes | CodeChef username. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-codechef-com-api-57b88850/get_user_recent_submissions \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"page":"<integer>","username":"<string>"}'
```
