Judge0 CE - API Docs
About
Judge0 is a robust, scalable, and open-source online code execution system. You can use it to build a wide range of applications that need online code execution features. Some examples include competitive programming platforms, e-learning platforms, candidate assessment and recruitment platforms, online code editors, online IDEs, and many more.
In our research paper Robust and Scalable Online Code Execution System, we present Judge0’s modern modular architecture that can be easily deployed and scaled. We study its design, comment on the various challenges in building such systems, and compare it with other available online code execution systems and online judge systems.
To see Judge0 in action, try Judge0 IDE - our free and open-source online code editor. You can also try using a dummy client that can help you explore and test most of the features of Judge0.
Easily integrate online code editor with code execution (a.k.a. online compiler) to your website with our embeddable web widgets.
Features
- Quick and easy installation
- Rich and verbose API documentation
- Scalable architecture
- Sandboxed compilation and execution
- Support for 60+ languages
- Compilation and execution of multi-file programs
- Support for additional files alongside the user's program
- Support for custom user-defined compiler options, command-line arguments, and time and memory limits
- Detailed execution results
- Webhooks (HTTP callbacks)
Get Started
Feel free to start with the FREE Basic Plan on RapidAPI or host it yourself.
You can find our detailed plans and pricing here.
Why should you use Judge0 on RapidAPI?
Our infrastructure allows you to focus on building your product and forget about the know-how of maintaining and scaling Judge0.
RapidAPI plans are not (good) enough for you?
Let’s talk. Contact us.
Flavors
Judge0 comes in two flavors: Judge0 CE and Judge0 Extra CE. They differ mostly in the supported languages.
You can find the source code for Judge0 CE on the master
branch, while you can find the source code for Judge0 Extra CE on the extra
branch.
Judge0 Extra CE is also available on RapidAPI.
Version
This document describes Judge0 CE v1.13.0.
Date and time formats
ISO 8601 standard is used.
Example: 2016-09-11T10:19:35Z
License
Judge0 is licensed under the GNU General Public License v3.0.
Donate
Your are more than welcome to support Judge0 development on Patreon, via PayPal or Revolut. Thank you.
Authentication ¶
Administrators of Judge0 can configure Judge0 to require you to have an authentication token (a.k.a. API key).
If that is the case with the instance of Judge0 you are using, then you
should provide X-Auth-Token
header field in every API request.
Authenticate ¶
AuthenticatePOST/authenticate
Check if your authentication token is valid.
Note
-
X-Auth-Token
is default header field name, but administrators of Judge0 instance you are using can change this default field name. -
Contact administrator of Judge0 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
Headers
X-Auth-Token: f6583e60-b13b-4228-b554-2eb332ca64e7
200
If your authentication token is valid or authentication is disabled. If authentication is disabled you do not need an authentication token.
401
Authentication failed because your authentication 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 33 attributes. Attributes 1-20 are used for creating a new submissions, whereas attributes 21-33 give detailed information of submission after it’s execution.
Attributes 7-18 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 for single-file programs. | |
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 | enable_network |
boolean | If true program will have network access. |
Depends on configuration. | |
18 | number_of_runs |
integer | Run each program number_of_runs times and take average of time and memory . |
Depends on configuration. | |
19 | 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. This attribute is required for multi-file programs. |
null |
|
20 | callback_url |
string | URL on which Judge0 will issue PUT request with the submission in a request body after submission has been done. |
null |
|
21 | stdout |
text | Standard output of the program after execution. | ||
22 | stderr |
text | Standard error of the program after execution. | ||
23 | compile_output |
text | Compiler output after compilation. | ||
24 | message |
text | If submission status is Internal Error then this message comes from Judge0 itself, otherwise this is status message from isolate. |
||
25 | exit_code |
integer | The program’s exit code. | ||
26 | exit_signal |
integer | Signal code that the program recieved before exiting. | ||
27 | status |
object | Submission status. | ||
28 | created_at |
datetime | Date and time when submission was created. | ||
29 | finished_at |
datetime | Date and time when submission was processed. | null if submission is still in queue or if submission is processing. |
|
30 | token |
string | Unique submission token which can be used to get a specific submission. | ||
31 | time |
float | second | Program’s run time. | |
32 | wall_time |
float | second | Program’s wall time. Will be greater or equal to time . |
|
33 | memory |
float | kilobyte | Memory used by the program after execution. |
Single-file programs and multi-file programs
Judge0 can run both single-file and multi-file programs in a sandboxed environment with specified resource limitations. The usage of multi-file programs is slightly different from single-file programs and this section explains their differences and when they should be used.
Single-file programs
This is the simplest way to run a program with Judge0. Pick a language with language_id
, provide a source_code
and Judge0 will use predefined compilation and execution scripts for specified language. Additionally you can set custom compile flags, provide command line arguments and send additional_files
that will be available in the sandbox alongside your single-file program.
With additional_files
you can send, for example, Python modules which are imported by your main program that you provided in source_code
attribute. For C or C++ programs with additional_files
you can send header files which are included by your main program that you provided in source_code
attribute.
Even though you can send and use multiple Python modules or C and C++ header files, we call this single-file programs because for compiled languages only one source file is compiled with predefined compilation scripts.
Multi-file programs
Multi-file programs are available since v1.10.0 and they allow you specify your own compilation and execution scripts that Judge0 will use.
To use multi-file program feature you need to choose a language called Multi-file program whoose ID is 89. Moreover, you need to send all program files with additional_files
attribute. With multi-file programs attribute source_code
cannot be used, i.e. all files should be sent with additional_files
attribute.
As mentioned in the table above, additional_files
attribute should be a content of a Base64 encoded .zip
archive. This archive will be extracted in the sandbox before compilation and execution.
For the Judge0 to know how to compile and execute your multi-file program you need to provide two special files that should be available in the root of the .zip
archive that you are sending with additional_files
attribute. These files should be named compile
and run
, and are expected to be Bash scripts that know how to compile and execute your multi-file program. If your multi-file program does not need compilation step, then you don’t need to provide compile
script. Take a look at this example to learn how to use this feature to compile and run multi-file C++ project that uses CMake.
Create a SubmissionPOST/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 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 hosts. So before using this feature please check configuration of Judge0 you are using. On an official Judge0 this feature is not enabled.
Note
- We do not recommend the use of
wait=true
feature because it does not scale well.
Example URI
- base64_encoded
boolean
(optional) Default: false Example: falseSet to
true
if you want to send Base64 encoded data to Judge0.- wait
boolean
(optional) Default: false Example: falseSet to
true
to immediately get submission result.
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"
}
201
Headers
Content-Type: application/json
Body
{
"token": "d85cd024-1548-4165-96c7-7bc88673f194"
}
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}"
}
422
Headers
Content-Type: application/json
Body
{
"language_id": [
"can't be blank"
]
}
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"
}
422
Headers
Content-Type: application/json
Body
{
"language_id": [
"language with id 150000 doesn't exist"
]
}
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
}
422
Headers
Content-Type: application/json
Body
{
"wall_time_limit": [
"must be less than or equal to 150"
]
}
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"
}
201
Headers
Content-Type: application/json
Body
{
"token": "f3fe0215-72f3-4fe6-97f5-353df6682db4"
}
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\")"
}
201
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"
}
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"
}
201
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"
}
}
400
If wait is not allowed.
Headers
Content-Type: application/json
Body
{
"error": "wait not allowed"
}
503
If submission queue is full.
Headers
Content-Type: application/json
Body
{
"error": "queue is full"
}
401
Authentication failed. Please read about authentication process.
Get a SubmissionGET/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 will send you raw data.
By default Judge0 is sending 8 attributes for submission. By sending fields
query parameter you can specify exactly which attributes you want from Judge0. Special value *
will return all available attributes.
Example URI
- token
string
(required) Example: d85cd024-1548-4165-96c7-7bc88673f194Token of submission. You got this token when you created submission.
- base64_encoded
boolean
(optional) Example: falseSet to
true
if you want to receive Base64 encoded data from Judge0. You should set this totrue
if you expect the program’s stdout to contain non-printable characters or if you expect the compiler to output non-printable characters during a compile error (GCC does this, for instance).- fields
string
(optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: stdout,stderr,status_id,language_idReturn only the desired attributes.
200
Headers
Content-Type: applicatiion/json
Body
{
"stdout": "hello, world\n",
"status_id": 5,
"language_id": 4,
"stderr": null
}
200
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"
}
}
200
Receiving Base64 encoded data for text type attributes. Note that in this request 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"
}
}
400
Headers
Content-Type: application/json
Body
{
"error": "some attributes for this submission cannot be converted to UTF-8, use base64_encoded=true query parameter"
}
401
Authentication failed. Please read about authentication process.
Get SubmissionsGET/submissions/{?base64_encoded,fields,page,per_page}
Example URI
- base64_encoded
boolean
(optional) Default: false Example: falseSet to
true
if you want to receive Base64 encoded data from Judge0.- page
integer
(optional) Default: 1 Example: 4Pagination page number.
- per_page
integer
(optional) Default: 20 Example: 2Number of submissions to return per page.
- fields
string
(optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: status,language,timeReturn only the desired attributes.
200
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
}
}
200
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
}
}
400
When page
parameter is invalid.
Headers
Content-Type: application/json
Body
{
"error": "invalid page: -4"
}
400
When per_page
parameter is invalid.
Headers
Content-Type: application/json
Body
{
"error": "invalid per_page: -2"
}
400
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"
}
401
Authentication failed. Please read about authentication process.
403
Authorization failed. Please read about authorization process.
Delete a SubmissionDELETE/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 instance you are using disallowed submission deletion. So before using this feature please check configuration of Judge0 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
- token
string
(required) Example: d85cd024-1548-4165-96c7-7bc88673f194Token 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_idReturn only the desired attributes.
200
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"
}
}
400
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)"
}
401
Authentication failed. Please read about authentication process.
403
Authorization failed. Please read about authorization process.
Submission Batch ¶
Create a Submission BatchPOST/submissions/batch{?base64_encoded}
Create multiple submissions at once.
Example URI
- base64_encoded
boolean
(optional) Default: false Example: falseSet to
true
if you are sending Base64 encoded data.
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\")"
}
]
}
201
Headers
Content-Type: application/json
Body
[
{
"token": "db54881d-bcf5-4c7b-a2e3-d33fe7e25de7"
},
{
"token": "ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1"
},
{
"token": "1b35ec3b-5776-48ef-b646-d5522bdeb2cc"
}
]
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": ""
}
]
}
201
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 BatchGET/submissions/batch{?tokens,base64_encoded,fields}
Get multiple submissions at once.
Example URI
- tokens
string
(required) Example: db54881d-bcf5-4c7b-a2e3-d33fe7e25de7,ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1,1b35ec3b-5776-48ef-b646-d5522bdeb2ccSubmission tokens separeted with
,
.- base64_encoded
boolean
(optional) Default: false Example: falseSet 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_idReturn only the desired attributes.
200
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 LanguagesGET/languages/
Get active languages.
Example URI
200
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 LanguageGET/languages/{id}
Example URI
- id
integer
(required) Example: 1Language ID.
200
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 LanguagesGET/languages/all
Get active and archived languages.
Example URI
200
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 StatusesGET/statuses
Example URI
200
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 InfoGET/system_info
System information gives you detailed information about system on which Judge0 is running.
This information is result of two commands on a host system:
-
lscpu
-
free -h
Please note that Judge0 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 you are using.
Example URI
200
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 InfoGET/config_info
Configuration information gives you detailed information about configuration of Judge0. This configuration can be changed through judge0.conf file by admin who hosts Judge0 instance.
This configuration gives every admin a flexibility to configure Judge0 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 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 | allow_enable_network |
boolean | If enabled user can set enable_network . |
true | |
17 | enable_network |
boolean | If enabled program will have network access. | true | |
18 | 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
200
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 ¶
Health Check ¶
Workers ¶
WorkersGET/workers
For each queue you will get:
-
queue
name -
queue
size
, i.e. number of submissions that are currently waiting to be processed -
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
200
Headers
Content-Type: application/json
Body
[
{
"queue": "default",
"size": 0,
"available": 1,
"idle": 1,
"working": 0,
"paused": 0,
"failed": 0
}
]
Information ¶
About ¶
AboutGET/about
Returns general information.
Example URI
200
Headers
Content-Type: application/json
Body
{
"version": "1.5.0",
"homepage": "https://judge0.com",
"source_code": "https://github.com/judge0/judge0",
"maintainer": "Herman Zvonimir Došilović <hermanz.dosilovic@gmail.com>"
}