Back to top

Judge0 API

About

Judge0 is a non-profit organization that creates free and open-source tools and services for executing and grading untrusted source code.

Judge0 API is a free, robust, and scalable open-source online code execution system. It can be used to build a wide range of applications varying from competitive programming platforms, educational and recruitment platforms, to online code editors, and more.

To see Judge0 API in action, try Judge0 IDE - a free and open-source online code editor that uses Judge0 API for executing the user’s source code. You can also try using a dummy client which can help you explore and test most of the features of the Judge0 API.

Official public API

Official public API is freely available at https://api.judge0.com and is maintained by the Judge0 creator.

Status page of all public Judge0 services is available at https://status.judge0.com.

Note

  • You do not need an authentication token (a.k.a. API key) for the official public API.

  • You do not need an authorization token for the official public API.

  • Official public API will always be at the latest available version.

Warning

We do not guarantee 100% uptime of the official public API.

Since the official public API is freely available, it is used by many users simultaneously, and it should only be used for small projects and testing purposes. Thus, it is not intended for use in a production environment.

For the production use, consider deploying your own instance of the Judge0 API.

Version

This document describes Judge0 API v1.7.1.

Date and time formats

ISO 8601 standard is used.

Example: 2016-09-11T10:19:35Z

License

Judge0 API is licensed under the GNU General Public License v3.0.

Donate

Your are more than welcome to support Judge0 on Patreon, via PayPal or Revolut. Your monthly or one-time donation will help cover server costs and will support development and maintenance. Thank you! ♥


Authentication

Administrators of Judge0 API can configure Judge0 API to require you to have an authentication token (a.k.a. API key). If that is the case with the instance of Judge0 API you are using, then you should provide X-Auth-Token header field in every API request.

Note

Authenticate

Authenticate
POST/authenticate

Check if your authentication token is valid.

Note

  • X-Auth-Token is default header field name, but administrators of Judge0 API instance you are using can change this default field name.

  • Contact administrator of Judge0 API instance you are using to get your authentication token.

Security Warning

  • Although you can send authentication token as URI parameter, always send authentication token through headers.

Example URI

POST https://api.judge0.com/authenticate
Request
HideShow
Headers
X-Auth-Token: f6583e60-b13b-4228-b554-2eb332ca64e7
Response  200
HideShow

If your authentication token is valid or authentication is disabled. If authentication is disabled you do not need an authentication token.

Response  401
HideShow

Authentication failed because your authentication token is invalid.

Authorization

To issue some API calls you need to be authorized. For example, you need to be authorized to list all submissions on Judge0 API.

Note

Authorize

Authorize
POST/authorize

With this API call you can check if your authorization token is valid. If authentication is enabled you should also authenticate in this API call.

Note

  • X-Auth-User is default header field name, but administrators of Judge0 API instance you are using can change this default field name.

  • Contact administrator of Judge0 API instance you are using to get your authorization token.

Security Warning

  • Although you can send authorization token as URI parameter, always send authorization token through headers.

Example URI

POST https://api.judge0.com/authorize
Request
HideShow
Headers
X-Auth-User: a1133bc6-a0f6-46bf-a2d8-6157418c6fe2
Response  200
HideShow

If your authorization token is valid.

Response  401
HideShow

Authentication failed. Please read about authentication process.

Response  403
HideShow

Authorization failed because your authorization token is invalid.

Submissions

Submission

Submission is used for running arbitrary source code in one of the available programming languages with specified runtime constraints.

Submission has 32 attributes. Attributes 1-19 are used for creating a new submissions, whereas attributes 20-32 give detailed information of submission after it’s execution.

Attributes 7-17 are called configuration variables and can be used to configure submission runtime constraints such as time and memory limits.

# Name Type Unit Description Default Value
1 source_code text Program’s source code. No default. This attribute is required.
2 language_id integer Language ID. No default. This attribute is required
3 compiler_options string (max. 512 chars) Options for the compiler (i.e. compiler flags). null
4 command_line_arguments string (max. 512 chars) Command line arguments for the program. null
5 stdin text Input for program. null. Program won’t receive anything to standard input.
6 expected_output text Expected output of program. Used when you want to compare with stdout. null. Program’s stdout won’t be compared with expected_output.
7 cpu_time_limit float second Default runtime limit for every program. Time in which the OS assigns the processor to different tasks is not counted. Depends on configuration.
8 cpu_extra_time float second When a time limit is exceeded, wait for extra time, before killing the program. This has the advantage that the real execution time is reported, even though it slightly exceeds the limit. Depends on configuration.
9 wall_time_limit float second Limit wall-clock time in seconds. Decimal numbers are allowed. This clock measures the time from the start of the program to its exit, so it does not stop when the program has lost the CPU or when it is waiting for an external event. We recommend to use cpu_time_limit as the main limit, but set wall_time_limit to a much higher value as a precaution against sleeping programs. Depends on configuration.
10 memory_limit float kilobyte Limit address space of the program. Depends on configuration.
11 stack_limit integer kilobyte Limit process stack. Depends on configuration.
12 max_processes_and_or_threads integer Maximum number of processes and/or threads program can create. Depends on configuration.
13 enable_per_process_and_thread_time_limit boolean If true then cpu_time_limit will be used as per process and thread. Depends on configuration.
14 enable_per_process_and_thread_memory_limit boolean If true then memory_limit will be used as per process and thread. Depends on configuration.
15 max_file_size integer kilobyte Limit file size created or modified by the program. Depends on configuration.
16 redirect_stderr_to_stdout boolean If true standard error will be redirected to standard output. Depends on configuration.
17 number_of_runs integer Run each program number_of_runs times and take average of time and memory. Depends on configuration.
18 additional_files Base64 Encoded String Additional files that should be available alongside the source code. Value of this string should represent the content of a .zip that contains additional files. null
19 callback_url string URL on which Judge0 API will issue PUT request with the submission in a request body after submission has been done. null
20 stdout text Standard output of the program after execution.
21 stderr text Standard error of the program after execution.
22 compile_output text Compiler output after compilation.
23 message text If submission status is Internal Error then this message comes from the Judge0 API itself, otherwise this is status message from isolate.
24 exit_code integer The program’s exit code.
25 exit_signal integer Signal code that the program recieved before exiting.
26 status object Submission status.
27 created_at datetime Date and time when submission was created.
28 finished_at datetime Date and time when submission was processed. null if submission is still in queue or if submission is processing.
29 token string Unique submission token which can be used to get a specific submission.
30 time float second Program’s run time.
31 wall_time float second Program’s wall time. Will be greater or equal to time.
32 memory float kilobyte Memory used by the program after execution.

