# Judge0

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

> Online code execution — run source code in 60+ programming languages with sandboxed isolation.

**Category:** Developer Tools | **Website:** [judge0.com](https://judge0.com) | **Docs:** [ce.judge0.com](https://ce.judge0.com)

## Access Methods

| Method | Base URL | Auth |
|--------|----------|------|
| **MPP (Tempo)** | `https://judge0.mpp.paywithlocus.com/judge0/` | HTTP 402 auto-payment |
| **Wrapped API** | `https://beta-api.paywithlocus.com/api/wrapped/judge0/` | `Authorization: Bearer <LOCUS_API_KEY>` |

**OpenAPI discovery:** `GET https://judge0.mpp.paywithlocus.com/openapi.json`

## Endpoints

### Execute Code

Submit source code for synchronous execution. Returns stdout, stderr, compile output, execution time, and memory usage.

**Estimated cost:** $0.006

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `source_code` | string | Yes | Program source code to execute |
| `language_id` | integer | Yes | Language ID (e.g., 71 for Python 3, 63 for JavaScript, 54 for C++, 62 for Java). Use list-languages to find IDs. |
| `stdin` | string | No | Standard input for the program |
| `expected_output` | string | No | Expected output — if provided, status will indicate whether output matches |
| `compiler_options` | string | No | Compiler flags (max 512 chars, e.g., "-O2 -Wall") |
| `command_line_arguments` | string | No | Command-line arguments passed to the program (max 512 chars) |
| `cpu_time_limit` | number | No | CPU time limit in seconds (default: instance-dependent) |
| `wall_time_limit` | number | No | Wall clock time limit in seconds |
| `memory_limit` | number | No | Memory limit in kilobytes |
| `stack_limit` | number | No | Stack size limit in kilobytes |
| `redirect_stderr_to_stdout` | boolean | No | Redirect stderr to stdout in the output |
| `enable_network` | boolean | No | Allow network access inside the sandbox |

```bash
curl -X POST https://judge0.mpp.paywithlocus.com/judge0/execute-code \
  -H "Content-Type: application/json" \
  -d '{"source_code":"<string>","language_id":"<integer>","stdin":"<string>","expected_output":"<string>","compiler_options":"<string>","command_line_arguments":"<string>","cpu_time_limit":"<number>","wall_time_limit":"<number>","memory_limit":"<number>","stack_limit":"<number>","redirect_stderr_to_stdout":"<boolean>","enable_network":"<boolean>"}'
```

### Submit Code (Async)

Submit code for asynchronous execution. Returns a token immediately — use get-submission to poll for results. Use this instead of execute-code for long-running programs that may time out.

**Estimated cost:** $0.006

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `source_code` | string | Yes | Program source code to execute |
| `language_id` | integer | Yes | Language ID (e.g., 71 for Python 3, 63 for JavaScript, 54 for C++, 62 for Java). Use list-languages to find IDs. |
| `stdin` | string | No | Standard input for the program |
| `expected_output` | string | No | Expected output — if provided, status will indicate whether output matches |
| `compiler_options` | string | No | Compiler flags (max 512 chars, e.g., "-O2 -Wall") |
| `command_line_arguments` | string | No | Command-line arguments passed to the program (max 512 chars) |
| `cpu_time_limit` | number | No | CPU time limit in seconds (default: instance-dependent) |
| `wall_time_limit` | number | No | Wall clock time limit in seconds |
| `memory_limit` | number | No | Memory limit in kilobytes |
| `stack_limit` | number | No | Stack size limit in kilobytes |
| `redirect_stderr_to_stdout` | boolean | No | Redirect stderr to stdout in the output |
| `enable_network` | boolean | No | Allow network access inside the sandbox |

```bash
curl -X POST https://judge0.mpp.paywithlocus.com/judge0/submit-code \
  -H "Content-Type: application/json" \
  -d '{"source_code":"<string>","language_id":"<integer>","stdin":"<string>","expected_output":"<string>","compiler_options":"<string>","command_line_arguments":"<string>","cpu_time_limit":"<number>","wall_time_limit":"<number>","memory_limit":"<number>","stack_limit":"<number>","redirect_stderr_to_stdout":"<boolean>","enable_network":"<boolean>"}'
```

### Get Submission

Retrieve the result of an async submission by token. Poll this after submit-code until status.id >= 3 (no longer queued/processing).

**Estimated cost:** $0.005 (fee only)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `token` | string | Yes | Submission token returned by submit-code |

```bash
curl -X POST https://judge0.mpp.paywithlocus.com/judge0/get-submission \
  -H "Content-Type: application/json" \
  -d '{"token":"<string>"}'
```

### List Languages

List all active programming languages with their IDs. Use language IDs for the execute-code endpoint.

**Estimated cost:** $0.005 (fee only)

_No parameters required._

```bash
curl -X POST https://judge0.mpp.paywithlocus.com/judge0/list-languages \
  -H "Content-Type: application/json" \
  -d '{}'
```

### List Statuses

List all possible submission status codes (e.g., Accepted, Wrong Answer, Time Limit Exceeded).

**Estimated cost:** $0.005 (fee only)

_No parameters required._

```bash
curl -X POST https://judge0.mpp.paywithlocus.com/judge0/list-statuses \
  -H "Content-Type: application/json" \
  -d '{}'
```
