# Codechef — Wrapped API

> **You are on:** `https://api.beta.paywithlocus.com/api` | [llms.txt](https://beta.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 for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.beta.paywithlocus.com/api/wrapped/credits/codechef/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## 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.beta.paywithlocus.com/api/wrapped/credits/codechef/get-contest-details \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/codechef/get-contest-list \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/codechef/get-problem-details \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/codechef/get-problems-list \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/codechef/get-user-info \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/codechef/get-user-recent-submissions \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"page":"<integer>","username":"<string>"}'
```

## Next steps

- [All wrapped API providers](https://beta.paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://beta.paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://beta.paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://beta.paywithlocus.com/agent/index.md): every Locus agent page.