Create a Submission
POST/submissions/{?base64_encoded,wait}

Creates new submission. Created submission waits in queue to be processed. On successful creation, you are returned submission token which can be used to check submission status.

If submission’s source_code, stdin or expected_output contains non printable characters, or characters which cannot be sent with JSON, then set base64_encoded parameter to true and send these attributes Base64 encoded. Your responsibility is to encode each of mentioned attributes (source_code, stdin and expected_output) even if just one of them contains non printable characters. By default, this parameter is set to false and Judge0 API assumes you are sending plain text data.

By default you are returned submission token on successful submission creation. With this token you can check submission status. Instead of checking submission status by making another request, you can set the wait query parameter to true which will enable you to get submission status immediately as part of response to the request you made. Please note that this feature may or may not be enabled on all Judge0 API hosts. So before using this feature please check configuration of Judge0 API you are using. On an official Judge0 API this feature is not enabled.

Note

  • We do not recommend the use of wait=true feature because it does not scale well.

Example URI

POST https://api.judge0.com/submissions/?base64_encoded=false&wait=false
URI Parameters
HideShow
base64_encoded
boolean (optional) Default: false Example: false

Set to true if you want to send Base64 encoded data to Judge0 API.

wait
boolean (optional) Default: false Example: false

Set to true to immediately get submission result.

Request
HideShow
Headers
Content-Type: application/json
Body
{
  "source_code": "#include <stdio.h>\n\nint main(void) {\n  char name[10];\n  scanf(\"%s\", name);\n  printf(\"hello, %s\n\", name);\n  return 0;\n}",
  "language_id": 4,
  "stdin": "world"
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "token": "d85cd024-1548-4165-96c7-7bc88673f194"
}
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "source_code": "#include <stdio.h>\n\nint main(void) {\n  char name[10];\n  scanf(\"%s\", name);\n  printf(\"hello, %s\n\", name);\n  return 0;\n}"
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "language_id": [
    "can't be blank"
  ]
}
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "source_code": "#include <stdio.h>\n\nint main(void) {\n  char name[10];\n  scanf(\"%s\", name);\n  printf(\"hello, %s\n\", name);\n  return 0;\n}",
  "language_id": 150000,
  "stdin": "world",
  "expected_output": "hello, world"
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "language_id": [
    "language with id 150000 doesn't exist"
  ]
}
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "source_code": "#include <stdio.h>\n\nint main(void) {\n  char name[10];\n  scanf(\"%s\", name);\n  printf(\"hello, %s\n\", name);\n  return 0;\n}",
  "language_id": 4,
  "number_of_runs": 1,
  "stdin": "Judge0",
  "expected_output": "hello, Judge0",
  "cpu_time_limit": 1,
  "cpu_extra_time": 0.5,
  "wall_time_limit": 100000,
  "memory_limit": 128000,
  "stack_limit": 128000,
  "enable_per_process_and_thread_time_limit": false,
  "enable_per_process_and_thread_memory_limit": false,
  "max_file_size": 1024
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "wall_time_limit": [
    "must be less than or equal to 150"
  ]
}
Request
HideShow

Sending Base64 encoded source_code and stdin. Note that in this request base64_encoded query parameter must be set to true.

Headers
Content-Type: appliction/json
Body
{
  "source_code": "I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CiAgY2hhciBuYW1lWzEwXTsKICBzY2FuZigiJXMiLCBuYW1lKTsKICBwcmludGYoImhlbGxvLCAlc1xuIiwgbmFtZSk7CiAgcmV0dXJuIDA7Cn0=",
  "language_id": 4,
  "input": "SnVkZ2Uw"
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "token": "f3fe0215-72f3-4fe6-97f5-353df6682db4"
}
Request
HideShow

Creating a submission with wait=true that results with one or more attributes that cannot be serialized to JSON without Base64 encoding.

Headers
Content-Type: application/json
Body
{
    "language_id": 70,
    "source_code": "print(\"\xFE\")"
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "token": "fcd0de6d-ee52-4a9d-8a00-6e0d98d394cf",
  "error": "some attributes for this submission cannot be converted to UTF-8, use base64_encoded=true query parameter"
}
Request
HideShow

Waiting for submission to finish. Note that in this request wait query parameter must be set to true.

Headers
Content-Type: application/json
Body
{
  "source_code": "#include <stdio.h>\n\nint main(void) {\n  char name[10];\n  scanf(\"%s\", name);\n  printf(\"hello, %s\n\", name);\n  return 0;\n}",
  "language_id": "4",
  "stdin": "Judge0",
  "expected_output": "hello, Judge0"
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "stdout": "hello, Judge0\n",
  "time": "0.001",
  "memory": 380,
  "stderr": null,
  "token": "eb0dd001-66db-47f4-8a69-b736c9bc23f6",
  "compile_output": null,
  "message": null,
  "status": {
    "id": 3,
    "description": "Accepted"
  }
}
Response  400
HideShow

If wait is not allowed.

Headers
Content-Type: application/json
Body
{
  "error": "wait not allowed"
}
Response  503
HideShow

If submission queue is full.

Headers
Content-Type: application/json
Body
{
  "error": "queue is full"
}
Response  401
HideShow

Authentication failed. Please read about authentication process.

Get a Submission
GET/submissions/{token}{?base64_encoded,fields}

Returns details about submission.

Just like in create submission you can receive Base64 encoded data for every text type attribute (check the table to see which attributes are text type). By default, this parameter is set to false and Judge0 API will send you raw data.

By default Judge0 API is sending 8 attributes for submission. By sending fields query parameter you can specify exactly which attributes you want from Judge0 API. Special value * will return all available attributes.

Example URI

GET https://api.judge0.com/submissions/d85cd024-1548-4165-96c7-7bc88673f194?base64_encoded=false&fields=stdout,stderr,status_id,language_id
URI Parameters
HideShow
token
string (required) Example: d85cd024-1548-4165-96c7-7bc88673f194

Token of submission. You got this token when you created submission.

base64_encoded
boolean (optional) Example: false

Set to true if you want to receive Base64 encoded data from Judge0 API.

fields
string (optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: stdout,stderr,status_id,language_id

Return only the desired attributes.

Response  200
HideShow
Headers
Content-Type: applicatiion/json
Body
{
  "stdout": "hello, world\n",
  "status_id": 5,
  "language_id": 4,
  "stderr": null
}
Response  200
HideShow

This is the default response. Leave fields parameter empty if you want to get default response.

Headers
Content-Type: application/json
Body
{
  "stdout": "hello, Judge0\n",
  "time": "0.001",
  "memory": 376,
  "stderr": null,
  "token": "8531f293-1585-4d36-a34c-73726792e6c9",
  "compile_output": null,
  "message": null,
  "status": {
    "id": 3,
    "description": "Accepted"
  }
}
Response  200
HideShow

Recieving Base64 encoded data for text type attributes. Note that in this reques base64_encoded query parameter must be set to true.

Headers
Content-Type: application/json
Body
{
  "stdout": "aGVsbG8sIEp1ZGdlMAo=\n",
  "time": "0.002",
  "memory": 376,
  "stderr": null,
  "token": "4e00f214-b8cb-4fcb-977b-429113c81ece",
  "compile_output": null,
  "message": null,
  "status": {
    "id": 3,
    "description": "Accepted"
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "some attributes for this submission cannot be converted to UTF-8, use base64_encoded=true query parameter"
}
Response  401
HideShow

Authentication failed. Please read about authentication process.

Get Submissions
GET/submissions/{?base64_encoded,fields,page,per_page}

Example URI

GET https://api.judge0.com/submissions/?base64_encoded=false&fields=status,language,time&page=4&per_page=2
URI Parameters
HideShow
base64_encoded
boolean (optional) Default: false Example: false

Set to true if you want to receive Base64 encoded data from Judge0 API.

page
integer (optional) Default: 1 Example: 4

Pagination page number.

per_page
integer (optional) Default: 20 Example: 2

Number of submissions to return per page.

fields
string (optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: status,language,time

Return only the desired attributes.

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "submissions": [
    {
      "time": "0.001",
      "status": {
        "id": 3,
        "description": "Accepted"
      },
      "language": {
        "id": 4,
        "name": "C (gcc 7.2.0)"
      }
    },
    {
      "time": "0.001",
      "status": {
        "id": 3,
        "description": "Accepted"
      },
      "language": {
        "id": 4,
        "name": "C (gcc 7.2.0)"
      }
    }
  ],
  "meta": {
    "current_page": 4,
    "next_page": 5,
    "prev_page": 3,
    "total_pages": 31,
    "total_count": 62
  }
}
Response  200
HideShow

When base64_encoded is set to true.

Headers
Content-Type: application/json
Body
{
  "submissions": [
    {
      "stdout": "aGVsbG8sIEp1ZGdlMAo=\n",
      "time": "0.001",
      "memory": 376,
      "stderr": null,
      "token": "a1133bc6-a0f6-46bf-a2d8-6157418c6fe2",
      "compile_output": null,
      "message": null,
      "status": {
        "id": 3,
        "description": "Accepted"
      }
    },
    {
      "stdout": "aGVsbG8sIEp1ZGdlMAo=\n",
      "time": "0.001",
      "memory": 380,
      "stderr": null,
      "token": "eb0dd001-66db-47f4-8a69-b736c9bc23f6",
      "compile_output": null,
      "message": null,
      "status": {
        "id": 3,
        "description": "Accepted"
      }
    }
  ],
  "meta": {
    "current_page": 4,
    "next_page": 5,
    "prev_page": 3,
    "total_pages": 31,
    "total_count": 62
  }
}
Response  400
HideShow

When page parameter is invalid.

Headers
Content-Type: application/json
Body
{
  "error": "invalid page: -4"
}
Response  400
HideShow

When per_page parameter is invalid.

Headers
Content-Type: application/json
Body
{
  "error": "invalid per_page: -2"
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "some attributes for one or more submissions cannot be converted to UTF-8, use base64_encoded=true query parameter"
}
Response  401
HideShow

Authentication failed. Please read about authentication process.

Response  403
HideShow

Authorization failed. Please read about authorization process.

Delete a Submission
DELETE/submissions/{token}{?fields}

Delete specific submission.

You need to be authorized to issue this request. Although you are authorized you might not be able to delete submission because administrator of Judge0 API instance you are using disallowed submission deletion. So before using this feature please check configuration of Judge0 API you are using.

For this request query parameter base64_encoded is implicitly set to true and cannot be changed. This guarantees you will successfully get requested submission attributes after deletion.

Example URI

DELETE https://api.judge0.com/submissions/d85cd024-1548-4165-96c7-7bc88673f194?fields=stdout,stderr,status_id,language_id
URI Parameters
HideShow
token
string (required) Example: d85cd024-1548-4165-96c7-7bc88673f194

Token of submission. You got this token when you created submission.

fields
string (optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: stdout,stderr,status_id,language_id

Return only the desired attributes.

Response  200
HideShow
Headers
Content-Type: applcation/json
Body
{
  "stdout": "aGVsbG8sIHdvcmxkCg==\n",
  "time": "0.045",
  "memory": 8556,
  "stderr": null,
  "token": "e80153f5-e7d8-4cd2-9e10-6c0ddbf9e3bf",
  "compile_output": null,
  "message": null,
  "status": {
    "id": 3,
    "description": "Accepted"
  }
}
Response  400
HideShow

If submission status is 1 or 2.

Headers
Content-Type: application/json
Body
{
  "error": "submission cannot be deleted because its status is 1 (In Queue)"
}
Response  401
HideShow

Authentication failed. Please read about authentication process.

Response  403
HideShow

Authorization failed. Please read about authorization process.

Submission Batch

Create a Submission Batch
POST/submissions/batch{?base64_encoded}

Create multiple submissions at once.

Example URI

POST https://api.judge0.com/submissions/batch?base64_encoded=false
URI Parameters
HideShow
base64_encoded
boolean (optional) Default: false Example: false

Set to true if you are sending Base64 encoded data.

Request
HideShow
Headers
Content-Type: application/json
Body
{
  "submissions": [
    {
      "language_id": 46,
      "source_code": "echo hello from Bash"
    },
    {
      "language_id": 71,
      "source_code": "print(\"hello from Python\")"
    },
    {
      "language_id": 72,
      "source_code": "puts(\"hello from Ruby\")"
    }
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "token": "db54881d-bcf5-4c7b-a2e3-d33fe7e25de7"
  },
  {
    "token": "ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1"
  },
  {
    "token": "1b35ec3b-5776-48ef-b646-d5522bdeb2cc"
  }
]
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "submissions": [
    {
      "language_id": 46,
      "source_code": "echo hello from Bash"
    },
    {
      "language_id": 123456789,
      "source_code": "print(\"hello from Python\")"
    },
    {
      "language_id": 72,
      "source_code": ""
    }
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "token": "c2dd8881-644b-462d-b1f9-73dd3bb0118a"
  },
  {
    "language_id": [
      "language with id 123456789 doesn't exist"
    ]
  },
  {
    "source_code": [
      "can't be blank"
    ]
  }
]

Get a Submission Batch
GET/submissions/batch{?tokens,base64_encoded,fields}

Get multiple submissions at once.

Example URI

GET https://api.judge0.com/submissions/batch?tokens=db54881d-bcf5-4c7b-a2e3-d33fe7e25de7,ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1,1b35ec3b-5776-48ef-b646-d5522bdeb2cc&base64_encoded=false&fields=token,stdout,stderr,status_id,language_id
URI Parameters
HideShow
tokens
string (required) Example: db54881d-bcf5-4c7b-a2e3-d33fe7e25de7,ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1,1b35ec3b-5776-48ef-b646-d5522bdeb2cc

Submission tokens separeted with ,.

base64_encoded
boolean (optional) Default: false Example: false

Set to true if you want to receive Base64 encoded data.

fields
string (optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: token,stdout,stderr,status_id,language_id

Return only the desired attributes.

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "submissions": [
    {
      "language_id": 46,
      "stdout": "hello from Bash\n",
      "status_id": 3,
      "stderr": null,
      "token": "db54881d-bcf5-4c7b-a2e3-d33fe7e25de7"
    },
    {
      "language_id": 71,
      "stdout": "hello from Python\n",
      "status_id": 3,
      "stderr": null,
      "token": "ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1"
    },
    {
      "language_id": 72,
      "stdout": "hello from Ruby\n",
      "status_id": 3,
      "stderr": null,
      "token": "1b35ec3b-5776-48ef-b646-d5522bdeb2cc"
    }
  ]
}

Statuses and Languages

Language

Get Languages
GET/languages/

Get active languages.

Example URI

GET https://api.judge0.com/languages/
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "id": 45,
    "name": "Assembly (NASM 2.14.02)"
  },
  {
    "id": 46,
    "name": "Bash (5.0.0)"
  },
  {
    "id": 47,
    "name": "Basic (FBC 1.07.1)"
  },
  {
    "id": 48,
    "name": "C (GCC 7.4.0)"
  },
  {
    "id": 52,
    "name": "C++ (GCC 7.4.0)"
  },
  {
    "id": 49,
    "name": "C (GCC 8.3.0)"
  },
  {
    "id": 53,
    "name": "C++ (GCC 8.3.0)"
  },
  {
    "id": 50,
    "name": "C (GCC 9.2.0)"
  },
  {
    "id": 54,
    "name": "C++ (GCC 9.2.0)"
  },
  {
    "id": 51,
    "name": "C# (Mono 6.6.0.161)"
  },
  {
    "id": 55,
    "name": "Common Lisp (SBCL 2.0.0)"
  },
  {
    "id": 56,
    "name": "D (DMD 2.089.1)"
  },
  {
    "id": 57,
    "name": "Elixir (1.9.4)"
  },
  {
    "id": 58,
    "name": "Erlang (OTP 22.2)"
  },
  {
    "id": 44,
    "name": "Executable"
  },
  {
    "id": 59,
    "name": "Fortran (GFortran 9.2.0)"
  },
  {
    "id": 60,
    "name": "Go (1.13.5)"
  },
  {
    "id": 61,
    "name": "Haskell (GHC 8.8.1)"
  },
  {
    "id": 62,
    "name": "Java (OpenJDK 13.0.1)"
  },
  {
    "id": 63,
    "name": "JavaScript (Node.js 12.14.0)"
  },
  {
    "id": 64,
    "name": "Lua (5.3.5)"
  },
  {
    "id": 65,
    "name": "OCaml (4.09.0)"
  },
  {
    "id": 66,
    "name": "Octave (5.1.0)"
  },
  {
    "id": 67,
    "name": "Pascal (FPC 3.0.4)"
  },
  {
    "id": 68,
    "name": "PHP (7.4.1)"
  },
  {
    "id": 43,
    "name": "Plain Text"
  },
  {
    "id": 69,
    "name": "Prolog (GNU Prolog 1.4.5)"
  },
  {
    "id": 70,
    "name": "Python (2.7.17)"
  },
  {
    "id": 71,
    "name": "Python (3.8.1)"
  },
  {
    "id": 72,
    "name": "Ruby (2.7.0)"
  },
  {
    "id": 73,
    "name": "Rust (1.40.0)"
  },
  {
    "id": 74,
    "name": "TypeScript (3.7.4)"
  }
]

Get a Language
GET/languages/{id}

Example URI

GET https://api.judge0.com/languages/1
URI Parameters
HideShow
id
integer (required) Example: 1

Language ID.

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 1,
  "name": "Bash (4.4)",
  "is_archived": true,
  "source_file": "script.sh",
  "compile_cmd": null,
  "run_cmd": "/usr/local/bash-4.4/bin/bash script.sh"
}

Active and Archived Languages

Get Active and Archived Languages
GET/languages/all

Get active and archived languages.

Example URI

GET https://api.judge0.com/languages/all
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "id": 45,
    "name": "Assembly (NASM 2.14.02)",
    "is_archived": false
  },
  {
    "id": 2,
    "name": "Bash (4.0)",
    "is_archived": true
  },
  {
    "id": 1,
    "name": "Bash (4.4)",
    "is_archived": true
  },
  {
    "id": 46,
    "name": "Bash (5.0.0)",
    "is_archived": false
  },
  {
    "id": 3,
    "name": "Basic (fbc 1.05.0)",
    "is_archived": true
  },
  {
    "id": 47,
    "name": "Basic (FBC 1.07.1)",
    "is_archived": false
  },
  {
    "id": 15,
    "name": "C++ (g++ 4.8.5)",
    "is_archived": true
  },
  {
    "id": 14,
    "name": "C++ (g++ 4.9.4)",
    "is_archived": true
  },
  {
    "id": 13,
    "name": "C++ (g++ 5.4.0)",
    "is_archived": true
  },
  {
    "id": 12,
    "name": "C++ (g++ 6.3.0)",
    "is_archived": true
  },
  {
    "id": 11,
    "name": "C++ (g++ 6.4.0)",
    "is_archived": true
  },
  {
    "id": 10,
    "name": "C++ (g++ 7.2.0)",
    "is_archived": true
  },
  {
    "id": 9,
    "name": "C (gcc 4.8.5)",
    "is_archived": true
  },
  {
    "id": 8,
    "name": "C (gcc 4.9.4)",
    "is_archived": true
  },
  {
    "id": 7,
    "name": "C (gcc 5.4.0)",
    "is_archived": true
  },
  {
    "id": 6,
    "name": "C (gcc 6.3.0)",
    "is_archived": true
  },
  {
    "id": 5,
    "name": "C (gcc 6.4.0)",
    "is_archived": true
  },
  {
    "id": 4,
    "name": "C (gcc 7.2.0)",
    "is_archived": true
  },
  {
    "id": 48,
    "name": "C (GCC 7.4.0)",
    "is_archived": false
  },
  {
    "id": 52,
    "name": "C++ (GCC 7.4.0)",
    "is_archived": false
  },
  {
    "id": 49,
    "name": "C (GCC 8.3.0)",
    "is_archived": false
  },
  {
    "id": 53,
    "name": "C++ (GCC 8.3.0)",
    "is_archived": false
  },
  {
    "id": 50,
    "name": "C (GCC 9.2.0)",
    "is_archived": false
  },
  {
    "id": 54,
    "name": "C++ (GCC 9.2.0)",
    "is_archived": false
  },
  {
    "id": 18,
    "name": "Clojure (1.8.0)",
    "is_archived": true
  },
  {
    "id": 17,
    "name": "C# (mono 5.2.0.224)",
    "is_archived": true
  },
  {
    "id": 16,
    "name": "C# (mono 5.4.0.167)",
    "is_archived": true
  },
  {
    "id": 51,
    "name": "C# (Mono 6.6.0.161)",
    "is_archived": false
  },
  {
    "id": 55,
    "name": "Common Lisp (SBCL 2.0.0)",
    "is_archived": false
  },
  {
    "id": 19,
    "name": "Crystal (0.23.1)",
    "is_archived": true
  },
  {
    "id": 56,
    "name": "D (DMD 2.089.1)",
    "is_archived": false
  },
  {
    "id": 20,
    "name": "Elixir (1.5.1)",
    "is_archived": true
  },
  {
    "id": 57,
    "name": "Elixir (1.9.4)",
    "is_archived": false
  },
  {
    "id": 21,
    "name": "Erlang (OTP 20.0)",
    "is_archived": true
  },
  {
    "id": 58,
    "name": "Erlang (OTP 22.2)",
    "is_archived": false
  },
  {
    "id": 44,
    "name": "Executable",
    "is_archived": false
  },
  {
    "id": 59,
    "name": "Fortran (GFortran 9.2.0)",
    "is_archived": false
  },
  {
    "id": 60,
    "name": "Go (1.13.5)",
    "is_archived": false
  },
  {
    "id": 22,
    "name": "Go (1.9)",
    "is_archived": true
  },
  {
    "id": 24,
    "name": "Haskell (ghc 8.0.2)",
    "is_archived": true
  },
  {
    "id": 23,
    "name": "Haskell (ghc 8.2.1)",
    "is_archived": true
  },
  {
    "id": 61,
    "name": "Haskell (GHC 8.8.1)",
    "is_archived": false
  },
  {
    "id": 25,
    "name": "Insect (5.0.0)",
    "is_archived": true
  },
  {
    "id": 62,
    "name": "Java (OpenJDK 13.0.1)",
    "is_archived": false
  },
  {
    "id": 28,
    "name": "Java (OpenJDK 7)",
    "is_archived": true
  },
  {
    "id": 27,
    "name": "Java (OpenJDK 8)",
    "is_archived": true
  },
  {
    "id": 26,
    "name": "Java (OpenJDK 9 with Eclipse OpenJ9)",
    "is_archived": true
  },
  {
    "id": 63,
    "name": "JavaScript (Node.js 12.14.0)",
    "is_archived": false
  },
  {
    "id": 30,
    "name": "JavaScript (nodejs 7.10.1)",
    "is_archived": true
  },
  {
    "id": 29,
    "name": "JavaScript (nodejs 8.5.0)",
    "is_archived": true
  },
  {
    "id": 64,
    "name": "Lua (5.3.5)",
    "is_archived": false
  },
  {
    "id": 31,
    "name": "OCaml (4.05.0)",
    "is_archived": true
  },
  {
    "id": 65,
    "name": "OCaml (4.09.0)",
    "is_archived": false
  },
  {
    "id": 32,
    "name": "Octave (4.2.0)",
    "is_archived": true
  },
  {
    "id": 66,
    "name": "Octave (5.1.0)",
    "is_archived": false
  },
  {
    "id": 33,
    "name": "Pascal (fpc 3.0.0)",
    "is_archived": true
  },
  {
    "id": 67,
    "name": "Pascal (FPC 3.0.4)",
    "is_archived": false
  },
  {
    "id": 68,
    "name": "PHP (7.4.1)",
    "is_archived": false
  },
  {
    "id": 43,
    "name": "Plain Text",
    "is_archived": false
  },
  {
    "id": 69,
    "name": "Prolog (GNU Prolog 1.4.5)",
    "is_archived": false
  },
  {
    "id": 37,
    "name": "Python (2.6.9)",
    "is_archived": true
  },
  {
    "id": 70,
    "name": "Python (2.7.17)",
    "is_archived": false
  },
  {
    "id": 36,
    "name": "Python (2.7.9)",
    "is_archived": true
  },
  {
    "id": 35,
    "name": "Python (3.5.3)",
    "is_archived": true
  },
  {
    "id": 34,
    "name": "Python (3.6.0)",
    "is_archived": true
  },
  {
    "id": 71,
    "name": "Python (3.8.1)",
    "is_archived": false
  },
  {
    "id": 41,
    "name": "Ruby (2.1.9)",
    "is_archived": true
  },
  {
    "id": 40,
    "name": "Ruby (2.2.6)",
    "is_archived": true
  },
  {
    "id": 39,
    "name": "Ruby (2.3.3)",
    "is_archived": true
  },
  {
    "id": 38,
    "name": "Ruby (2.4.0)",
    "is_archived": true
  },
  {
    "id": 72,
    "name": "Ruby (2.7.0)",
    "is_archived": false
  },
  {
    "id": 42,
    "name": "Rust (1.20.0)",
    "is_archived": true
  },
  {
    "id": 73,
    "name": "Rust (1.40.0)",
    "is_archived": false
  },
  {
    "id": 74,
    "name": "TypeScript (3.7.4)",
    "is_archived": false
  }
]

Status

Get Statuses
GET/statuses

Example URI

GET https://api.judge0.com/statuses
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "id": 1,
    "description": "In Queue"
  },
  {
    "id": 2,
    "description": "Processing"
  },
  {
    "id": 3,
    "description": "Accepted"
  },
  {
    "id": 4,
    "description": "Wrong Answer"
  },
  {
    "id": 5,
    "description": "Time Limit Exceeded"
  },
  {
    "id": 6,
    "description": "Compilation Error"
  },
  {
    "id": 7,
    "description": "Runtime Error (SIGSEGV)"
  },
  {
    "id": 8,
    "description": "Runtime Error (SIGXFSZ)"
  },
  {
    "id": 9,
    "description": "Runtime Error (SIGFPE)"
  },
  {
    "id": 10,
    "description": "Runtime Error (SIGABRT)"
  },
  {
    "id": 11,
    "description": "Runtime Error (NZEC)"
  },
  {
    "id": 12,
    "description": "Runtime Error (Other)"
  },
  {
    "id": 13,
    "description": "Internal Error"
  },
  {
    "id": 14,
    "description": "Exec Format Error"
  }
]

System and Configuration

System Info

System Info
GET/system_info

System information gives you detailed information about system on which Judge0 API is running.

This information is result of two commands on a host system:

  • lscpu

  • free -h

Please note that Judge0 API consists of two systems: web and worker. Web system is the one who provides you the web API, and Worker is the one who processes your submissions. They can be placed on two or more different hosts with different system configurations. Result of this API request is always from web system. This means that this request might be irrelevant to you if you as user don’t know if web and worker are hosted on the same machine. To find that out, please contact admins who host Judge0 API you are using.

Example URI

GET https://api.judge0.com/system_info
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "Architecture": "x86_64",
  "CPU op-mode(s)": "32-bit, 64-bit",
  "Byte Order": "Little Endian",
  "CPU(s)": "4",
  "On-line CPU(s) list": "0-3",
  "Thread(s) per core": "2",
  "Core(s) per socket": "2",
  "Socket(s)": "1",
  "NUMA node(s)": "1",
  "Vendor ID": "GenuineIntel",
  "CPU family": "6",
  "Model": "61",
  "Model name": "Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz",
  "Stepping": "4",
  "CPU MHz": "2508.703",
  "CPU max MHz": "2700.0000",
  "CPU min MHz": "500.0000",
  "BogoMIPS": "4392.12",
  "Virtualization": "VT-x",
  "L1d cache": "32K",
  "L1i cache": "32K",
  "L2 cache": "256K",
  "L3 cache": "3072K",
  "NUMA node0 CPU(s)": "0-3",
  "Mem": "7.7G",
  "Swap": "8.0G"
}

Configuration Info

Configuration Info
GET/config_info

Configuration information gives you detailed information about configuration of Judge0 API. This configuration can be changed through judge0-api.conf file by admin who hosts Judge0 API instance.

This configuration gives every admin a flexibility to configure Judge0 API according to server abilities and needs. It also gives users insight on some default configuration values which are used when their programs are run.

Each of these configuration variables have default values which we consider as recommended in case you are not sure should you change them.

We will refer to default values as values which Judge0 API automatically assigns to each of these configuration variables, if admin didn’t set them. For example, default value of configuration variable cpu_time_limit is 2.

# Name Type Unit Description Default Value
1 enable_wait_result boolean If enabled user can request to synchronously wait for submission result on submission create. true
2 enable_compiler_options boolean If enabled user can set compiler_options. true
3 allowed_languages_for_compile_options list of strings Languages for which setting compiler options is allowed. Empty, i.e. for all languages it is allowed to set compiler options.
4 enable_command_line_arguments boolean If enabled user can set command_line_arguments. true
5 enable_submission_delete boolean If enabled authorized user can delete a submission. false
6 max_queue_size integer Maximum number of submissions that can wait in queue. 100
7 cpu_time_limit float second Default runtime limit for every program (in seconds). Decimal numbers are allowed. Time in which the OS assigns the processor to different tasks is not counted. 2
8 cpu_extra_time float second When a time limit is exceeded, wait for extra time, before killing the program. This has the advantage that the real execution time is reported, even though it slightly exceeds the limit. 0.5
9 wall_time_limit float second Limit wall-clock time in seconds. Decimal numbers are allowed. This clock measures the time from the start of the program to its exit, for an external event. We recommend to use cpu_time_limit as the main limit, but set wall_time_limit to a much higher value as a precaution against sleeping programs. 5
10 memory_limit integer kilobyte Limit address space of the program in kilobytes. 128000
11 stack_limit integer kilobyte Limit process stack in kilobytes. 64000
12 max_processes_and_or_threads integer Maximum number of processes and/or threads program can create. 60
13 enable_per_process_and_thread_time_limit boolean If true then cpu_time_limit will be used as per process and thread. false
14 enable_per_process_and_thread_memory_limit boolean If true then memory_limit will be used as per process and thread. true
15 max_file_size integer kilobyte Limit size of files created (or modified) by the program. 1024
16 number_of_runs integer Run each program this many times and take average of time and memory. 1

Default configuration value for each variable is given to you as response of this API call. For example, default configuration value for variable cpu_extra_time might be 2, and if admin didn’t set this, then it is 0.5 (default value). This means that admin set cpu_extra_time configuration variable to value 2 and we say it is now default configuration value for this variable cpu_extra_time.

Every submission can change each of the configuration variables according to its needs. For example, user might create submission which has cpu_time_limit of 5 seconds. For security reasons we need to limit values of each of these configuration variables. For example, we don’t want user to create a submission which has cpu_time_limit of 100000 seconds.

For this security reason we are introducing limit configuration variables for each configuration variable.

# Name Type Unit Description Default Value
1 max_cpu_time_limit float second Maximum custom cpu_time_limit 15
2 max_cpu_extra_time float second Maximum custom cpu_extra_time 2
3 max_wall_time_limit float second Maximum custom wall_time_limit 20
4 max_memory_limit integer kilobyte Maximum custom memory_limit 256000
5 max_stack_limit integer kilobyte Maximum custom stack_limit 128000
6 max_max_processes_and_or_threads integer Maximum custom max_processes_and_or_threads 120
7 allow_enable_per_process_and_thread_time_limit boolean If false user won’t be able to set enable_per_process_and_thread_time_limit to true true
8 allow_enable_per_process_and_thread_memory_limit boolean If false user won’t be able to set enable_per_process_and_thread_memory_limit to true true
9 max_max_file_size integer kilobyte Maximux custom max_file_size 4096
10 max_number_of_runs integer Maximum custom number_of_runs 20

For example, max_cpu_time_limit with value 20 means that user cannot create new submission which has cpu_time_limit greater than 20.

Example URI

GET https://api.judge0.com/config_info
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "enable_wait_result": true,
  "enable_compiler_options": true,
  "allowed_languages_for_compile_options": [],
  "enable_command_line_arguments": true,
  "enable_submission_delete": false,
  "max_queue_size": 100,
  "cpu_time_limit": 2,
  "max_cpu_time_limit": 15,
  "cpu_extra_time": 0.5,
  "max_cpu_extra_time": 2,
  "wall_time_limit": 5,
  "max_wall_time_limit": 20,
  "memory_limit": 128000,
  "max_memory_limit": 256000,
  "stack_limit": 64000,
  "max_stack_limit": 128000,
  "max_processes_and_or_threads": 60,
  "max_max_processes_and_or_threads": 120,
  "enable_per_process_and_thread_time_limit": false,
  "allow_enable_per_process_and_thread_time_limit": true,
  "enable_per_process_and_thread_memory_limit": true,
  "allow_enable_per_process_and_thread_memory_limit": true,
  "max_file_size": 1024,
  "max_max_file_size": 4096,
  "number_of_runs": 1,
  "max_number_of_runs": 20
}

Statistics

Statistics

Statistics
GET/statistics

Get some statistics from current instance. Result is cached for 10 minutes.

Example URI

GET https://api.judge0.com/statistics

Health Check

Workers Health Check

Workers Health Check
GET/workers

For each queue you will get:

  • queue name

  • available number of workers

  • how many workers are idle

  • how many workers are currently working

  • how many workers are paused

  • how many jobs failed

Example URI

GET https://api.judge0.com/workers
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
    {
        "queue": "default"
        "available": 1,
        "idle": 1,
        "working": 0,
        "paused": 0,
        "failed": 0
    }
]

Information

About

About
GET/about

Returns general information.

Example URI

GET https://api.judge0.com/about
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "version": "1.5.0",
  "homepage": "https://judge0.com",
  "source_code": "https://github.com/judge0/api",
  "maintainer": "Herman Zvonimir Došilović <[email protected]>"
}

Version

Version
GET/version

Returns current version.

Example URI

GET https://api.judge0.com/version

Isolate

Isolate
GET/isolate

Returns result of isolate --version.

Example URI

GET https://api.judge0.com/isolate

License

License
GET/license

Returns a license.

Example URI

GET https://api.judge0.com/license

Generated by aglio on 06 May 2020